Redis 5.0 安裝

DukeCheng發表於2018-10-21

下載安裝RedisServer

mkdir –p /data/download && cd /data/download

wget http://download.redis.io/releases/redis-5.0.0.tar.gz

tar zxvf redis-5.0.0.tar.gz

cd redis-5.0.0

make install

完成上面步驟之後,Redis相關bin檔案件就已經安裝到/usr/bin/local目錄下了


配置RedisServer

mkdir –p /data/redis

cat > /data/redis/redis.conf << 'EOF'
port 6379
bind 0.0.0.0
#cluster-enabled yes
#cluster-config-file nodes.conf
#cluster-node-timeout 5000
appendonly yes
EOF

啟動RedisServer
cd /data/redis
/usr/local/bin/redis-server ./redis.conf

配置守護服務
cat > /etc/systemd/system/redis-6379.service << ‘EOF’
[Unit]
Description=redis service

[Service]
WorkingDirectory=/data/redis/
ExecStart=/usr/local/bin/redis-server /data/redis/redis.conf
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=redis-service
User=root

[Install]
WantedBy=multi-user.target
EOF

systemctl enable redis-6379.service 
>>: Created symlink /etc/systemd/system/multi-user.target.wants/redis-6379.service → /etc/systemd/system/redis-6379.service.

啟動服務
systemctl start redis-6379.service 
檢查服務狀態
systemctl status redis-6379.service
可以看到
Active: active (running) since Sun 2018-10-21 03:35:09 EDT; 7s ago

再通過netstat –nltp檢視開放的埠,
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      5687/redis-server 0

至此,Redis Server已經安裝配置好,伺服器重啟之後也會自動啟動

附:
Redis叢集教程: https://redis.io/topics/cluster-tutorial
Redis下載連結: https://redis.io/download

相關文章