Boot-up under Redis Linux

Source: Internet
Author: User

Environment Building http://www.cnblogs.com/zsg88/p/8321644.html under Redis Linux

After installing redis-4.0.1, set up Linux boot from boot.

1. Locate Redis_init_script in redis/utils copy it to the/ETC/INIT.D directory and rename it to Redis

cd/etc//usr/local/programs/redis4/utils/redis_init_script  Redis

2. Editing a Redis script

VI Redis

Make the following changes

(1) Add a line after the first line of the script as follows:

#chkconfig: 2345 80 90
When registering a service, you need

(2) Please modify the actual path of the following 5 parameters according to your own installation directory

redisport=6379 #端口

Exec=/usr/local/bin/redis-server #启动服务的命令路径

CLIEXEC=/USR/LOCAL/BIN/REDIS-CLI #客户端路径

Pidfile=/var/run/redis_${redisport}.pid #记录pid (Process id) file path

conf= "/etc/redis/${redisport}.conf" #配置文件路径

Modified as follows

redisport=6379EXEC=/usr/local/programs/redis4/bin/redis-servercliexec=/usr/local/programs/ redis4/bin/redis-clipidfile=/var/run/redis_6379.pidconf="/usr/local/programs/ redis4/redis_6379.conf"

Verify that the above directory path exists and does not exist to establish the directory

(3) Change the Redis Open command to run in the background:

$EXEC $CONF & # "&" function is to move the service back to run

3. Once the above configuration operation is complete, Redis can be registered as a service:

# chkconfig--add Redis

Check to see if our Redis is already available in the start-up service
Chkconfig--list Redis

4. Open the firewall port

/sbin/iptables-i input-p TCP--dport 6379-j ACCEPT

#将更改进行保存
/etc/rc.d/init.d/iptables Save
#重启防火墙以便改动生效:(or restart the system directly)
/etc/init.d/iptables restart

5. Modify Redis profile settings:

A copy of the redis.conf is named Port + ". conf", corresponding to the configuration file name in the startup script

CP redis.conf conf/6379.conf

CD conf

VI 6379.conf
Modify the following configuration
Daemonize no change to daemonize Yes
Pidfile/var/run/redis.pid to sing woo the path consistent in the self-startup script Pidfile/var/run/redis_6379.pid

6. Start the Redis service
# service Redis Start

7. Stop Redis Service

# Service Redis Stop

Boot-up under Redis Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.