Redis configured as System service (CENTOS7)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.