出现报错:You need tcl 8.5 or newer in order to run the Redis test
正解:apt-get update 如果已update 请执行下列逻辑
解决方式:安装 tcl
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
cd /usr/local/tcl8.6.1/unix/
sudo ./configure
sudo make
sudo make install
make install
配置
mkdir /etc/redis/
cd /etc/redis
sudo cp /data/redis/redis-2.8.24/redis.conf ./redis.conf
# 192.168.0.9
$ redis-cli -a hostsname -h 192.168.0.9 -p 6379
192.168.0.9:6379> set a 1
OK
192.168.0.9:6379> get a
"1"
192.168.0.9:6379>
# 192.168.0.10
$ redis-cli -a hostsname -h 192.168.0.10 -p 6379
192.168.0.10:6379> keys *
1) "a"
192.168.0.10:6379> get a
"1"
192.168.0.10:6379>
安装编译依赖
下载redis
编译安装
配置
启动(&后台启动)
关闭
哨兵模式
|||||| |10.36.8.3| redis1 | sentinel1 |#主 |内部ip:192.168.0.9 | |10.36.8.4| redis2 | sentinel2 |#从 |内部ip:192.168.0.10 | |10.36.8.7| | sentinel3 |# |内部ip:192.168.0.11|
配置redis.conf
创建配置文件
修改redis.conf(只配置主从两台,主从配置不同)
修改sentinel.conf
创建配置文件:
修改sentinel.conf(三台配置相同)
||||| |sentinel| monitor |mymaster| 192.168.0.9 6379 2 | |sentinel| auth-pass |mymaster| hostsname |
主从启动&测试
启动
测试 (在主节点写入,从节点可看到)
哨兵启动&测试
启动
测试