在Debian上稳定运行Redis可以通过以下步骤实现:
sudo apt update
sudo apt install build-essential tcl
wget https://download.redis.io/releases/redis-7.4.2.tar.gz
tar -zxvf redis-7.4.2.tar.gz
cd redis-7.4.2
make
sudo make install
sudo cp redis.conf /etc/redis/redis.conf
bind 0.0.0.0
允许从任何地方连接。port 6379
。requirepass your_password
。daemonize yes
。redis-server /etc/redis/redis.conf
sudo systemctl enable redis-server
redis-cli ping
如果返回PONG
,则表示Redis服务正在运行。
maxmemory
配置参数。sudo apt install redis-sentinel
编辑/etc/redis/sentinel.conf
文件,设置监控主节点、故障转移参数等。
redis-sentinel /etc/redis/sentinel.conf
使用redis-cli
连接Sentinel,检查其状态和主从复制情况。
通过以上步骤,你可以在Debian上稳定运行Redis,并根据需要进行优化和配置。如果需要高可用性,可以进一步配置Redis Sentinel实现故障转移。