《Window下Redis集群搭建配置》要点:
本文介绍了Window下Redis集群搭建配置,希望对您有用。如果有疑问,可以联系我们。
1. 下载redis压缩包
https://github.com/MSOpenTech/redis/releases
2. 解压压缩包到D:\dev-software\redis
这里假设解压到D:\dev-software\reids
3. 配置redis.conf, 创建三份,分别命名为redis6379.conf、redis6380.conf、redis6381.conf
port 6379
bind 127.0.0.1
#requirepass 123456
#masterauth 123456
port 6380
bind 127.0.0.1
slaveof 127.0.0.1 6379
#requirepass 123456
#masterauth 123456
port 6381
bind 127.0.0.1
slaveof 127.0.0.1 6379
#requirepass 123456
#masterauth 123456
4. 配置sentinel.conf,创建三份,分别命名为sentinel26379.conf、sentinel26479.conf、sentinel26579.conf
port 26379
bind 127.0.0.1
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 15000
port 26479
bind 127.0.0.1
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 15000
port 26579
bind 127.0.0.1
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 15000
5. 通过 cmd来启动redis
d:
cd dev-software\redis
redis-server.exe redis6379.conf
redis-server.exe redis6380.conf
redis-server.exe redis6381.conf
redis-server.exe sentinel26379.conf --sentinel
redis-server.exe sentinel26479.conf --sentinel
redis-server.exe sentinel26579.conf --sentinel
6. 通过cmd查看redis服务器状态
d:
cd dev-software\redis
redis-cli.exe -h 127.0.0.1 -p 6379
info replication
set myname chensheng
get myname
7. 通过cmd查看sentinel状态
d:
cd dev-software\redis
redis-cli.exe -h 127.0.0.1 -p 26379
info sentinel
欢迎参与《Window下Redis集群搭建配置》讨论,分享您的想法,维易PHP学院为您提供专业教程。
转载请注明本页网址:
http://www.vephp.com/jiaocheng/9259.html