In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Deployment environment
OS:CentOS7
.NET Core SDK:2.2.402
Install .NET Core SDK
1.1 installation depends on yum install libunwind libicu
Repo of dotnet, you need to register the Microsoft signing key and add the Microsoft product key
Rpm-Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
1.2 install dotnet SDK
Yum updateyum install dotnet-sdk-2.2
1.3 Verification View
# dotnet-info
.net Core SDK (reflecting any global.json): Version: 2.2.402Commit: c7f2f96116Runtime Environment:OS Name: centosOS Version: 7OS Platform: LinuxRID: centos.7-x64Base Path: / usr/share/dotnet/sdk/2.2.402/Host (useful for support): Version: 2.2.8Commit: b9aa1abc51.NET Core SDKs installed:2.2.402 [/ usr/share/dotnet/sdk] .NET Core runtimes installed:Microsoft.AspNetCore.All 2.2 .8 [/ usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.8 [/ usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.8 [/ usr/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Create a soft link for the dotnet command:
/ usr/bin/dotnet-> / usr/share/dotnet/dotnet
1.5 deploy and start the .NET Core project application
Go to the project application:
Cd / usr/soft/package/Web
Start the dotnet application
Dotnet / usr/soft/package/Web/HiCore.PreventFraudAPI.Web.dll
There is a problem here. The application launched in the above way is not started in the background, and if Ctrl+Z exits the application, a Daemon daemon is needed to allow the application to run independently. Here, Supervisor is introduced.
Nginx configuration application virtual host
Here Nginx is installed slightly, mainly under the description of the virtual host configuration file of Nginx configuration. The default proxy_pass reverse port is 5000, which can be modified according to the actual project. Here, the port of the application project configuration of the .NET Core is configured in the hosting.json file in the project, such as: hosting.json {"server.urls": "http://*:8001"}"
The virtual host file configured by Nginx is configured as follows:
Server {listen 80location position / {proxy_pass http://localhost:8001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade;}}
After the file is saved, execute the command nginx-s reload to restart Nginx to access it.
Supervisor configuration daemon
Supervisor is a process management tool under the Linux/Unix system developed with Python. It can make the process break away from the terminal and become the background Daemon daemon. Monitor the status of the process in real time, and restart automatically when an exception exits.
3.1 install Supervisor
It is officially recommended that the preferred installation method is to use easy_install, which is a feature of setuptools (Python package management tool). Yum install python-setuptools
Installation
Easy_install supervisor
Version
Supervisord-version
3.2 initialize the supervisor configuration
Mkdir / etc/supervisor
Mkdir-p / etc/supervisor/conf.d
Echo_supervisord_conf > / etc/supervisor/supervisord.conf
Open the supervisord.conf file and modify the default [include] configuration item as follows:
[include] files = conf.d/*.conf
Supervisor automatically loads the files with the .conf suffix in the / etc/supervisor/conf.d directory as a common service configuration. Each process managed by Supervisor writes a separate configuration file and places it in that directory, while the / etc/supervisor/supervisord.conf configuration file retains the common configuration.
3.3.Writing .NET Core project application configuration
Vim / etc/supervisor/conf.d/netcoreAPI.conf
[program:PreventFraudAPI.Web] command=dotnet Web.dll # Startup Command directory=/usr/soft/package/FraudAPI.Web # Startup Application Directory autostart=true # when Supervisord starts, whether the program starts startretries=5 # automatically starts startretries=5 # when the program exits, and the number of automatic retries that failed. Default is 3startsecs=1 # automatic restart interval user=root # start process user, default rootpriority=999 # default 999 Small value priority starts stderr_logfile=/var/log//PreventFraudAPI.err.log # error_logstdout_logfile=/var/log//PreventFraudAPI.out.log # out_logenvironment=ASPNETCORE_ENVIRONMENT=Production # process environment variable stopsignal=INT # signal used to kill the program when a request is stopped
Start the Supervisor service command, but do not start it here, and then set Supervisor to boot.
Supervisord-c / etc/supervisor/supervisord.conf
3.4.Setting Supervisor to boot
Create the Supervisor startup service script supervisor.service, directory / usr/lib/systemd/system/.
The content of the supervisor.service script:
[Unit] Description=Supervisor daemon [service] Type=forkingExecStart=/usr/bin/supervisord-c / etc/supervisor/supervisord.confExecStop=/usr/bin/supervisorctl $OPTIONS shutdownExecReload=/usr/bin/supervisorctl $OPTIONS reloadKillMode=processRestart=on-failureRestartSec=42s [Install] WantedBy=multi-user.target
Set up boot boot
Systemctl enable supervisor
3.5 Supervisorctl Management process
After the Supervisor service starts, the processes managed by it run in the background. Client processes can be managed through the supervisorctl command.
# supervisorctl
PreventFraudAPI.Web RUNNING pid 15921, uptime 0:22:51supervisor > supervisor > helpdefault commands (type help): = = add exit open reload restart start tail avail fg pid remove shutdown status update clear maintail quit reread signal stop version
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: 232
*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.