In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Linux supervisord process management and automatic restart is like, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Introduction to supervisord:
Official website: http://supervisord.org/
Github: https://github.com/Supervisor/supervisor
Overview: software features:
This software is a process management system, which can easily manage the system. At the same time, it provides a rich interface for you to manage as you please.
Application scenarios:
Resident task maintenance, management, no matter what language your resident process is written, you can use this artifact to manage
It is used to monitor nginx, redis, mongodb and other software. If the software fails because of an exception, it can restart automatically without terminal service.
To put it simply: daemon, if your process is running all the time, it suddenly dies. So supervisord can help you speed up the process and make it work properly.
Architecture:
Supervisord: server side, which is really used to monitor the process of the program.
Supervisorctl: client, used to manage the process of the monitor program
Installation: description:
I have adopted a self-agreed specification here to facilitate the members of the group to reach a consensus, and there is no cost of learning about service management.
I rely on python to install
Specification:
Software root directory: / data/opt
Shortcut root directory: / data/opt/scripts, where this directory is added to the system PATH. Export PATH='/data/opt/scripts':$PATH
The configuration directory of supervisord and the running log directory are all placed in / data/opt/supervisord
Dependence:
Python
Installation: pip install supervisor configuration fil
"echo_supervisord_conf" command to generate a configuration file, for example
Echo_supervisord_conf > / etc/supervisord.conf configuration management process adds these two sentences [program:python] command=python / tmp/test.py/tmp/test.py file content #! / usr/bin/python#-*-coding: UTF-8-*-import timewhile (True): # 3 seconds time.sleep (1) # Open file fo = open ("/ tmp/test.txt") at the end of / etc/supervisord.conf "a") print "file name is:", fo.name str = time.ctime () + "\ n" fo.write (str) # close the file fo.close () start supervisordsupervisord # enter to start-h you can view the python process by looking at the specific configuration of the parameters
You can see that the content in / tmp/test.txt is increasing.
test
Now we have received the process of killing python test.py.
Kill-9 5535 kills python test.py this process
And then check the progress, and you can see that python test.py appears again.
Let's see that the process number has become 5592.
After reading the above, have you mastered the methods of supervisord process management and automatic restart in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.