Setup redis-cluster-proxy

Install

grab the latest release

apt install build-essential git

wget https://github.com/RedisLabs/redis-cluster-proxy/archive/refs/tags/1.0-beta2.tar.gz
tar xzf 1.0-beta2.tar.gz
rm -f 1.0-beta2.tar.gz
cd redis-cluster-proxy-1.0-beta2/
echo $MAKEFLAGS
make
make install
which redis-cluster-proxy

Ready to go

prepare the user startup script

useradd -m -s /bin/bash rcproxy

mkdir /var/log/rcproxy/
chown rcproxy. /var/log/rcproxy/

su - rcproxy
vi start-rcproxy

#!/bin/bash

exec redis-cluster-proxy \
    --port 7779 \
    --logfile /var/log/rcproxy/rcproxy.log \
    redis1:6379 \
    redis2:6379 \
    redis3:6379 \
    redis4:6379 \
    redis5:6379 \
    redis6:6379

chmod +x start-rcproxy

in case you enabled AUTH

    --auth-user default \
    --auth PASSWORD-HERE \

possible optimizations

    --threads 50 \
    # --connections-pool-size 50 \

eventually enable cross-slot

    --enable-cross-slot \

now enable at startup and use the 3 seconds trick (will NOT fail more than 5 times within 10 seconds hence will not trigger the systemd default forever-fail)

vi /etc/systemd/system/rcproxy.service

[Unit]
After=network.target
After=redis-server.service

[Service]
Type=simple
Restart=always
RestartSec=3
User=rcproxy
ExecStart=/home/rcproxy/start-rcproxy

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl restart rcproxy
systemctl status rcproxy
systemctl enable rcproxy

Resources

https://github.com/RedisLabs/redis-cluster-proxy

https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6

https://www.shubhamdipt.com/blog/how-to-create-a-systemd-service-in-linux/

https://fedoraproject.org/wiki/How_to_debug_Systemd_problems

https://www.loggly.com/ultimate-guide/linux-logging-with-systemd/

https://www.loggly.com/ultimate-guide/using-systemctl/


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5
Copyright © 2022 Pierre-Philipp Braun