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相關(guān)bin文件件就已經(jīng)安裝到/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
啟動(dòng)RedisServer
cd /data/redis
/usr/local/bin/redis-server ./redis.conf
配置守護(hù)服務(wù)
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.
啟動(dòng)服務(wù)
systemctl start redis-6379.service
檢查服務(wù)狀態(tài) systemctl status redis-6379.service
可以看到
Active: active (running) since Sun 2018-10-21 03:35:09 EDT; 7s ago
再通過(guò)netstat –nltp查看開(kāi)放的端口,
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 5687/redis-server 0
至此,Redis Server已經(jīng)安裝配置好,服務(wù)器重啟之后也會(huì)自動(dòng)啟動(dòng)
附:
Redis集群教程: https://redis.io/topics/cluster-tutorial
Redis下載鏈接: https://redis.io/download
浙公網(wǎng)安備 33010602011771號(hào)