ridis 集群配置
./redis-cli -h 192.168.106.128 -p 6379
redis
1、ping
2、set str1 abc
get str1
3、
mkdir ../redis-cluster
cp redis/bin redis-cluster/redis06 -r
rm -f dump.rdb
端口号 port 7001
集群:cluster-enabled yes
批处理启动 radis
vim start-all.sh
context:
cd redis01
./redis-server redis.conf
cd ..
cd redis02
./redis-server redis.conf
cd ..
cd redis03
./redis-server redis.conf
cd ..
cd redis04
./redis-server redis.conf
cd ..
cd redis05
./redis-server redis.conf
cd ..
cd redis06
./redis-server redis.conf
cd ..
为批处理授与权限
chmod u+x start-all.sh
linux 查看redis运行进程:
ps aux|grep redis
做服务集群连接6个节点:
找到路径
cd redis-3.0.0
cd src
ll *.rb
显示 redis-trib.rb脚本文件
复制这个文件到/usr/local/redis-cluster/
1、使用ruby脚本搭建集群。需要ruby的运行环境。
安装ruby
yum install ruby
yum install rubygems
2、安装ruby脚本运行使用的包。
[root@localhost ~]# gem install redis-3.0.0.gem
Successfully installed redis-3.0.0
1 gem installed
Installing ri documentation for redis-3.0.0...
Installing RDoc documentation for redis-3.0.0...
[root@localhost ~]#
[root@localhost ~]# cd redis-3.0.0/src
[root@localhost src]# ll *.rb
-rwxrwxr-x. 1 root root 48141 Apr 1 2015 redis-trib.rb
cp redis-trib.rb /usr/local/redis-cluster/
备份机
./redis-trib.rb create --replicas 1 192.168.106.128:7001 192.168.106.128:7002 192.168.106.128:7003 192.168.106.128:7004 192.168.106.128:7005 192.168.106.128:7006
客户端连接:
redis01/redis-cli -p 7002 -c