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

How to set up redis at startup

Release: 2020-05-16 09:31:21
forward
3027 people have browsed it

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

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

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
Copy after login

is set to boot up:

chkconfig redis on
Copy after login

Common commands

service redis start
service redis stop
Copy after login

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!

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