在CentOS 6 运行 redis-sentinel 程序
云友“ptao”提出 在ECS里无法成功运行 redis-sentinel 程序,提示端口无法绑定使用。
环境:CentOS 6 64位,redis-3.2.3
1.执行更新 
yum update
2.下载redis安装文件 
wget http://download.redis.io/releases/redis-3.2.3.tar.gz
3.解压缩安装包 
tar -xzvf redis-3.2.3.tar.gz
4.移动文件 
mv redis-3.2.3 /usr/local/redis
5.转到工作目录 
cd /usr/local/redis
6.编译 
make
7.安装 
make install
8.创建新的配置文件, 
mkdir -p /etc/redis
cp redis.conf /etc/redis
9.修改配置文件 /etc/redis/redis.conf,将 daemonize 值从 no 更改为 yes, 使之后台运行: 
daemonize yes
10.运行,测试可正常运行 
/usr/local/bin/redis-server /etc/redis/redis.conf
11.但运行出错,提示无法绑定使用相应的端口: 
redis-sentinel /usr/local/redis/sentinel.conf
Creating Server TCP listening socket *:26379: unable to bind socket
12.修改配置文件 sentinel.conf 在 定义监听端口一行前添加监听IP参数,如 bind 0.0.0.0 ,表示仅监听IPv4。因为阿里云的ECS Linux系统暂时没有启用IPv6,所以 redis-sentinel 尝试在所有的(IPv4 + IPv6)的网络接口启动时,会报错
# port <sentinel-port>
# The port that this sentinel instance will run on
bind 0.0.0.0
port 26379
13.再次尝试启动 redis-sentinel ,正常 
 
参考: