redis集群安装

<!--[if !supportLists]--><!--[endif]-->Redis安装

安装包redis-3.0.7.tar.gz

redis启动命令

#/usr/local/redis/redis-server ./redis.conf &

redis停止命令

#/usr/local/redis/redis-cli shutdown#kill -9 PID

安装步骤

<!--[if !supportLists]-->1. <!--[endif]-->安装gcc

#yum -y install gcc

<!--[if !supportLists]-->2. <!--[endif]-->解压redis-3.0.7.tar.gz后编译

#tar -zxf redis-3.0.7.tar.gz

#cp -r ./redis-3.0.7 /usr/local/redis

# cd /usr/local/redis

#make

<!--[if !supportLists]-->3. <!--[endif]-->开放iptables6379端口

 

蛋疼的在这里,注意:安装集群要再开通一个在上一端口上+10000的端口,这个是redis的集群总线端口,否则redis集群无法互通

重启服务

#service iptables restart

<!--[if !supportLists]-->4. <!--[endif]-->启动redis服务

<!--[if !supportLists]-->5. <!--[endif]-->用客户端测试一下是否启动成功

 

<!--[if !supportLists]-->6. <!--[endif]-->设置开机自启动redis启动项目追加入rc.local保证redis在服务器开机时启动 

#

<!--[if !supportLists]--><!--[endif]-->Redis集群

<!--[if !supportLists]-->1. <!--[endif]-->安装zlib

#tar -xvzf zlib-1.2.8.tar.gz

#cd zlib-1.2.8

#./configure

#make

#sudo make install

<!--[if !supportLists]-->2. <!--[endif]-->安装Ruby

# sudo yum install ruby

这里自动安装的是1.8版本的,要重新安装2.3版本的

# yum install ruby-rdoc

# tar –zxvf ruby-2.3.0.tar.gz

# cd ruby-2.3.0

# su

# ./configure –prefix=/usr/local/ruby-2.3.0

# make (这里等待较长)

# make install

# cp /usr/local/ruby-2.3.0/bin/* /usr/local/bin

应用2.3版本的执行文件,ruby –v可以查看版本

<!--[if !supportLists]-->3. <!--[endif]-->安装rubygems

#tar –zxf rubygems-2.6.1.gz

#cd rubygems-2.6.1

#sudo ruby setup.rb

 

# gem install -l /33e9/tools/redis-3.2.2.gem  

这个要安装,不然会报kernel_require.rb:55:in `require': cannot load such file – redis错误

<!--[if !supportLists]-->4. <!--[endif]-->修改配置文件redis.conf

#vi /usr/local/redis/redis.conf

##修改配置文件中的下面选项

daemonize  yes

port  6379

stop-writes-on-bgsave-error no

appendonly yes

cluster-enabled yes

cluster-config-file nodes-6379.conf

cluster-node-timeout 5000

<!--[if !supportLists]-->5. <!--[endif]-->启动集群

# ./src/redis-trib.rb create --replicas 1 10.0.7.154:7000 10.0.7.154:7001 10.0.7.155:7002  10.0.7.155:7003 10.0.7.156:7004 10.0.7.156:7005

 

 

(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

使用如下命令解决:

config set stop-writes-on-bgsave-error no

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值