#离线安装redis-clusterhttps://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.5.tar.gz#安装rubytar xf ruby-2.4.5.tar.gzcd ruby-2.4.5/./configure --prefix=/usr/local/rubymake && make instaecho "PATH=$PATH:/usr/local/ruby/bin/" >>/etc/profilesource /etc/profileruby -vhttps://rubygems.org/downloads/redis-4.0.3.gem#安装配置rubygems的redisapicd /usr/local/src/gem install -l redis-4.0.3.gem gem list redishttps://sourceforge.net/projects/tcl/files/Tcl/8.6.0/#安装tclunzip tcl868-src.zipcd tcl8.6.8/unix/./configure --prefix=/usr/local/tclmake && make installmake install-private-headersecho "PATH=$PATH/usr/local/tcl/bin/" >>/etc/profile. /etc/profilehttp://download.redis.io/releases/redis-4.0.11.tar.gz#安装redistar xf redis-4.0.11.tar.gz cd redis-4.0.11/make PREFIX=/usr/local/redis installcp /usr/local/src/redis-4.0.11/src/redis-trib.rb /usr/local/redis/bin/
#redis配置
bind 0.0.0.0port 7000tcp-backlog 511timeout 300tcp-keepalive 300daemonize yessupervised nopidfile "/var/run/redis_7000.pid"loglevel noticelogfile "/var/log/redis_7000.log"databases 16stop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum yesdbfilename dump.rdbdir /tmp/slave-serve-stale-data yesslave-read-only yesrepl-diskless-sync norepl-diskless-sync-delay 5repl-disable-tcp-nodelay noslave-priority 100appendonly noappendfilename "appendonly.aof"appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbaof-load-truncated yeslua-time-limit 5000cluster-enabled yescluster-config-file nodes-7000.confcluster-node-timeout 15000slowlog-log-slower-than 10000slowlog-max-len 512latency-monitor-threshold 0notify-keyspace-events ""hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-size -2list-compress-depth 0set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10aof-rewrite-incremental-fsync yes
for i in 700{ 1..5};do cp redis_7000.conf redis_${i}.conf;sed -i "s#7000#${i}#g" redis_${i}.conf;done[root@serverscripts]#ll /usr/local/redis/conf/total 24-rw-r--r-- 1 root root 1271 Nov 6 13:34 redis_7000.conf-rw-r--r-- 1 root root 1271 Nov 6 13:35 redis_7001.conf-rw-r--r-- 1 root root 1271 Nov 6 13:35 redis_7002.conf-rw-r--r-- 1 root root 1271 Nov 6 13:35 redis_7003.conf-rw-r--r-- 1 root root 1271 Nov 6 13:35 redis_7004.conf-rw-r--r-- 1 root root 1271 Nov 6 13:35 redis_7005.conf#启动for i in `ls ./`;do /usr/local/redis/bin/redis-server ./$i;done#创建集群/usr/local/redis/bin/redis-trib.rb create --replicas 1 10.0.0.100:7000 10.0.0.100:7001 10.0.0.100:7002 c 10.0.0.100:7003 10.0.0.100:7004 10.0.0.100:7005