asp.net core2.0 deployment centos7/linux System-Daemon Supervisor (ii)

Source: Internet
Author: User
Tags file permissions
Continuation of an article: asp.net core2.0 deployment centos7/linux System-Install Deployment (i), the legacy of the problem, add daemons to the program, so that the site can continue to run.
1. Introduction of Supervisor Supervisor (http://supervisord.org/) is a client/server service developed in Python, a process management tool under the Linux/unix system, Windows system is not supported. It makes it easy to listen, start, stop, and restart one or more processes. With the process of supervisor management, when a process is accidentally killed, Supervisort heard the process after death, will automatically pull it back, very convenient to do the process of automatic recovery function, no longer need to write their own shell script to control. Since supervisor was developed by Python, check to see if the system has the Python2.4 version installed before installing it. The following is an introduction to the installation and configuration of supervisor in the centos7,python2.7 version environment:
1, install the Python Package management tool (Easy_install), install the Supervisor command: Yum install Python-setuptools Easy_install Description: Supervisor will generate three execution programs after installation: SUPERVISORTD, Supervisorctl, echo_supervisord_conf, Supervisor Daemon Services (for receiving process management commands), Client (used to communicate with daemon, send instructions for management process), Generate initial profile program
2. Configure Supervisor New configuration directory command: Mkdir/etc/supervisor Generate Supervisor Initialization profile: echo_supervisord_conf >/etc/supervisor/su pervisord.conf Modify configuration file: Vi supervisord.conf, as shown: Uncomment and modify files and save
3, Configuration Management process Description: Process Management configuration parameters, do not recommend all written in the supervisord.conf file, each process should write a configuration file in the directory included in the supervisord.conf file a. Create/etc/supe RVISOR/CONF.D directory, which is used to store the process-managed configuration file B. Modify the include parameters in/etc/supervisor/supervisord.conf to/etc/supervisor/ The CONF.D directory is added to the configuration of application 1 in include: For example, our application name is: WebApplication1 command VI webapplication1.conf Input code: [Program: WebApplication1] command=dotnet WebApplication1.dll directory=/root/aspnetcoreapi autorestart=true stderr_ Logfile=/var/log/webapplication1.err.log Stdout_logfile=/var/log/webapplication1.out.log environment=ASPNETCORE_ Environment=production User=root Stopsignal=int
Save and exit ...
4, Start Supervisor Service command: supervisord-c/etc/supervisor/supervisord.conf View status: Supervisorctl status check to have a An application is running, stating that it is normal
5, the process of control instructions: Supervisord start successfully, you can control the process through the Supervisorctl client, start, stop, restart.          Running the supervisorctl command, without parameters, enters the supervisor client's interactive terminal and lists all processes currently under management. The WebApplication1 in the figure above is the name we specified [Program:webapplication1] in the configuration file.
6, Bash Terminal Control start: supervisord-c/etc/supervisor/supervisord.conf supervisorctl status Supervisorctl stop Webappli Cation1 supervisorctl start WebApplication1 supervisorctl restartWebApplication1 supervisorctl Reload Supe RVISORCTL Update
7, Web management interfaceDescription: For security reasons, the default configuration is not to open the Web management interface, you need to modify the supervisord.conf configuration file to open HTTP access permissions, the following configuration changes: This configuration indicates that my management interface is open Oh, 9001 port, let's browse the address http:// 192.168.0.171:9001/8, boot boot Supervisor service first into the/lib/systemd/system directory, and create Supervisor.service files, enter the code as follows:
[Unit] Description=supervisor After=network.target
[Service] Type=forking execstart=/usr/bin/supervisord-c/etc/supervisor/supervisord.conf ExecStop=/usr/bin/supervis Orctl $OPTIONS shutdown execreload=/usr/bin/supervisorctl $OPTIONS Reload killmode=process restart =on-failure restartsec=42s
[Install]
Wantedby=multi-user.target
Save and exit ...
Modify file Permissions command: chmod 766 Supervisor.service
Set up the boot systemctl enable Supervisor.service Systemctl daemon-reload above Supervisor Boot service started already good. 。。

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.