Home  >  Article  >  Database  >  How to set up redis at startup

How to set up redis at startup

尚
forward
2020-05-16 09:31:212941browse

How to set up redis at startup

How to set up redis at startup:

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 up redis at startup

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

Note:

The above comment means that the redis service must be in run level 2, 3, It is started or shut down under 4 or 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:

chkconfig --add redis

is set to boot up:

chkconfig redis on

Common commands

service redis start
service redis stop

For more redis knowledge, please pay attention to the redis introductory tutorial column.

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