Redis 5.0 安裝


下載安裝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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM