CentOS/Linux Redis集群安装
在此文章中,只介绍redis集群的安装步骤,若想知道详细过程,请参阅以下几篇文章:
Redis集群_3.redis 主从自动切换Sentinel
系统环境:CentOS 6.5 mini
软件版本:redis-2.8.19IP地址:
节点1:192.168.100.211
节点2:192.168.100.212
节点3:192.168.100.213
Redis安装(三个节点)
1:安装相关依赖包
# yum -y install gcc make
2:安装redis(三个节点)
软件上传到/main目录
# cd /main/
# tar zxvf redis-2.8.19.tar.gz
# mv redis-2.8.19/ redis/
# cd redis/
# make && make install
3:修改配置文件(三个节点)
# mkdir /main/redis/logs
# vi /main/redis/redis.conf
daemonize yes
logfile "/main/redis/logs/redis.log"
4:指定Slave(在Slave节点配置)
# vi /main/redis/redis.conf
slaveof 192.168.100.211 6379
5:启动redis(三个节点)
# /main/redis/src/redis-server /main/redis/redis.conf
6:指定监听Master(三个节点)
# vi /main/redis/sentinel.conf
port 26379
daemonize yes
sentinel monitor mymaster 192.168.100.211 6379 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 900000
logfile "/main/redis/logs/sentinel.log"
7:启动sentinel(三个节点):
# /main/redis/src/redis-sentinel /main/redis/sentinel.conf
8:关闭防火墙(三个节点)
# service iptables stop
# chkconfig iptables off
9:设置开机启动(三个节点)
# echo "/main/redis/src/redis-server /main/redis/redis.conf" >> /etc/rc.local
# echo "/main/redis/src/redis-sentinel /main/redis/sentinel.conf" >> /etc/rc.local
注:首次启动时,必须先启动Master
到此redis安装完毕
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。