Today introduced about the Logstash of the starting mode, previously said is to use the/usr/local/logstash-f/etc/logstash.conf way to start, so there is a trouble when you shut down the terminal, or CTRL + C, Logstash will exit. Here are a few long-running ways.
1. Service mode
The use of RPM installation, can be/etc/init.d/logstash boot, compile and install the need to write your own startup script
2, Nohup Way
This is the simplest, for the novice
Nohup/usr/local/logstash/bin/logstash-f/etc/logstash/logstash.conf-w 10-l/var/log/logstash/logstash.log &
3. Elegant Screen mode
A screen software is used to run screen, which is the same terminal as the shell, and the process is still running after it is started using ctrl+a+d exit.
Create a separate screen command as follows:
Screen-dms Elk
The elk command created by taking over the connection is as follows:
Screen-r Elk
Startup program:/usr/local/logstash/bin/logstash-f/etc/logstash/logstash.conf
Ctrl+a+d exit, PS Look, Logstash is still running
4, the most recommended Daemontools way
Daemontools is a software name, but the configuration is slightly more complex. So here I am using Python to implement the Supervisord way:
Install First:
Yum Install Python-setuptools
Easy_install Supervisor
Build configuration file (supervisord.conf):
echo_supervisord_conf >/etc/supervisord.conf
In supervisord.conf finally added:
[Program:elkpro_1]
environment=ls_heap_size=5000m
Directory=/usr/local/logstash
Command=/usr/local/logstash/bin/logstash-f/etc/logstash/conf.d/pro1.conf-w 10-l/var/log/logstash/pro1.log
Note: After testing, here the Logstash configuration file must be in the conf.d/directory.
Then start Supervisord-c/etc/supervisord.conf.
Explain:
Logstash will run as a supervisord child process, and you can also use the SUPERVISORCTL command to control the start and stop of a process in a sequence of logstash child processes individually:
Supervisorctl Start Elkpro_1 (support start, stop, restart)
It is also important to note that when you modify supervisord.conf, you need to reload the configuration file using Supervisorctl reload.
This article is from the "Linux" blog, so be sure to keep this source http://syklinux.blog.51cto.com/9631548/1866750
Elk's Logstash long run