Home > Database > Redis > How to set redis to start automatically at boot

How to set redis to start automatically at boot

藏色散人
Release: 2020-08-17 13:35:16
forward
4323 people have browsed it

The following column Redis Tutorial will introduce to you how to use Redis to implement the ranking function. I hope it will be helpful to friends in need!

How to set redis to start automatically at boot

1. Copy redis and install the current /usr/local/redis-4.0.8/utils/redis_init_script to /etc/init.d /redis file;

cp /usr/local/redis-4.0.8/utils/redis_init_script /etc/init.d/redis
Copy after login

2. Modify the /etc/init.d/redis file. Modify the installation directory of related files for redis installation

#!/bin/sh
# chkconfig: 2345 10 90
# description: Start and Stop redis

# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.

REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli

PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/local/redis/etc/redis.conf"
Copy after login

How to set redis to start automatically at boot

##
#!/bin/sh
# chkconfig: 2345 10 90
# description: Start and Stop redis
Copy after login

Remarks:

The above comment means that the redis service must be started or shut down in run levels 2, 3, 4, and 5. The startup priority is 90 and the shutdown priority is 10. Copy it from the redis installation directory, it may not be there, you need to add it; otherwise the chkconfig command will fail;

3. Start the settings after booting, execute the command:

    Add redis service:
                                                                                     ##Common commands
chkconfig --add redis
Copy after login

The above is the detailed content of How to set redis to start automatically at boot. 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