1. Go to the Redis installation directory, where you can see the path to your installation.
cd/usr/local/redis/
2. Edit the configuration file
sudo vim./redis.conf
3. Comment out the following configuration items
127.0. 0.1
4. The following changes to Yes, the default is no
Daemonize Yes
5. Modify the PID file path, which is optional, using the default path is also possible.
Pidfile/usr/local/redis/redis.pid
6. Remove the protection mode, which is optional here. If you cancel, you will not be required to use password verification.
Protected-mode No
7. Save the file.
8. Create a new file
sudo vim/usr/lib/systemd/system/redis.service
9. Write the following content, the specific file path, different.
[Unit]description=redisafter=syslog.target network.target remote-fs.target nss- Lookup.target[service]type=forkingpidfile=/usr/local/redis/redis.pidexecstart=/usr/ Local/redis/src/redis-server/usr/local/redis/redis.conf
execreload=/bin/kill -
Execstop=/bin/kill -
Privatetmp=true
10. Heavy-duty system services
sudo systemctl daemon-reload
11. Start Redis
sudo systemctl start Redis
Redis configured as System service (CENTOS7)