1.下载redis-6.2.6.tar.gz,解压tar -xf redis-6.2.6.tar.gz
2.cd redis-6.2.6,编译make,安装make install PREFIX=/usr/local/redis
3.cp redis-6.2.6/redis.conf /usr/local/redis/bin/
cp redis-6.2.6/sentinel.conf /usr/local/redis/bin/
主192.168.1.2,从192.168.1.3
4.修改bin/redis.conf: bind 0.0.0.0;daemonize yes;requirepass pwd;masterauth pwd; maxmemory 2gb;maxmemory-policy volatile-lru
从多一个配置:replicaof 192.168.1.2 6379
5.修改bin/sentinel.conf(主从配置一样)
daemonize yes;protected-mode no;sentinel monitor mymaster 192.168.1.2 6379 1;sentinel auth-pass mymaster 123
分别启动:
./redis-server redis.conf
./redis-sentinel sentinel.conf