建德市住房和城乡建设局网站,wordpress图片异步延迟加载js,给大家黄页推广网站,商城网站制作教程文章目录 centos8 redis 6.2.6源码安装主从哨兵下载解压编译安装配置配置systemd服务启停及开机启动登录验证主从同步配置哨兵哨兵注册systemd centos8 redis 6.2.6源码安装主从哨兵
单机安装
下载解压
cd /data
wget http://download.redis.io/releases/redis-6.2.6.tar.gz… 文章目录 centos8 redis 6.2.6源码安装主从哨兵下载解压编译安装配置配置systemd服务启停及开机启动登录验证主从同步配置哨兵哨兵注册systemd centos8 redis 6.2.6源码安装主从哨兵
单机安装
下载解压
cd /data
wget http://download.redis.io/releases/redis-6.2.6.tar.gz
tar xf redis-6.2.6.tar.gz
cd redis-6.2.6/编译安装
make PREFIX/usr/local/redis6 install如果编译提示jemallo文件不存在,清空make缓存重新编译 make distclea make clean
配置
mkdir /usr/local/redis6/confcp redis.conf /usr/local/redis6/conf/mkdir -p /data/redis6/data
mkdir -p /data/redis6/logsvi /usr/local/redis6/conf/redis.conf#配置参数其他默认
bind 0.0.0.0
protected-mode no
port 6379
daemonize yes
logfile /data/redis6/logs/redis.log
dir /data/redis6/data/
maxmemory 2048MB
io-threads 4
requirepass mh112233配置systemd
vi /lib/systemd/system/redis6.service
[Unit]
DescriptionRedis
Afternetwork.target[Service]
Typeforking
PIDFile/var/run/redis_6379.pid
ExecStart/usr/local/redis6/bin/redis-server /usr/local/redis6/conf/redis.conf
ExecReload/bin/kill -s HUP $MAINPID
ExecStop/bin/kill -s QUIT $MAINPID
PrivateTmptrue[Install]
WantedBymulti-user.target服务启停及开机启动
systemctl daemon-reload
systemctl start redis6
systemctl enable redis6登录验证
ln -s /usr/local/redis6/bin/redis-cli /usr/bin/redis-cli
redis-cli -h 127.0.0.1 -p 6379 -a mh112233
set a 11
get a主从同步
#从节点增加配置ip指向主节点
replicaof 192.168.122.230 6379
#配置密码
masterauth mh112233#检查主从同步状态
info replication
配置哨兵
cp sentinel.conf /usr/local/redis6/conf/
mkdir -p /data/redis6/data/sentinelvi /usr/local/redis6/conf/sentinel.conf#配置参数其他默认
bind 0.0.0.0
protected-mode no
port 26379
daemonize yes
logfile /data/redis6/logs/sentinel.log
dir /data/redis6/data/sentinel/#指定Redis主节点主机IP地址和端口ip根据实际情况调整mymaster这个名称随便取下面配置时也需要指定这个名称客户端连接时也会使用
#最后的2是指需要有2个以上sentinel节点认为redis主节点失效才是真的失效一般为sentinel总数/21
sentinel monitor mymaster 192.168.122.230 6379 2#配置连接密码此处的密码需要与 redis.conf里面配置的连接密码一致
sentinel auth-pass mymaster mh112233哨兵注册systemd
vi /lib/systemd/system/sentinel.service
[Unit]
DescriptionRedis-sentinel
Afternetwork.target[Service]
Typeforking
PIDFile/var/run/redis-sentinel.pid
ExecStart/usr/local/redis6/bin/redis-sentinel /usr/local/redis6/conf/sentinel.conf
ExecReload/bin/kill -s HUP $MAINPID
ExecStop/bin/kill -s QUIT $MAINPID
PrivateTmptrue[Install]
WantedBymulti-user.targetsystemctl daemon-reload
systemctl start sentinel
systemctl enable sentinel#连接哨兵服务检查状态
redis-cli -h 127.0.0.1 -p 26379
info sentinel