1. Installing Supervisor
Easy_install Supervisor
2. Configure Supervisor
Mkdir/etc/supervisor
echo_supervisord_conf >/etc/supervisor/supervisord.conf
cd/etc/supervisor/
mkdir CONF.D
CD conf.d/
Touch elastic.conf
Vim elastic.conf
Then enter the contents below to save the exit
[Program:elastic]
command= sh/home/qukan/elasticsearch-5.5.3/bin/elasticsearch; command to run the program
Autorestart=true; Program quits unexpectedly if auto-restart
Autostart=true; Whether to start automatically
Stderr_logfile=/var/log/elastic.err.log; Error log file
Stdout_logfile=/var/log/elastic.out.log; Output log file
environment=java_home=/usr/lib/java/jdk1.8.0_144; Process Environment variables
User=qukan; User identity for Process execution
Startsecs=1; Automatic restart Interval
Description
User-specified to start with
Environment specify Java_home, I did not specify this environment variable to cause startup failure, by viewing the/var/log/elastic.out.log log file found could not find Java; Set Java_home or ensure JAVA is in PATH, so setting environment variables here
Then modify the/etc/supervisor/supervisord.conf file to put the final
; [include]
; files = Relative/directory/*.ini
Switch
[include]
Files = conf.d/*.conf
Include the above configuration file in
3. Run the command to start supervisor
sudo supervisord-c/etc/supervisor/supervisord.conf
4. Run the command to view the managed process
Supervisorctl status
As shown
All right, perfect!
More details, explore for yourself!
Resources:
Https://www.cnblogs.com/zhoujinyi/p/6073705.html
Https://www.cnblogs.com/Hai--D/p/5820718.html
http://blog.51cto.com/lixcto/1539136
Record-linux installation supervisor to monitor Elasticsearch