1. Find redis / utils in edis download package found redis_init_script copy it to the /etc/init.d directory and rename it to redis
cd repeat
cd utils
mv redis_init_script /etc/init.d/redis
cd /etc/init.d
2. Edit the script redis
[root@localhost init.d]# vim redis
Please edit the path of the following five parameters according to their installation directory
REDISPORT = 6379 # port
EXEC = / usr / local / java / redis / bin / command path redis-server # services start
CLIEXEC = / usr / local / java / redis / bin / redis-cli # client route
PIDFILE = / var / run / redis _ $ {REDISPORT} .pid # record PID (process id) file path
CONF = "/ usr / lcoal / java / redis / bin / redis.conf" # Profile Path
3. Redis registered as a service:
[root @ localhost init.d] # chkconfig --add redis
Note: If the message does not support chkconfig reids error
Solution: vim /ect/init.d/redis
by i, enter edit mode
to add #chkconfig head of the document: 2345 8090
as:
! # / bin / SH
#chkconfig: 2345 80 90
after storage: input [root @ localhost init.d] # chkconfig --add redis
4. Start Redis service
Commonly used commands
redis-server /usr/local/redis/etc/redis.conf or service redis start // start redis
pkill redis || kill -9 0000 //停止redis
## Well, after reboot reboot linux, enter ps -ef | grep redis redis display process, congratulations configuration successful!
If you do not know, you can contact QQ: 425759592 Learning Exchange