1、环境

服务器名称 IP地址 备注
predixy-161-130 10.32.161.130 Predixy
redis-161-131 10.32.161.131 redis节点
redis-161-132 10.32.161.132 redis节点
redis-161-133 10.32.161.133 redis节点
redis-161-134 10.32.161.134 redis节点
redis-161-135 10.32.161.135 redis节点
redis-161-136 10.32.161.136 redis节点

2、Redis安装及集群创建

参考:https://www.cnblogs.com/a120608yby/p/17167566.html

3、Predixy安装及配置

# 下载程序包
wget -P /usr/local/src https://github.com/joyieldInc/predixy/releases/download/1.0.5/predixy-1.0.5-bin-amd64-linux.tar.gz

# 安装
# cd /usr/local/src
# tar xf predixy-1.0.5-bin-amd64-linux.tar.gz -C /usr/local/
# cd /usr/local/
# mv predixy-1.0.5/ predixy

# 配置环境变量
# vim /etc/profile.d/predixy.sh 
export PATH=$PATH:/usr/local/predixy/bin
# source /etc/profile.d/predixy.sh

# 修改配置
# vim conf/predixy.conf 
...
Bind 0.0.0.0:7617
Include cluster.conf
# Include try.conf
...

# vim cluster.conf 
ClusterServerPool {
    Password password
    MasterReadPriority 60
    StaticSlaveReadPriority 50
    DynamicSlaveReadPriority 50
    RefreshInterval 1
    ServerTimeout 1
    ServerFailureLimit 10
    ServerRetryTimeout 1
    KeepAlive 120
    Servers {
        + 10.32.161.131:6379
        + 10.32.161.132:6379
        + 10.32.161.133:6379
        + 10.32.161.134:6379
        + 10.32.161.135:6379
        + 10.32.161.136:6379
    }
}

# vim auth.conf 
Authority {
    Auth "password" {
        Mode write 
    }
    Auth "password" {
        Mode admin 
    }
}

# 配置启动服务
# vim /etc/systemd/system/predixy.service
[Unit]
Description=predixy
Documentation=https://github.com/joyieldInc/predixy
Wants=network-online.target
After=network-online.target

[Service]
PrivateTmp=true
User=root
Group=root
ExecStart=/usr/local/predixy/bin/predixy /usr/local/predixy/conf/predixy.conf
StandardOutput=journal
StandardError=inherit

[Install]
WantedBy=multi-user.target

#启动服务
systemctl enable --now predixy

4、验证

# redis-cli -p 7617 -a password
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:7617> set zhangsan 123
OK
127.0.0.1:7617> set lisi 456
OK
127.0.0.1:7617> set test 321
OK
127.0.0.1:7617> get zhangsan
"123"
127.0.0.1:7617> get lisi
"456"
127.0.0.1:7617> get test
"321"
127.0.0.1:7617> 

参考:

https://github.com/joyieldInc/predixy

  

posted on 2023-03-22 12:48  a120608yby  阅读(74)  评论(0编辑  收藏  举报