关机慢:
shutdown -h now
搭建redis
1: yum install gcc-c++
2:tar -zxvf redis-3.0.0.tar.gz
3:Make
4:cd /usr/local rm -rf redis
5:Make install
5:make install PREFIX=/usr/local/redis
6:前端启动:
/usr/local/redis/bin/redis-server
后台启动:
1:复制文件:cp redis.conf /usr/local/redis/bin
2 : daemonize yes
3 : ./redis-server redis.conf
4 : ps aux|grep redis
5:连接redis: ./redis-cli
安装ruby
yum install ruby
yum install rubygems
redis集群管理工具redis-trib.rd
1:cd redis-3.0.0/src
2:ll .*rb
redis-3.0.0.gem上传
gem install redis-3.0.0.gem
集群创建
cd /usr/local
mkdir redis-cluster
cd redis
cp -r bin ../redis-cluster/
cd ../redis-cluster/
rm -f dump.rdb
修改端口号
2、打开cluster-enable前面的注释。
cd ../
cp -r redis01/ redis02
cp -r redis01/ redis03
cp -r redis01/ redis04
cp -r redis01/ redis05
修改每一个端口
之前的reidis下src中:
cp *.rb /usr/local/redis-cluster
启动redis:
vim startall.sh
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 ..
查看进程
ps aux|grep redis
创建集群:
./redis-trib.rb create --replicas 1 192.168.1.116:7001 192.168.1.116:7002 192.168.1.116:7003 192.168.1.116:7004 192.168.1.116:7005 192.168.1.116:7006
启动命令
redis01/redis-cli -h 192.168.1.229 -p 7002 -c