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

How to set redis to start automatically at boot

藏色散人
藏色散人forward
2020-08-17 13:35:164282browse

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

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"

How to set redis to start automatically at boot

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

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

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!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete