In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to set redis service boot self-startup". In daily operation, I believe many people have doubts about how to set redis service boot self-startup. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to set redis service boot self-startup". Next, please follow the editor to study!
1. Set redis to start in the background before writing the script, modify the redis.conf file, and change daemonize no to daemonize yes.
2. Use redis startup script to set boot self-startup
The startup script redis_init_script is located in the / utils/ directory of Redis, and the redis_init_script script code is as follows:
#! / bin/sh## Simple Redis init.d script conceived to work on Linux systems# as it does use of the / proc filesystem.# chkconfig: 2345 90 10 # description: Redis is a persistent key-value database### BEGIN INIT INFO# Provides: redis_6379# Default-Start: 2345 # Default-Stop: 0 1 6# Short-Description: Redis data structure server# Description: Redis data structure server. See https://redis.io### END INIT INFOREDISPORT=7001EXEC=/usr/local/server/redis-5.0.5/bin/redis-serverCLIEXEC=/usr/local/server/redis-5.0.5/bin/redis-cliPIDFILE=/var/run/redis_$ {REDISPORT} .pidCONF = "/ usr/local/redis-cluster/$ {REDISPORT} / redis.conf" case "$1" in start) if [- f $PIDFILE] then echo "$PIDFILE exists Process is already running or crashed "else echo" Starting Redis server... "$EXEC $CONF fi Stop) if [!-f $PIDFILE] then echo "$PIDFILE does not exist Process is not running "else PID=$ (cat $PIDFILE) echo" Stopping... "$CLIEXEC-p $REDISPORT shutdown while [- x / proc/$ {PID}] do echo" Waiting for Redis to shutdown... " Sleep 1 done echo "Redis stopped" fi;; *) echo "Please use start or stop as first argument";; esac
In the fourth line of the header of the open redis initialization script file, append the following two sentences
# chkconfig: 2345 90 10 # description: Redis is a persistent key-value database
Change the installation path to your own installation directory
Copy the startup script to the / etc/init.d directory. In this example, the startup script is named redisd (usually ending in d to indicate a background self-starting service).
3. Remember to modify the file permissions after you finish writing
Chmod + x / etc/init.d/redisd
4. Add scripts to the list of system services
Chkconfig-- add redisdchkconfig redisd onchkconfig-- list / / View all registered script files
5. Common commands
# Open the service service redisd start# and close the service service redisd stop. This is the end of the study on "how to set the redis service to start up". I hope you can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.