当前位置:网站首页>redis多节点部署实施指引
redis多节点部署实施指引
2022-07-30 06:12:00 【weixin_44953227】
一、定义并创建安装目
mkdir /home/soft/redis
cd /home/soft/redis
二、下载源码和编译
wget https://download.redis.io/releases/redis-6.2.4.tar.gz
tar xzf redis-6.2.4.tar.gz
cd redis-6.2.4
make
三、安装节点
我们可以在一台服务器安装多个节点,不用的节点使用的端口不同,节点的目录也不同,以下以dev节点和test节点为例
1、安装dev节点
1.1定义并安装dev节点目录
节点主目录
mkdir /home/soft/redis/dev
节点数据目录
mkdir /home/soft/redis/dev/data
1.2复制默认配置文件到该节点
cp /home/soft/redis/redis-6.2.4/redis.conf /home/soft/redis/dev
1.3修改/home/soft/redis/dev/redis.conf
#开启redis服务后台运行
daemonize yes
#文件名称(暂停服务时会把缓存数据备份到这里)
dbfilename dump6380.rdb
#设置文件路径
dir /home/soft/redis/dev/data
#日志文件路径
logfile "/home/soft/redis/dev/redis6380.log"
#端口
port 6380
#进程ID
pidfile /home/soft/redis/dev/devredis_6380.pid
#最大连接数
maxclients 100000
#最大内存
maxmemory 10G
#mima(示例,按需修改下面的值)
requirepass zsoft
1.4启动服务
cd /home/soft/redis/redis-6.2.4
src/redis-server /home/soft/redis/dev/redis.conf
2、安装test节点
把dev节点的"dev"和"6380"改为“test”和"6379"即可。
1.5防火墙开放端口
firewall-cmd --zone=public --add-port=6380/tcp --permanent
firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --reload
四、客户端连接
以连接dev节点为例
cd /home/soft/redis/redis-6.2.4
src/redis-cli -p 6380 -a zsoft
redis> set foo bar
OK
redis> get foo
"bar"
五、安装和使用过程中常见问题
1、cc:命令未找到
yum install gcc yum install gcc-c++
2、致命错误:jemalloc/jemalloc.h:没有那个文件或目录
make MALLOC=libc
3、config set命令可以设置redis运行时的配置,但重启后会丢失配置,建议直接修改redis.conf文件
4、redis.conf配置bind 开放redis服务
bind 指定是Redis所在服务器网卡的ip,不是指定某些IP可以访问本机Redis实例,如果你的bind指定的不是本机网卡IP,那么可能导致你的Redis实例无法启动
可以通过注释bin实现所有局域网服务器访问redis服务。#bind 127.0.0.1 -::1
边栏推荐
- The newcomer deleted data by mistake, and the team leader skillfully used MySQL master-slave replication to delay the recovery of losses
- 大飞机C919都用了哪些新材料?
- redis实现分布式锁的原理
- 获取controller中所有接口路径和名称
- Electron之初出茅庐——搭建环境并运行第一个程序
- 2020年度总结——品曾经,明得失,展未来
- [GO Language Basics] 1. Why do I want to learn Golang and get started with GO language
- The introduction of AI meta-learning into neuroscience, the medical effect is expected to improve accurately
- 2020 ACM | MoFlow: An Invertible Flow Model for Generating Molecular Graphs
- 和AI一起玩儿剧本杀:居然比我还入戏
猜你喜欢

五号黯区靶场 mysql 注入之limit注入记录

DP5340国产替代CM5340立体声音频A/D转换器芯片

From catching up to surpassing, domestic software shows its talents
Get all interface paths and names in the controller
![[GO语言基础] 一.为什么我要学习Golang以及GO语言入门普及](/img/ac/80ab67505f7df52d92a206bc3dd50e.png)
[GO语言基础] 一.为什么我要学习Golang以及GO语言入门普及

redis实现分布式锁的原理

IDEA search plug-in has no results and the solution has been spinning in circles

如何实时计算日累计逐单资金流

ETL为什么经常变成ELT甚至LET?

【MySQL】MySQL中如何实现分页操作
随机推荐
What are the access modifiers, declaration modifiers, and keywords in C#?Literacy articles
Go 使用mencached缓存
WinForm(一):开始一个WinForm程序
sizeof
Equation Derivation Proof of Vector Triple Product
selenium module
go : 使用 grom 删除数据库数据
MySQL off-topic [ORM thought analysis]
ArrayList
export , export default,import完整用法
谷粒商城--环境部署(2022/7/28最新)
go : 使用gorm查询记录
IDEA 中CheckStyle安装及使用
No, the Log4j vulnerability hasn't been fully fixed yet?
MYSQL 主从恢复锁表后, 处理SQL 线程锁解决.
上传文件--文件类型大全,图片类型,文档类型,视频类型,压缩包类型
申请内存,std::transform和AVX256指令集用例和执行速度比较
this and super
Go uses freecache for caching
DNS domain name resolution services