1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| useradd -s /sbin/nologin redis cat >> /usr/lib/systemd/system/redis5.service << EOF
[Unit] Description=redis After=network.target
[Service] Type=forking PIDFile=/usr/local/redis-5/redis_16379.pid ExecStart=/usr/local/redis-5/bin/redis5-server /usr/local/redis-5/conf/redis_16379.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true User=redis Group=redis
[Install] WantedBy=multi-user.target EOF
systemctl daemon-reload systemctl status redis5 systemctl start redis5
/usr/local/redis-5/bin/redis-cli -a redis_16379 -p 16379 -h 192.168.1.2 #测试连接
|