1. 程式人生 > >離線安裝redis-cluster

離線安裝redis-cluster

#離線安裝redis-cluster

https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.5.tar.gz
#安裝ruby
tar xf ruby-2.4.5.tar.gz
cd ruby-2.4.5/
./configure  --prefix=/usr/local/ruby
make && make insta
echo "PATH=$PATH:/usr/local/ruby/bin/" >>/etc/profile
source /etc/profile
ruby -v



https://rubygems.org/downloads/redis-4.0.3.gem
#安裝配置rubygems的redisapi cd /usr/local/src/ gem install -l redis-4.0.3.gem gem list redis https://sourceforge.net/projects/tcl/files/Tcl/8.6.0/ #安裝tcl unzip tcl868-src.zip cd tcl8.6.8/unix/ ./configure --prefix=/usr/local/tcl make && make install make install-private-headers echo "PATH=$PATH/usr/local/tcl/bin/" >>/etc/profile .
/etc/profile http://download.redis.io/releases/redis-4.0.11.tar.gz #安裝redis tar xf redis-4.0.11.tar.gz cd redis-4.0.11/ make PREFIX=/usr/local/redis install cp /usr/local/src/redis-4.0.11/src/redis-trib.rb /usr/local/redis/bin/

 

#redis配置

bind 0.0.0.0
port 7000
tcp-backlog 511
timeout 300
tcp-keepalive 300
daemonize yes
supervised no
pidfile 
"/var/run/redis_7000.pid" loglevel notice logfile "/var/log/redis_7000.log" databases 16 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir /tmp/ 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 appendonly no 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-7000.conf cluster-node-timeout 15000 slowlog-log-slower-than 10000 slowlog-max-len 512 latency-monitor-threshold 0 notify-keyspace-events "" hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-size -2 list-compress-depth 0 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

 

for i in 700{1..5};do cp  redis_7000.conf redis_${i}.conf;sed -i "s#7000#${i}#g" redis_${i}.conf;done
[[email protected]]#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