安装配置predixy代理redis-cluster集群

一 实验环境

二 实验步骤

2.1 Redis Cluster集群搭建

2.2 在Predixy服务器上安装Redis单实例

可点击这里下载shell安装脚本

2.3 安装Predixy

点击这里下载predixy安装包

2.3.1 安装依赖包

yum install libstdc++-static  gcc-c++ automake autoconf -y

2.3.2 编译

cd /usr/local/src && tar -zxvf predixy-1.0.5.tar.gz

cd predixy-1.0.5

make -j4

cd src && cp predixy /usr/local/bin/

2.3.3 修改配置文件

cd /usr/local/src/predixy-1.0.5/conf

2.3.3.1 cluster.conf

添加:

ClusterServerPool {      

    Password 要连接的redis集群的密码

    MasterReadPriority 60

    StaticSlaveReadPriority 50

    DynamicSlaveReadPriority 50

    RefreshInterval 1

    ServerTimeout 1

    ServerFailureLimit 10

    ServerRetryTimeout 1

    KeepAlive 120

    Servers {

        + 192.168.144.201:6379

        + 192.168.144.201:6380

        + 192.168.144.202:6379

        + 192.168.144.202:6380

        + 192.168.144.203:6379

        + 192.168.144.203:6380

    }

}

2.3.3.2 predixy.conf

① 将LogNoticeSample改为0,否则日志文件会很大(会记录每个连接创建,连接退出等信息)

② 在最后添加:

Include /usr/local/src/predixy-1.0.5/conf/cluster.conf

Log  /usr/local/src/predixy-1.0.5/predixy.log

2.3.3.3 auth.conf

mv auth.conf auth.conf_bak

vi auth.conf

添加:

Authority {

      Auth 密码 {

        Mode write

    }

}

Authority {

      Auth 密码 {

        Mode admin

    }

}

2.3.4 启动Predixy

#设置成以systemctl方式启动predixy

vi /usr/lib/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/bin/predixy /usr/local/src/predixy-1.0.5/conf/predixy.conf

StandardOutput=journal

StandardError=inherit



[Install]

WantedBy=multi-user.target

#启动

chmod +x /usr/local/src/predixy-1.0.5/conf/predixy.conf

systemctl start predixy

#设置开机自启

systemctl enable predixy

#查看predixy状态

systemctl status predixy

#测试插入数据

/usr/local/redis/src/redis-cli -p 7617 -a 密码 set str 'hello,world'

--本篇文章主要参考自:

使用predixy 连接 redis-cluster 集群_爱我及书的博客-CSDN博客_predixy 设置密码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值