本文将基于centos7搭建 predixy 的redis集群。流程如下:
1、下载编译好的predixy
wget https://github.com/joyieldInc/predixy/releases/download/1.0.5/predixy-1.0.5-bin-amd64-linux.tar.gz
2、修改配置
/opt/predixy-1.0.5/conf/predixy.conf
Name PredixyExample
WorkerThreads 1
ClientTimeout 300
LogVerbSample 0
LogDebugSample 0
LogInfoSample 10000
LogNoticeSample 1
LogWarnSample 1
LogErrorSample 1
Include auth.conf
Include sentinel.conf
Include latency.conf
/opt/predixy-1.0.5/conf/sentinel.conf
SentinelServerPool { Databases 16 Hash crc16 HashTag "{}" Distribution modula MasterReadPriority 60 StaticSlaveReadPriority 50 DynamicSlaveReadPriority 50 RefreshInterval 1 ServerTimeout 1 ServerFailureLimit 10 ServerRetryTimeout 1 KeepAlive 120 Sentinels { + 192.168.1.21:26379 + 192.168.1.23:26379 + 192.168.1.24:26379 } Group mymaster { } }
3、启动redis
#node1
redis-server /opt/redis-6.2.5/redis.conf
#node3、node4
redis-server /opt/redis-6.2.5/redis.conf --replicaof 192.168.1.21 6379
4、启动predixy
/opt/predixy-1.0.5/bin/predixy /opt/predixy-1.0.5/conf/predixy.conf
5、测试
redis-cli -h 192.168.1.22 -p 7617
进入客户端后,set k1 v1进行测试,成功后,可到node1、node3、node4中查看