标签:redis 3.0.5 集群 redis cluster
1、安装(略)
可以参考我之前博客:http://mydbs.blog.51cto.com/513727/1745300
IP 192.168.1.231
系统 CentOS 6.5 64bit
内存 1G
硬盘 20G
redis 3.0.5
redis监听 7000-7006
3 集群配置
cd /etc/redis/ mkdir 7000 mkdir 7001 mkdir 7002 mkdir 7003 mkdir 7004 mkdir 7005 mkdir 7006
root@redis01 redis]# cat redis_node.conf #redis node config port 7000 logfile /opt/redis/log/redis_7000.log dbfilename dump_7000.rdb appendfilename appendonly7000.aof syslog-ident redis7000 Cluster-config-file /etc/redis/7000/nodes_7000.conf include /etc/redis/redis_cluster.conf
cat /etc/redis/redis_cluster.conf #redis conf file daemonize yes timeout 300 save 900 1 save 300 10 save 60 10000 rdbcompression yes dir /opt/redis/data maxclients 1280 appendonly yes appendfsync everysec #集群选项 Cluster-enabled yes Cluster-config-file /etc/redis/nodes_7000.conf Cluster-node-timeout 5000 Cluster-slave-validity-factor 10
cat redis_node.conf |sed -e ‘s/7000/7000/‘>/etc/redis/7000/redis_node.conf cat redis_node.conf |sed -e ‘s/7000/7001/‘>/etc/redis/7001/redis_node.conf cat redis_node.conf |sed -e ‘s/7000/7002/‘>/etc/redis/7002/redis_node.conf cat redis_node.conf |sed -e ‘s/7000/7003/‘>/etc/redis/7003/redis_node.conf cat redis_node.conf |sed -e ‘s/7000/7004/‘>/etc/redis/7004/redis_node.conf cat redis_node.conf |sed -e ‘s/7000/7005/‘>/etc/redis/7005/redis_node.conf cat redis_node.conf |sed -e ‘s/7000/7006/‘>/etc/redis/7006/redis_node.conf
redis-server /etc/redis/7000/redis_node.conf redis-server /etc/redis/7001/redis_node.conf redis-server /etc/redis/7002/redis_node.conf redis-server /etc/redis/7003/redis_node.conf redis-server /etc/redis/7004/redis_node.conf redis-server /etc/redis/7005/redis_node.conf redis-server /etc/redis/7006/redis_node.conf
redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006
[root@redis01 redis]# redis-cli -c -p 7000 127.0.0.1:7000> get ooo1o -> Redirected to slot [11694] located at 127.0.0.1:7002 "sldkfekrwe" 127.0.0.1:7000> get ooo1o -> Redirected to slot [11694] located at 127.0.0.1:7005 "sldkfekrwe"
本文出自 “枯叶” 博客,请务必保留此出处http://mydbs.blog.51cto.com/513727/1745308
标签:redis 3.0.5 集群 redis cluster
原文地址:http://mydbs.blog.51cto.com/513727/1745308