centos7.4——安裝redis
#下載編譯安裝
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
tar -xzf redis-4.0.9.tar.gz -C /usr/local/
rm -rf redis-4.0.9.tar.gz
ln -s /usr/local/redis-4.0.9 /usr/local/redis
cd /usr/local/redis
make && make install
cd -
useradd -s /sbin/nologin -M redis
chown -R redis.redis /usr/local/redis
chown -R redis.redis /usr/local/redis-4.0.9
#配置服務(wù)文件
echo '
[Unit]
Description=The redis-server Process Manager
After=syslog.target network.target
[Service]
User=redis
Group=redis
Type=simple
PIDFile=/var/run/redis_server.pid
ExecStart=/usr/local/redis/src/redis-server --port 5555 --protected-mode no --requirepass "123456" --notify-keyspace-events "Egx"
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID
[Install]
WantedBy=multi-user.target
' > /lib/systemd/system/redis-server.service
#--port 設(shè)置端口
#--protected-mode 非保護(hù)模式才能遠(yuǎn)程連接
#--requirepass 需要密碼
#--notify-keyspace-events 設(shè)置Egx,spring session需要
#啟動(dòng)服務(wù)
systemctl daemon-reload
systemctl start redis-server
systemctl enable redis-server
systemctl status redis-server
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者