centos7安装redis3.2.5集群

安装参照     https://blog.csdn.net/mingliangniwo/article/details/54600640  https://blog.csdn.net/u013820054/article/details/51354189

 

redis3.25集群配置文件-

 

daemonize yes
pidfile /var/run/redis_7000.pid
port 7000
cluster-enabled yes
cluster-config-file nodes_7000.conf
cluster-node-timeout 5000
appendonly yes

 

  

 

字段说明:
daemonize yes //redis后台运行
pidfile /var/run/redis_7000.pid //pidfile文件对应
port 7000 //端口
cluster-enabled yes //开启集群 把注释#去掉
cluster-config-file nodes_7000.conf //集群的配置 配置文件首次启动自动生成
cluster-node-timeout 5000 //请求超时 设置5秒够了
appendonly yes //aof日志开启 有需要就开启,它会每次写操作都记录一条日志

 

redis集群启动、停止

开始启动:
方式一、
[root@bogon conf]# redis-cli -c -p 7000
127.0.0.1:7000> set name "hello"
(error) NOAUTH Authentication required.
127.0.0.1:7000> auth joinu_1233
OK

方法二、
[root@bogon conf]# redis-cli -c -p 7000 -a joinu_1233
127.0.0.1:7000> set name fish
-> Redirected to slot [5798] located at 127.0.0.1:7002
OK
127.0.0.1:7002>

Redis集群停止:

方法一:

[root@bogon conf]# redis-cli -c -p 7000 -a joinu_1233 shutdown
[root@bogon conf]# redis-cli -c -p 7000 -a joinu_1233
Could not connect to Redis at 127.0.0.1:7000: Connection refused
Could not connect to Redis at 127.0.0.1:7000: Connection refused
not connected>

方法二:kill -9 +redis进程

 

redis集群迁移数据库

https://www.2cto.com/database/201610/560101.html

 

posted @ 2018-11-24 20:05  effortsing  阅读(335)  评论(0编辑  收藏  举报