下载安装:
yum -y install gcc gcc-c++
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -xf redis-5.0.3.tar.gz
cd redis-5.0.3
make
make install PREFIX=/usr/local/redis
修改配置:
cp /root/redis-5.0.3/redis.conf /usr/local/redis/
cd /usr/local/redis/
vim redis.conf
daemonize no
改为
daemonize yes
配置systemctl管理:
vim /lib/systemd/system/redis.service
[Unit]
Description=Redis
After=network.target
[Service]
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf --daemonize no
ExecStop=/usr/local/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown
[Install]
WantedBy=multi-user.target
启动:
systemctl daemon-reload
systemctl start redis
systemctl status redis