[2]supervisor Use management: Implements an automatic restart of an abnormally interrupted subprocess (for Redis, for example)

Source: Internet
Author: User

1: Download
wget HTTP://DOWNLOAD.REDIS.IO/RELEASES/REDIS-3.2.8.TAR.GZ1

Download the specified version, you can log in Https://redis.io/download view

2: Installation
Tar zxvf redis-3.2.8.tar.gzcd Redis-3.2.8makesudo make install1234

The Redis executable is then placed in the/usr/local/bin

3: Configuration
sudo mkdir/etc/redissudo CP redis.conf/etc/redis/6379.confsudo CP utils/redis_init_script/etc/redis/123
4: Run and close
Cd/etc/redis1
#使用root权限运行sudo./redis_init_script start12
#再打开一个终端, execute the following command to close Rediscd/etc/redis./redis_init_script stop123
#也可以通过redis客户端关闭redis-cli Shutdown12
5: Monitor process with supervisor
#先打开supervisor配置文件sudo VI/ETC/SUPERVISORD.CONF12

Add code at the end of a file

[Program:redisd];command=/etc/redis/redis_init_script start; it is not possible to start the Redis process in this way, supervisor is monitoring scripts Redis_ Init_script, not rediscommand=/usr/local/bin/redis-server/etc/redis/6379.confstdout_logfile=/var/log/supervisor/. redis.logstdout_logfile_maxbytes=1mbstdout_logfile_backups=10username=rootpassword=root_password123456789
6: Update Supervisor Configuration
sudo supervisorctl update1

Redis Service is now running in the background

7: Turn off Redis

In the supervisord.conf file, the [PROGRAM:REDISD] flag means that the Redis service is managed using REDISD (with a letter D appended to the Redis) to operate.
Therefore, there are several ways to turn off the Redis service:

sudo supervisorctl stop REDISD1
#或者通过redis客户端的方式关闭redis-cli Shutdown12
8: Restart again
Supervisorctl Start REDISD1

For more supervisor operations, please see:
Linux Process management Tools Supervisor http://blog.csdn.net/win_turn/article/details/60466562


[2]supervisor Use management: Implements an automatic restart of an abnormally interrupted subprocess (for Redis, for example)

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.