1、解压redis.tgz到usr/local/redis下
2、在redis/下执行 make
3、在redis/src/下执行 make install PREFIX=/usr/local/redis (redis/下就有了bin目录)
4、在redis/下 mkdir config
5、复制:
在redis下 cp redis.conf ./config 修改为:redis-63879.conf, , cp sentinel.conf ./config 修改为:sentinel-263879.conf,
6、修改redis-63879.conf,添加
daemonize yes
bind 127.0.0.1 本机ip
logfile ""
7、复制redis-63879.conf两份,分别为redis-63880.conf、redis-6381.conf
修改端口port分别为:6380、6381
在port下面添加:slaveof 127.0.0.1 6379
8、修改sentinel-26379.conf 新增或修改
daemonize yes
9、sentinel-26379.conf复制两份、分别为sentinel-26380.conf、sentinel-26381.conf
修改端口port分别为:26380、26381
10、启动服务:
在redis/bin目录下执行:
./redis-server ../config/redis-6379.conf
./redis-server ../config/redis-6380.conf
./redis-server ../config/redis-6381.conf
./redis-sentinel ../config/sentinel-26379.conf
./redis-sentinel ../config/sentinel-26380.config
./redis-sentinel ../config/sentinel-26381.conf
11、测试:
在redis/bin目录下执行:
./redis-cli -p 6379
set name 123
./redis-cli -p 6380
get name ==>123
./redis-cli -p 6381
get name ==>123
原文:https://www.cnblogs.com/alanpo1120/p/12371889.html