Centos 7 .Net core Background DaemonsSupervisor To configure
Environmental Science:
Centos 7
already installed.Net core 2.0.0 .Net core 1.1.2
1,Supervisor install
* yum install
yum install supervisor
( Alicloud passed the verification)
* easy_install install
Ifyum Setup cannot find resources, Can passeasy_install
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | sudo
python
installsupervisor
easy_install supervisor
2, To configuresupervisor
* stayetc Create directory under, Assign authority
mkdir -m 700 -p /etc/supervisor
* In directory“ /etc/supervisor” Create profile under
echo_supervisord_conf > /etc/supervisor/supervisord.conf
* Modify profile
vim /etc/supervisor/supervisord.conf
Add at the end of the file, Note that there is no space between the beginning and the end, Demand ceiling
[include]
files=/etc/supervisor/conf.d/*.conf
* In directory“/etc/supervisor” Create belowdotnet core Process profile storage directory“conf.d”
mkdir -m 700 /etc/supervisor/conf.d
3, Create process profile
vim /etc/supervisor/conf.d/MyDotNetName.conf
"MyDotNetName" Can bedotnet core Entrancedll File name , Insert content, Note that there is no space between the beginning and the end, Demand ceiling:
[program:MyDotNetName] command=/bin/bash -c "dotnet MyDotNetName.dll" directory
=/usr/PublishOutput/
stderr_logfile=/var/log/MyDotNetName.error.log stdout_logfile=/var
/log/MyDotNetName.stdout.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=root
stopsignal=INT autostart=true
autorestart=true startsecs=3 [program:MyDotNetName] ; Display name command=/bin/bash -c
"dotnet MyDotNetName.dll" ; Run command, start-updotnet process directory=/usr/PublishOutput/
;MyDotNetName Catalog stderr_logfile=/var/log/MyDotNetName.error.log ; Error log file
stdout_logfile=/var/log/MyDotNetName.stdout.log ; log file
environment=ASPNETCORE_ENVIRONMENT=Production ; Process environment variable user=root ; Process execution user
autostart=true ; Auto start autorestart=true ; Whether to restart automatically startsecs=3 ; Automatic restart interval
4, Establishsupervisor Self starting service
vim /etc/systemd/system/supervisor.service
Editorial content:
[Unit] Description=supervisor [Service] Type=forking ExecStart
=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf ExecStop=/usr/bin/
supervisorctl shutdown ExecReload=/usr/bin/supervisorctl reload KillMode=
process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target
Make configuration effective
systemctl daemon-reload
Set service startup, Set upenable
systemctl enable supervisor.service
Startup service
systemctl start supervisor.service
5, Verificationdotnet Whether the process starts
Use command“ps -ef | grep dotnet” Seedotnet Whether to run
[[email protected] ~]# ps -ef | grep dotnet root 2281 2280 0 15:27 ? 00:00:00
dotnet MyDotNetName.dll root2302 2217 0 15:30 pts/0 00:00:00 grep --color=auto
dotnet
6,supervisor Remote management
Use command“vim /etc/supervisor/supervisord.conf” Modify profile, Set as follows
;[inet_http_server] ; inet (TCP) server disabled by default ;port=127.0.0.1:
9001 ; (ip_address:port specifier, *:port for all iface) ;username=user ; (
default is no username (open server)) ;password=123 ; (default is no password
(open server))
; The following is onhttp service [inet_http_server] port=192.168.1.71:9001 ;ip Add port username=admin
; Landing account, Can not set uppassword=123456 ; Landing account, Can not set up
Restart service, You can access it
Pay attention to whether the firewall is to the port9001 exception
Possible problems:
supervisor start-updotnet.core newspaper“ too many start retries too quickly”
<http://www.cnblogs.com/hobinly/p/8085404.html>
标签
30天阅读排行