centos7安装redis-cluster
主机ip master
172.16.129.83
172.16.129.86
172.16.129.207
Slave 备份
172.16.129.6
172.16.129.32
172.16.129.14
先安装redis
安装完成之后pkill redis 修改redis配置 开启cluster模式
修改后配置文件如下
daemonize yes pidfile "/var/run/redis.pid" port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 0 loglevel notice logfile "/usr/local/redis/redis.log" databases 16 save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename "dump.rdb" dir "/usr/local/redis" slave-serve-stale-data yes slave-read-only yes repl-diskless-sync no repl-diskless-sync-delay 5 repl-disable-tcp-nodelay no slave-priority 100 requirepass "Hangzhou@123" masterauth "Hangzhou@123" appendonly yes appendfilename "appendonly.aof" appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes lua-time-limit 5000 cluster-enabled yes cluster-config-file nodes-6379.conf slowlog-log-slower-than 10000 slowlog-max-len 128 latency-monitor-threshold 0 notify-keyspace-events "" hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-entries 512 list-max-ziplist-value 64 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 hll-sparse-max-bytes 3000 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit slave 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 aof-rewrite-incremental-fsync yes |
会自动生成nodes-6379.conf
安装ruby
yum install centos-release-scl-rh.noarch
yum -y makecache
yum install rh-ruby25
scl enable rh-ruby25 bash
ruby -v
yum -y install ruby-devel rubygems rpm-build
cd /usr/local/redis/src
./redis-trib.rb create --replicas 1 172.16.129.83:7000 172.16.129.86:7000 172.16.129.207:7000 172.16.129.6:7000 172.16.129.32:7000 172.16.129.14:7000