企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
[TOC] ## 概述 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` 解压 `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 即可。 内容如下: ``` ClusterServerPool {     MasterReadPriority 60     StaticSlaveReadPriority 50     DynamicSlaveReadPriority 50     RefreshInterval 1     ServerTimeout 1     ServerFailureLimit 10     ServerRetryTimeout 1     KeepAlive 120     Servers {         + 192.168.10.10:6379         + 192.168.10.10:7001         + 192.168.10.11:6379         + 192.168.10.11:7001         + 192.168.10.12:6379         + 192.168.10.13:7001     } } ``` 在 Servers 部分配置集群中任意一个节点即可,predixy 会自动发现整个集群的信息,即使配置的节点挂掉后,predixy 代理仍然可正常工作。通过自动发现集群,可以减少 cluster.conf 配置文件的修改及对 predixy 的重启操作。但 predixy 无法删除曾经自动发现的节点,如果某节点下掉,predixy 仍会看到之前的节点,虽然不影响正常使用,日志则会不断报出错误信息。需重启 predixy 解决。 配置 predixy.conf,内容如下: Name Predixy001 Bind 192.168.10.13:6379 Include cluster.conf  注意 Include 部分,只需包括 cluster.conf,其他的则注释掉,否则可能会影响到 predixy的使用。 ## 启动predixy 创建日志目录 ``` mkdir -p /opt/predixy-1.0.5/log ``` 启动 ``` nohup /opt/predixy-1.0.5/bin/predixy /opt/predixy-1.0.5/conf/predixy.conf   > /opt/predixy-1.0.5/log/predixy.log 2>&1 & ``` ## 报错 ### predixy running exception:ConfParser.cpp:177 parse error some scope no end predixy running exception:ConfParser.cpp:177 parse error some scope no end /opt/predixy-1.0.5/conf/cluster.conf:1 原因:cluster.conf文件的类型不正确,正常应该是ACII text ``` [root@VM_120_13_centos ~]# file cluster.conf cluster.conf: UTF-8 Unicode text [root@VM_120_13_centos ~]# [root@VM_120_13_centos ~]# file /opt/predixy-1.0.5/conf/cluster.conf /opt/predixy-1.0.5/conf/cluster.conf: ASCII text ``` 解决办法:对解压后predixy-1.0.5/conf目录下的cluster.conf进行编辑