Home > Database > Redis > body text

How to configure Redis as a system service in CentOS

藏色散人
Release: 2020-08-24 13:42:41
forward
2379 people have browsed it

The following column Redis tutorial will introduce to you how redisqueue implements the historical search function. I hope it will be useful to friends who need it. Helped!

How to configure Redis as a system service in CentOS

CentOS Configure Redis as a system service

Create redis.service

cd  /usr/lib/systemd/system
touch redis.service
Copy after login

Edit content

[Unit]
Description=Redis Server
After=network.target
[Service]
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/bin/redis-server /etc/redis.conf
ExecStop=/usr/local/bin/redis-cli -a passwd shutdown
ExecReload=/bin/kill -s HUP $MAINPID
[Install]
WantedBy=mutli-user.target
Copy after login

Reload systemctl and start the service

systemctl daemon-reload
systemctl start redis.service
Copy after login

Check the status

systemctl status redis.service
Copy after login

Close Redis

systemctl stop redis.service
Copy after login

Auto-start at boot

systemctl enable redis.service
Copy after login

Whether it starts automatically at boot

systemctl is-enabled redis.service
Copy after login

The above is the detailed content of How to configure Redis as a system service in CentOS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!