yum install gccmkdir /opt/package/cd /opt/package/wget http://download.redis.io/releases/redis-3.2.4.tar.gztar zxvf redis-3.2.4.tar.gzmv redis-3.2.4 /usr/local/redisdir='/usr/local/redis'cd $dirmake&&make installcd srccp redis-trib.rb /usr/local/bin/cd $dirmkdir redis-clustercd redis-clustermkdir 9000 9001 9002cd $dircp redis.conf redis-cluster/9000cp redis.conf redis-cluster/9001cp redis.conf redis-cluster/9002cd $dircd redis-cluster/9000sed -i '/^port/ s/6379/9000/' redis.confsed -i '/^bind/ s/127.0.0.1/172.18.3.184/' redis.confsed -i '/^daemonize/ s/no/yes/' redis.confsed -i '/^pidfile/ s/var//run//redis_6379.conf/var//run//redis_9000.conf/' redis.confsed -i 's/# cluster-enabled yes/cluster-enabled yes/' redis.confsed -i 's/# cluster-config-file nodes-6379.conf/cluster-config-file nodes-9000.conf/' redis.confsed -i 's/# cluster-node-timeout 15000/cluster-node-timeout 15000/' redis.confsed -i 's/appendonly no/appendonly yes/' redis.conf cd $dircd redis-cluster/9001sed -i '/^port/ s/6379/9001/' redis.confsed -i '/^bind/ s/127.0.0.1/172.18.3.184/' redis.confsed -i '/^daemonize/ s/no/yes/' redis.confsed -i '/^pidfile/ s/var//run//redis_6379.conf/var//run//redis_9001.conf/' redis.confsed -i 's/# cluster-enabled yes/cluster-enabled yes/' redis.confsed -i 's/# cluster-config-file nodes-6379.conf/cluster-config-file nodes-9001.conf/' redis.confsed -i 's/# cluster-node-timeout 15000/cluster-node-timeout 15000/' redis.confsed -i 's/appendonly no/appendonly yes/' redis.conf cd $dircd redis-cluster/9002sed -i '/^port/ s/6379/9002/' redis.confsed -i '/^bind/ s/127.0.0.1/172.18.3.184/' redis.confsed -i '/^daemonize/ s/no/yes/' redis.confsed -i '/^pidfile/ s/var//run//redis_6379.conf/var//run//redis_9002.conf/' redis.confsed -i 's/# cluster-enabled yes/cluster-enabled yes/' redis.confsed -i 's/# cluster-config-file nodes-6379.conf/cluster-config-file nodes-9002.conf/' redis.confsed -i 's/# cluster-node-timeout 15000/cluster-node-timeout 15000/' redis.confsed -i 's/appendonly no/appendonly yes/' redis.confredis-server /usr/local/redis/redis-cluster/9000/redis.conf redis-server /usr/local/redis/redis-cluster/9001/redis.confredis-server /usr/local/redis/redis-cluster/9002/redis.conf ps -ef|grep redis####################一般安装部署两台服务器,每台三个节点,执行以上脚本在两台操作相同,只需要修改ip和端口即可###################redis集群 安装部署后使用./redis-trib.rb 前需要执行以下安装ruby yum install ruby rubygems -ywget https://rubygems.global.ssl.fastly.net/gems/redis-3.2.1.gemgem install -l ./redis-3.2.1.gem ./redis-trib.rb create --replicas 1 172.18.3.184:9000 172.18.3.184:9001 172.18.3.184:9002 172.18.3.185:9003 172.18.3.185:9004 172.18.3.185:9005########测试集群./redis-trib.rb check 172.18.3.184:9000./redis-cli -c -h 172.18.3.184 -p 7000
新闻热点
疑难解答