In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Have a feeling:
After playing with Redis for a long time, I really feel that the startup mode is still convenient by my own definition!
1) Direct startup and shutdown: (default for configuration file)
Enable: redis-server & (& run in the background)
# daemonize yes (this parameter can also be modified by configuration file)
Close: redis-cli shutdown or killall-9 redis-server
2) specify configuration file startup:
Redis-server / etc/redis.conf (configuration files can be defined by yourself)
If you change the redis default port:
Redis-cli shutdown (- p port)
Redis-cli shutdown (- p port) (- an authentication password)
3) define the startup file and configure it (recommended)
[root@redis1 ~] # cpredis-2.8.24/utils/redis_init_script / etc/init.d/redis
Register as a system service:
[root@redis1 ~] # sed-I'2i # chkconfig:2345 80 90' / etc/init.d/redis
[root@redis1] # chkconfig-- add redis
Modify the configuration file (because the path is defined by itself, sed can also)
REDISPORT=7000 # Note that slave ports can be defined by themselves
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/var/run/redis_$ {REDISPORT} .pid
CONF= "/ etc/redis/$ {REDISPORT} .conf"
The script is as follows (configured by yourself, you can also modify it on this basis)
#! / bin/sh#chkconfig: 2345 80 90# Simple Redis init.d script conceivedto work on Linux systems# as it does use of the / procfilesystem. REDISPORT=7000EXEC=/usr/local/redis/bin/redis-serverCLIEXEC=/usr/local/redis/bin/redis-cli PIDFILE=/var/run/redis_$ {REDISPORT} .pidCONF = "/ etc/redis/$ {REDISPORT} .conf" case "$1" in start) if [- f $PIDFILE] then echo-e "\ 033 [31m $PIDFILEexists Process isalready running or crashed\ 033 [0m "else echo-e"\ 033 [32m Waitingfor Redis to start...\ 033 [0m "$EXEC $CONF if [$?-eq 0] then echo-e"\ 033 [32m Redis isalready started successfully!\ 033 [0m "else echo -e "\ 033 [31m Redisstart fail\ 033 [0m" fi fi Stop) if [!-f $PIDFILE] then echo-e "\ 033 [31m $PIDFILEdoes not exist Process is not running\ 033 [0m "else PID=$ (cat $PIDFILE) echo-e"\ 033 [32m Waitingfor Redis to stop...\ 033 [0m "$CLIEXEC-p $REDISPORT shutdown while [- x / proc/$ {PID}] do echo-e"\ 033 [32mWaiting for Redis to shutdown. .\ 033 [0m "sleep 1 done echo-e"\ 033 [32m Redis isalready stopped successfully!\ 033 [0m "fi ; status) ps aux | grep redis-server | grep-v grep & > / dev/null if [$?-eq 0] then echo-e "\ 033 [32m Redisis running... \ 033 [0m "else echo-e"\ 033 [31m Redisis already stopped\ 033 [0m "fi Restart) $CLIEXEC-p $REDISPORT shutdown if [$?-eq 0] then echo-e "\ 033 [32m Redis isalready stopped successfully!\ 033 [0m" else echo-e "\ 033 [31m Redisstop fail\ 033 [0m" fi $EXEC $CONF if [$?-eq 0] then echo-e "\ 033 [32m Redis isalready started successfully!\ 033 [0m" else echo-e "\ 033 [31m Redisstart fail\ 033 [0m" fi ; *) echo "the usage is service redis start | stop | status | restart" esac
Check redis status, start, shut down, restart
[root@redis1 ~] # / etc/init.d/redis status Redis is running... [root@redis1] # / etc/init.d/redis stop Waiting for Redis to stop... Waiting for Redis to shutdown... Redis is already stopped successfully! [root@redis1 ~] # / etc/init.d/redis start Waiting for Redis to start... Redis is already started successfully! [root@redis1 ~] # / etc/init.d/redis restart Redis is already stopped successfully! Redis is already started successfully! [root@redis1 ~] # [root@redis1 ~] # ps aux | grep redis-server | grep-v greproot 2881 0.1 128296 1692? Ssl 12:45 0:01 / usr/local/redis/bin/redis-server *: 7000 [root@redis1 ~] #
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.