参考文档
redis.conf配置
创建6个目录,将/etc/redis.conf拷贝至其中
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| port 7000
cluster-enabled yes
cluster-node-timeout 5000
cluster-config-file ~/opt/redis-cluster/7000/nodes.conf
appendonly yes
requirepass 123456
masterauth 123456
|
简易操作步骤
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| nohup redis-server ~/opt/redis-cluster/7000/redis.conf > 7000.log 2>&1 & nohup redis-server ~/opt/redis-cluster/7001/redis.conf > 7001.log 2>&1 & nohup redis-server ~/opt/redis-cluster/7002/redis.conf > 7002.log 2>&1 & nohup redis-server ~/opt/redis-cluster/7003/redis.conf > 7003.log 2>&1 & nohup redis-server ~/opt/redis-cluster/7004/redis.conf > 7004.log 2>&1 & nohup redis-server ~/opt/redis-cluster/7005/redis.conf > 7005.log 2>&1 &
redis-cli -a 123456 -p 7000 > cluster meet 127.0.0.1 7001 > cluster meet 127.0.0.1 7002 > cluster meet 127.0.0.1 7003 > cluster meet 127.0.0.1 7004 > cluster meet 127.0.0.1 7005
redis-cli -a 123456 -p 7000 cluster nodes
redis-cli -a 123456 -p 7003 cluster replicate 21509e5b757d8bae0678efcdb525f59def83674e redis-cli -a 123456 -p 7004 cluster replicate ebb502cda79909b50350be31c3ffe96e9177bafd redis-cli -a 123456 -p 7005 cluster replicate 2aa5a4c37c92f86fdae681dd8c361fee3a99a7af
redis-cli -a 123456 --cluster check 127.0.0.1:7000 redis-cli -a 123456 --cluster fix 127.0.0.1:7000
|
配置文件示例
https://bluexiii-files.oss-cn-beijing.aliyuncs.com/redis.conf