基础配置
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
sed - i 's/SELINUX=enforcing/SELINUX=disabled/' / etc/selinux/configvi / etc/hosts
ip1 node1
ip2 node2
ip3 node3
redis
配置一主两从
yum - y install autoconf automake bison byacc cscope ctags diffstat doxygen elfutils flex gcc-gfortran git indent intltool libtool patch patchutils rcs redhat-rpm-config rpm-build rpm-sign subversion swig systemtaptar - xf redis-5. 0. 8. tar. gz
cd redis-5. 0. 8
make MALLOC=libc && make install
vi redis. conf
bind ip1
daemonize yes
masterauth 1qaz2!QAZ@
requirepass 1qaz2!QAZ@
vi redis. conf
bind ip2
daemonize yes
replicaof ip1 6379
masterauth 1qaz2!QAZ@
vi redis. conf
bind ip3
daemonize yes
replicaof ip1 6379
masterauth 1qaz2!QAZ@
redis-server redis. conf
开启哨兵模式
protected-mode no
daemonize yes
sentinel myid 6b190ab6b2b8198c53a0ae9026143f46cdaac2a8
sentinel monitor mymaster ip1 6379 2
sentinel auth-pass mymaster 1qaz2!QAZ@
protected-mode yes
daemonize yes
sentinel myid 42ef52d7a37bd4827ccf24a85be29514cb40bfca
sentinel monitor mymaster ip1 6379 2
sentinel auth-pass mymaster 1qaz2!QAZ@
protected-mode yes
daemonize yes
sentinel myid 4a4df01ffaa7b08950220d372d5785645d5239549
sentinel monitor mymaster ip1 6379 2
sentinel auth-pass mymaster 1qaz2!QAZ@redis-sentinel sentinel. confps - ef | grep redis
控制台
redis-cli - h host - p port
info
slaveof host post
get key
set key value
del key