predixy代理redis集群

概述

predixy 是高性能的适用于 redis 集群和哨兵的代理。
predixy github 地址:https://github.com/joyieldInc/predixy
predixy 编译安装需要 C++11 版本的编译器,至少需要 CentOS 7及以上版本才能编译安装。对于 CentOS 6或更低版本,可以直接使用在 github release 中的二进制版本。
安装

下载
https://github.com/joyieldInc/predixy/releases/download/1.0.5/predixy-1.0.5-bin-amd64-linux.tar.gz

链接:https://pan.baidu.com/s/1W-NHc5IO-2SsTDDPbIM05w
提取码:msiw


解压
tar -xzf predixy-1.0.5-bin-amd64-linux.tar.gz
部署到工作目录
mv predixy-1.0.5 /opt/
修改配置文件
cd /opt/predixy-1.0.5/conf/
目录下有两个配置文件:predixy.conf   cluster.conf
predixy 支持多种架构,如果使用的是 redis cluster,只需配置 redis cluster 对应的配置文件cluster.conf 即可。
内容如下:
[root@test01 conf_product_master]# ll
total 44
-rw-r----- 1 root root 2394 Nov 23 16:23 auth.conf
-rw-r----- 1 root root 1655 Nov 23 16:17 cluster.conf
-rw-r----- 1 root root 1041 Nov 23 11:55 cluster.conf_bak
-rw-r----- 1 root root 3426 Nov 23 11:55 command.conf
-rw-r----- 1 root root  781 Nov 23 11:55 dc.conf
-rw-r----- 1 root root 2121 Nov 23 11:55 latency.conf
-rw-r----- 1 root root  166 Nov 23 16:28 predixy.conf
-rw-r----- 1 root root 2547 Nov 23 11:55 predixy.conf_bak
-rw-r----- 1 root root 1421 Nov 23 11:55 sentinel.conf
-rw-r----- 1 root root 2016 Nov 23 11:55 standalone.conf
-rw-r----- 1 root root   98 Nov 23 11:55 try.conf
[root@test01 conf_product_master]# cat cluster.conf
## redis cluster server pool define

##ClusterServerPool {
##    [Password xxx]                        #default no
##    [MasterReadPriority [0-100]]          #default 50
##    [StaticSlaveReadPriority [0-100]]     #default 0
##    [DynamicSlaveReadPriority [0-100]]    #default 0
##    [RefreshInterval number[s|ms|us]]     #default 1, means 1 second
##    [ServerTimeout number[s|ms|us]]       #default 0, server connection socket read/write timeout
##    [ServerFailureLimit number]           #default 10
##    [ServerRetryTimeout number[s|ms|us]]  #default 1
##    [KeepAlive seconds]                   #default 0, server connection tcp keepalive

##    Servers {
##        + addr
##        ...
##    }
##}


## Examples:
#ClusterServerPool {
#    MasterReadPriority 60
#    StaticSlaveReadPriority 50
#    DynamicSlaveReadPriority 50
#    RefreshInterval 1
#    ServerTimeout 1
#    ServerFailureLimit 10
#    ServerRetryTimeout 1
#    KeepAlive 120
#    Servers {
#        + 192.168.2.107:2211
#        + 192.168.2.107:2212
#    }
#}

ClusterServerPool {
    Password "amw_351#"
    MasterReadPriority 60
    StaticSlaveReadPriority 50
    DynamicSlaveReadPriority 50
    RefreshInterval 1
    ServerTimeout 1
    ServerFailureLimit 10
    ServerRetryTimeout 1
    KeepAlive 120
    Servers {
        + 192.168.23.169:7200
        + 192.168.23.167:7200
        + 192.168.23.156:7200
        + 192.168.23.154:7200
        + 192.168.23.168:7200
        + 192.168.23.158:7200
        + 192.168.23.166:7200
        + 192.168.23.170:7200
        + 192.168.23.153:7200
        + 192.168.23.157:7200
        + 192.168.23.165:7200
        + 192.168.23.155:7200
    }
}
[root@test01 conf_product_master]# cat predixy.conf
Name Predixyproductmaster
Bind 10.196.25.31:7299
Include /opt/predixy-1.0.5/conf_product_master/cluster.conf
Include /opt/predixy-1.0.5/conf_product_master/auth.conf
[root@test01 conf_product_master]# cat auth.conf
Authority {
    Auth "amw_351#" {
        Mode write
    }
    Auth "amw_351#" {
        Mode admin
    }
}

在 Servers 部分配置集群中任意一个节点即可,predixy 会自动发现整个集群的信息,即使配置的节点挂掉后,predixy 代理仍然可正常工作。通过自动发现集群,可以减少 cluster.conf 配置文件的修改及对 predixy 的重启操作。但 predixy 无法删除曾经自动发现的节点,如果某节点下掉,predixy 仍会看到之前的节点,虽然不影响正常使用,日志则会不断报出错误信息。需重启 predixy 解决。


创建日志目录

mkdir -p /opt/predixy-1.0.5/log

启动
[root@test01 predixy-1.0.5]# cat start_product_master.sh
nohup /opt/predixy-1.0.5/bin/predixy /opt/predixy-1.0.5/conf_product_master/predixy.conf   > /opt/predixy-1.0.5/log/conf_product_master_predixy.log 2>&1 &

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值