当前位置: 首页 > news >正文

学习Nginx(三):命令与信号

命令及选项

1. 显示帮助信息:

[root@RockyLinux9 ~]# nginx -h
nginx version: nginx/1.26.0
Usage: nginx [-?hvVtTq] [-s signal] [-p prefix][-e filename] [-c filename] [-g directives]选项:-?,-h         : 显示帮助信息-v            : 显示版本信息-V            : 显示版本信息和编译配置项-t            : 检查测试配置文件-T            : 检查测试配置文件并输出内容-q            : 在配置文件测试期间禁止显示非错误消息-s signal     : 向主进程发送信号: stop, quit, reopen, reload-p prefix     : 设置配置路径,默认: /usr/local/nginx/-e filename   : 设置错误日志文件,默认: logs/error.log-c filename   : 设置配置文件,默认: conf/nginx.conf-g directives : 启动时指定全局配置项,而不修改配置文件,格式:k v;

2. 显示版本信息

[root@RockyLinux9 ~]# nginx -v
nginx version: nginx/1.26.0

3. 显示版本信息和编译配置项

[root@RockyLinux9 ~]# nginx -V
nginx version: nginx/1.26.0
built by gcc 11.4.1 20230605 (Red Hat 11.4.1-2) (GCC)
built with OpenSSL 3.0.7 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module

4. 检查测试配置文件

[root@RockyLinux9 ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

5. 检查测试配置文件并输出内容

[root@RockyLinux9 ~]# nginx -T
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
# configuration file /usr/local/nginx/conf/nginx.conf:#user  nobody;
worker_processes  1;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;
pid     run/nginx.pid;events {worker_connections  1024;
}http {include       mime.types;default_type  application/octet-stream;#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#gzip  on;server {listen       80;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   html;index  index.html index.htm;}#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#    proxy_pass   http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {#    root           html;#    fastcgi_pass   127.0.0.1:9000;#    fastcgi_index  index.php;#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;#    include        fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#    deny  all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {#    listen       8000;#    listen       somename:8080;#    server_name  somename  alias  another.alias;#    location / {#        root   html;#        index  index.html index.htm;#    }#}# HTTPS server##server {#    listen       443 ssl;#    server_name  localhost;#    ssl_certificate      cert.pem;#    ssl_certificate_key  cert.key;#    ssl_session_cache    shared:SSL:1m;#    ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;#    location / {#        root   html;#        index  index.html index.htm;#    }#}
}# configuration file /usr/local/nginx/conf/mime.types:types {text/html                                        html htm shtml;text/css                                         css;text/xml                                         xml;image/gif                                        gif;image/jpeg                                       jpeg jpg;application/javascript                           js;application/atom+xml                             atom;application/rss+xml                              rss;text/mathml                                      mml;text/plain                                       txt;text/vnd.sun.j2me.app-descriptor                 jad;text/vnd.wap.wml                                 wml;text/x-component                                 htc;image/avif                                       avif;image/png                                        png;image/svg+xml                                    svg svgz;image/tiff                                       tif tiff;image/vnd.wap.wbmp                               wbmp;image/webp                                       webp;image/x-icon                                     ico;image/x-jng                                      jng;image/x-ms-bmp                                   bmp;font/woff                                        woff;font/woff2                                       woff2;application/java-archive                         jar war ear;application/json                                 json;application/mac-binhex40                         hqx;application/msword                               doc;application/pdf                                  pdf;application/postscript                           ps eps ai;application/rtf                                  rtf;application/vnd.apple.mpegurl                    m3u8;application/vnd.google-earth.kml+xml             kml;application/vnd.google-earth.kmz                 kmz;application/vnd.ms-excel                         xls;application/vnd.ms-fontobject                    eot;application/vnd.ms-powerpoint                    ppt;application/vnd.oasis.opendocument.graphics      odg;application/vnd.oasis.opendocument.presentation  odp;application/vnd.oasis.opendocument.spreadsheet   ods;application/vnd.oasis.opendocument.text          odt;application/vnd.openxmlformats-officedocument.presentationml.presentationpptx;application/vnd.openxmlformats-officedocument.spreadsheetml.sheetxlsx;application/vnd.openxmlformats-officedocument.wordprocessingml.documentdocx;application/vnd.wap.wmlc                         wmlc;application/wasm                                 wasm;application/x-7z-compressed                      7z;application/x-cocoa                              cco;application/x-java-archive-diff                  jardiff;application/x-java-jnlp-file                     jnlp;application/x-makeself                           run;application/x-perl                               pl pm;application/x-pilot                              prc pdb;application/x-rar-compressed                     rar;application/x-redhat-package-manager             rpm;application/x-sea                                sea;application/x-shockwave-flash                    swf;application/x-stuffit                            sit;application/x-tcl                                tcl tk;application/x-x509-ca-cert                       der pem crt;application/x-xpinstall                          xpi;application/xhtml+xml                            xhtml;application/xspf+xml                             xspf;application/zip                                  zip;application/octet-stream                         bin exe dll;application/octet-stream                         deb;application/octet-stream                         dmg;application/octet-stream                         iso img;application/octet-stream                         msi msp msm;audio/midi                                       mid midi kar;audio/mpeg                                       mp3;audio/ogg                                        ogg;audio/x-m4a                                      m4a;audio/x-realaudio                                ra;video/3gpp                                       3gpp 3gp;video/mp2t                                       ts;video/mp4                                        mp4;video/mpeg                                       mpeg mpg;video/quicktime                                  mov;video/webm                                       webm;video/x-flv                                      flv;video/x-m4v                                      m4v;video/x-mng                                      mng;video/x-ms-asf                                   asx asf;video/x-ms-wmv                                   wmv;video/x-msvideo                                  avi;
}

6. 在配置文件测试期间禁止显示非错误消息

[root@RockyLinux9 ~]# nginx -q
[root@RockyLinux9 ~]# echo $?
0

7. 启动时指定全局配置项(需为配置文件中未设置项),格式:k v;

# 原配置显示进程
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4680       1  0 21:49 ?        00:00:00 nginx: master process nginx
nginx       4681    4680  0 21:49 ?        00:00:00 nginx: worker process# 停止服务
[root@RockyLinux9 ~]# nginx -s stop# 注释如下两行
[root@RockyLinux9 ~]# vim /usr/local/nginx/conf/nginx.conf
#worker_processes  1;   
#pid    run/nginx.pid;# 新pid文件不存在
[root@RockyLinux9 ~]# ll /var/run/nginx.pid
ls: cannot access '/var/run/nginx.pid': No such file or directory# 执行pid文件,指定进程数
[root@RockyLinux9 ~]# nginx -g "pid /var/run/nginx.pid; worker_processes 2;"
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4698       1  0 21:58 ?        00:00:00 nginx: master process nginx -g pid /var/run/nginx.pid; worker_processes 2;
nginx       4699    4698  0 21:58 ?        00:00:00 nginx: worker process
nginx       4700    4698  0 21:58 ?        00:00:00 nginx: worker process
[root@RockyLinux9 ~]# ll /var/run/nginx.pid
-rw-r--r--. 1 root root 5 May 10 21:58 /var/run/nginx.pid

信号

        向主进程发送信号

1. 快速关闭

    • nginx -s stop
    • kill -INT/TERM 主进程PID
#启动程序
[root@RockyLinux9 ~]# nginx#查看进程
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4733       1  0 22:12 ?        00:00:00 nginx: master process nginx
nginx       4734    4733  0 22:12 ?        00:00:00 nginx: worker process
nginx       4735    4733  0 22:12 ?        00:00:00 nginx: worker process
root        4737    4591  0 22:12 pts/0    00:00:00 grep --color=auto nginx# 快速关闭程序,无论进程是否有连接,都会直接断开
[root@RockyLinux9 ~]# nginx -s stop# 确认
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4740    4591  0 22:12 pts/0    00:00:00 grep --color=auto nginx[root@RockyLinux9 ~]# nginx
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1517       1  0 23:47 ?        00:00:00 nginx: master process nginx
nginx       1518    1517  0 23:47 ?        00:00:00 nginx: worker process
nginx       1519    1517  0 23:47 ?        00:00:00 nginx: worker process
root        1530    1408  0 23:52 pts/0    00:00:00 grep --color=auto nginx
[root@RockyLinux9 ~]# kill -INT 1517
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1535    1408  0 23:52 pts/0    00:00:00 grep --color=auto nginx[root@RockyLinux9 ~]# nginx
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1537       1  0 May10 ?        00:00:00 nginx: master process nginx
nginx       1538    1537  0 May10 ?        00:00:00 nginx: worker process
nginx       1539    1537  0 May10 ?        00:00:00 nginx: worker process
root        1568    1408  0 00:05 pts/0    00:00:00 grep --color=auto nginx
[root@RockyLinux9 ~]# kill -TERM 1537
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1570    1408  0 00:05 pts/0    00:00:00 grep --color=auto nginx

2. 优雅的关闭

  • nginx -s quit
  • kill -QUIT 主进程PID
# 创建一个1G的测试文件
[root@RockyLinux9 ~]# dd if=/dev/zero of=/usr/local/nginx/html/Linuxjsz bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 3.11659 s, 345 MB/s# 通过客户端访问的方式进行文件下载
[root@RockyLinux9 ~]# wget http://192.168.199.152/Linuxjsz
Connecting to 192.168.199.152:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1073741824 (1.0G) [application/octet-stream]
Saving to: ‘Linuxjsz’
Linuxjsz            100%[=====================>]   1.00G  147MB/s  in 7.4s22:41:54 (139 MB/s) - ‘Linuxjsz’ saved [1073741824/1073741824]
# 查看进程情况,正常运行中
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4824       1  0 22:41 ?        00:00:00 nginx: master process nginx
nginx       4825    4824  0 22:41 ?        00:00:00 nginx: worker process
nginx       4826    4824  0 22:41 ?        00:00:00 nginx: worker process
root        4828    4591  0 22:41 pts/0    00:00:00 grep --color=auto nginx# 下载过程中发送quit信号
[root@RockyLinux9 ~]# nginx -s quit# 查看进程情况,此时其中一个worker进程已关闭,而存在进程处于即将关闭状态
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4824       1  0 22:41 ?        00:00:00 nginx: master process nginx
nginx       4825    4824  3 22:41 ?        00:00:00 nginx: worker process is shutting down
root        4831    4591  0 22:41 pts/0    00:00:00 grep --color=auto nginx# 查看进程情况,此时nginx程序已关闭
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4833    4591  0 22:42 pts/0    00:00:00 grep --color=auto nginx[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1641       1  0 00:12 ?        00:00:00 nginx: master process nginx
nginx       1642    1641  0 00:12 ?        00:00:00 nginx: worker process
nginx       1643    1641  0 00:12 ?        00:00:00 nginx: worker process
root        1645    1408  0 00:12 pts/0    00:00:00 grep --color=auto nginx
[root@RockyLinux9 ~]# kill -QUIT 1641
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1641       1  0 00:12 ?        00:00:00 nginx: master process nginx
nginx       1643    1641  0 00:12 ?        00:00:00 nginx: worker process is shutting down
root        1756    1408  0 00:13 pts/0    00:00:00 grep --color=auto nginx

3. 重新加载配置文件,启动新的工作进程,优雅的关闭旧进程

  • nginx -s reload
  • kill -HUP 主进程PID
# 查看进程情况
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4751       1  0 22:22 ?        00:00:00 nginx: master process nginx
nginx       4752    4751  0 22:22 ?        00:00:00 nginx: worker process
nginx       4753    4751  0 22:22 ?        00:00:00 nginx: worker process
root        4810    4591  0 22:30 pts/0    00:00:00 grep --color=auto nginx# 发送reload信号
[root@RockyLinux9 ~]# nginx -s reload# 查看进程情况,发现主进程未发生变化,而两个worker进程的pid更改了,启动时间也发生了变化
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        4751       1  0 22:22 ?        00:00:00 nginx: master process nginx
nginx       4812    4751  0 22:30 ?        00:00:00 nginx: worker process
nginx       4813    4751  0 22:30 ?        00:00:00 nginx: worker process
root        4815    4591  0 22:30 pts/0    00:00:00 grep --color=auto nginx[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1761       1  0 00:16 ?        00:00:00 nginx: master process nginx
nginx       1762    1761  0 00:16 ?        00:00:00 nginx: worker process
nginx       1763    1761  0 00:16 ?        00:00:00 nginx: worker process
root        1765    1408  0 00:16 pts/0    00:00:00 grep --color=auto nginx
[root@RockyLinux9 ~]# kill -HUP 1761
[root@RockyLinux9 ~]# ps -ef|grep nginx
root        1761       1  0 00:16 ?        00:00:00 nginx: master process nginx
nginx       1766    1761  0 00:17 ?        00:00:00 nginx: worker process
nginx       1767    1761  0 00:17 ?        00:00:00 nginx: worker process
root        1769    1408  0 00:17 pts/0    00:00:00 grep --color=auto nginx

4. 重新生成日志文件。可用于定期备份日志文件

  • nginx -s reopen
  • kill -USR1 主进程PID
# 查看日志文件
[root@RockyLinux9 ~]# ll -h /usr/local/nginx/logs/
total 12K
-rw-r--r--. 1 root root 4.0K May 10 22:23 access.log
-rw-r--r--. 1 root root 1.8K May 10 22:22 error.log
-rw-r--r--. 1 root root    5 May 10 22:22 nginx.pid# 修改日志名称
[root@RockyLinux9 ~]# mv /usr/local/nginx/logs/access.log{,.bak}
[root@RockyLinux9 ~]# ll -h /usr/local/nginx/logs/
total 12K
-rw-r--r--. 1 root root 4.0K May 10 22:23 access.log.bak# 通过浏览器访问页面,显示访问日志还是写入到了原文件中
[root@RockyLinux9 ~]# ll -h /usr/local/nginx/logs/
total 16K
-rw-r--r--. 1 root root 4.4K May 10 22:27 access.log.bak# 发送reopen信号,新创建了一个日志文件,再访问页面,日志则被写入到了新文件中
[root@RockyLinux9 ~]# nginx -s reopen
[root@RockyLinux9 ~]# ll -h /usr/local/nginx/logs/
total 16K
-rw-r--r--. 1 nginx root    0 May 10 22:28 access.log
-rw-r--r--. 1 root  root 4.4K May 10 22:27 access.log.bak
[root@RockyLinux9 ~]# ll -h /usr/local/nginx/logs/
total 20K
-rw-r--r--. 1 nginx root  466 May 10 22:28 access.log
-rw-r--r--. 1 root  root 4.4K May 10 22:27 access.log.bak
  • 有关与kill命令其他信号控制参数,会在《Nginx升级和回滚》章节进行演示操作。

来自: 学习Nginx(三):命令与信号

相关文章:

学习Nginx(三):命令与信号

命令及选项 1. 显示帮助信息: [rootRockyLinux9 ~]# nginx -h nginx version: nginx/1.26.0 Usage: nginx [-?hvVtTq] [-s signal] [-p prefix][-e filename] [-c filename] [-g directives]选项:-?,-h : 显示帮助信息-v : 显示版本信息-V …...

软信天成:业务流程管理驱动企业数字化转型

近日,在国家发展改革委办公厅、国家数据局综合司联合印发的《数字经济2024年工作要点》中,明确强调了本年度大力推进重点领域数字化转型,营造数字化转型生态的战略举措,标志着国家对于企业数字化转型的高度重视与积极倡导。 企业…...

「Python绘图」绘制同心圆

python 绘制同心圆 一、预期结果 二、核心代码 import turtle print("开始绘制同心圆") # 创建Turtle对象 pen turtle.Turtle() pen.shape("turtle") # 移动画笔到居中位置 pen.pensize(2) #设置外花边的大小 # 设置填充颜色 pen.fillcolor("green&…...

Unity基础

概述 基础知识 3D教学 数学计算公共类Mathf 练习: 三角函数 练习: Unity中的坐标系 Vector3向量 向量模长和单位向量 向量加减乘除 练习: 向量点乘 向量叉乘 向量插值运算 Quaternion四元数 为何要使用四元数 四元数是什么 四元数常用方法 四元数计算 练…...

OpenHarmony 实战开发——ArkUI canvas组件

canvas 是 ArkUI 开发框架里的画布组件,常用于自定义绘制图形。因为其轻量、灵活、高效等优点,被广泛应用于 UI 界面开发中。本期,我们将为大家介绍 ArkUI 开发框架中 canvas 组件的使用。 一、canvas 介绍 1.1 什么是 canvas? …...

js积累一(ipv4正则校验+弹窗方式)

1. ipv4地址,点分十进制的校验 var regexIP /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/; if(strRegex.test(ip)) //true: 通过 2. 三种弹窗方式: alert();confirm(); prompt() 1&a…...

【Android】重写onClick方法时,显示Method does not override method from its supperclass

问题 重写onClick方法时,显示Method does not override method from its supperclass 解决 在类上加implements View.OnClickListener...

LeetCode 第397场周赛个人题解

目录 100296. 两个字符串的排列差 原题链接 思路分析 AC代码 100274. 从魔法师身上吸取的最大能量 原题链接 思路分析 AC代码 100281. 矩阵中的最大得分 原题链接 思路分析 AC代码 100312. 找出分数最低的排列 原题链接 思路分析 AC代码 100296. 两个字符串的排…...

Mysql数据库二进制日志导致磁盘满了处理过程

数据库的二进制日志是数据库管理系统(DBMS)用来记录所有对数据库进行修改的操作的记录。这种日志对于数据库的备份、恢复、复制和审计等操作至关重要。 以MySQL数据库为例,二进制日志(Binary Log)记录了所有更改数据的…...

前端面试题日常练-day07 【面试题】

题目 希望这些选择题能够帮助您进行前端面试的准备,答案在文末。 1. 在 JavaScript 中,以下哪个方法可以用于从数组的末尾添加一个或多个元素? A) push() B) pop() C) shift() D) unshift()2. 下列哪个 HTML 标签用于定义表格的表头&#…...

Uniapp H5开发常见问题解析

引言 在移动应用开发领域,Uniapp已经成为一个备受瞩目的技术框架,其跨平台能力和高效开发特性使得开发者能够更加便捷地构建出功能丰富、性能优越的应用程序。特别是在H5开发中,Uniapp的应用场景日益广泛,然而,随之而…...

QT状态机4-使用并行状态来避免组合爆炸

#include "MainWindow.h" #include "ui_MainWindow.h"MainWindow::MainWindow(QWidget *parent):...

MemoryModule - 应用编程细节

文章目录 MemoryModule - 应用编程细节概述笔记实验环境升级MemoryModule,在上下文中加入DLL在内存载入前的信息MemoryModule.hMemoryModule.cpp实现接口MemoryGetPayload() 整理 - 在内存载入的DLL中,取得资源表中的信息,取得载入前的DLL内容…...

Java程序CPU持续高,如何排查?

首先找到进程ID jps然后找到该进程用占用cpu高的线程 top -Hp 进程ID将线程ID转化为十六进制 printf “0x%x” 线程ID使用jstack 工具跟踪堆栈定位问题 jstack 进程ID | grep 十六进制线程ID -A 5说明,最后-A 5是打印出来后5行。...

(Java)心得:LeetCode——15.三数之和

一、原题 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i ! j、i ! k 且 j ! k ,同时还满足 nums[i] nums[j] nums[k] 0 。请你返回所有和为 0 且不重复的三元组。 注意:答案中不可以包含重复的三元组。…...

Rust中忽略JSON反序列化时的不必要字段

在Rust中处理JSON数据时,经常会遇到JSON数据中包含一些在目标数据结构中不存在的字段的情况。如果你使用的是serde和serde_json这两个流行的库来处理JSON,那么有一些简单的方法可以忽略这些不必要的字段。 默认行为:忽略未知字段 在Rust中&…...

UDP多对多组播通信

广播和多播仅应用于UDP。TCP是一个面向连接的协议,TCP一定是点对点的,一点是两个主机来建立连接的,TCP肯定是单播。只有UDP才会使用广播和组播。 如下示例实现一个UDP多对多的组播通信,进程中有收、发两个线程,分别表…...

Linux技术---部署PXE服务器实现批量安装操作系统

部署PXE服务器实现批量安装操作系统 部署PXE服务器实现批量安装操作系统 部署PXE服务器实现批量安装操作系统1.安装相关服务组件1.1 安装tftp和xinetd1.2 安装DHCP服务1.3 准备 Linux 内核、初始化镜像文件、 PXE 引导程序、安装FTP服务并准备安装源1.4 配置启动菜单文件1.5 验…...

日志:打印技巧

一、概览 Unity日志打印技巧 常规日志打印彩色日志日志存储与上传日志开关日志双击溯源 二、常规日志打印 1、打印Hello World 调用堆栈可以很好的帮助我们定位问题,特别是报错的Error日志 Debug.Log("Hello World");Debug.Log("This is a log m…...

二叉树的常见操作

建立树 复制二叉树 计算深度 计算总结点数 计算叶子结点数...

CSS 根据子元素选择父元素,并设置父元素的样式

场景举例&#xff1a;当子元素有增加了一个class时&#xff0c;需要影响其父元素的样式 可以使用":has"伪类来实现选择父元素的效果 <style>.parent:has(.child){background-color: #eee;}p{width:100px;border:1px solid #000;} </style> <body>…...

onnx转trt时,关于动态shape自动配置默认值的脚本

onnx转trt时&#xff0c;关于动态shape自动配置默认值&#xff0c;一般需要指定3个shape&#xff0c;分别是最小最优与最大。但是我们在测试时不想写那么多的代码&#xff0c;能否自动实现3个shape的配置&#xff0c;这里实现了一版。 import osimport tensorrt as trt import…...

实验室无法培养的菌,原来可以这么研究!

厌氧氨氧化&#xff08;anammox&#xff09;细菌在全球氮循环和废水氮去除中发挥着至关重要的作用&#xff0c;由于anammox细菌生长缓慢、难以培养等特点&#xff0c;对其生态学和生物学特性知之甚少。近日&#xff0c;凌恩生物合作客户重庆大学陈猷鹏教授团队在《Science of t…...

Xed编辑器开发第一期:使用Rust从0到1写一个文本编辑器

这是一个使用Rust实现的轻量化文本编辑器。学过Rust的都知道&#xff0c;Rust 从入门到实践中间还隔着好几个Go语言的难度&#xff0c;因此&#xff0c;如果你也正在学习Rust,那么恭喜你&#xff0c;这个项目被你捡到了。本项目内容较多&#xff0c;大概会分三期左右陆续发布&a…...

农业自动气象监测站:赋能智慧农业的新动力

在信息化、智能化快速发展的今天&#xff0c;农业领域也迎来了前所未有的变革。其中&#xff0c;农业自动气象监测站作为智慧农业的重要组成部分&#xff0c;正在发挥着越来越重要的作用。它们如同农业生产的“眼睛”和“耳朵”&#xff0c;实时感知和记录着大气的微妙变化&…...

2-6 任务 猜数小游戏(单次版)

本任务要求编写一个猜数小游戏&#xff08;单次版&#xff09;&#xff0c;游戏规则是计算机产生一个0到100之间的随机整数&#xff0c;用户通过输入猜测的数字进行猜测&#xff0c;根据猜测情况给出提示&#xff0c;直到猜对为止。编程思路是利用while循环和多分支结构实现永真…...

springboot 定时任务解决方案

Scheduled (springboot 自带的 注解) 基于注解Scheduled默认为单线程&#xff0c;开启多个任务时&#xff0c;任务的执行时机会受上一个任务执行时间的影响。 EnableScheduling注解&#xff1a; 在配置类上使用&#xff0c;开启计划任务的支持&#xff08;类上&#xff09;。…...

谷粒商城实战(024 业务-订单模块-分布式事务1)

Java项目《谷粒商城》架构师级Java项目实战&#xff0c;对标阿里P6-P7&#xff0c;全网最强 总时长 104:45:00 共408P 此文章包含第284p-第p290的内容 简介 模拟积分服务出异常&#xff0c;前方的锁库存事务未回滚&#xff0c;这时候就需要分布式事务 本地事务 事务的隔离…...

.NET使用Microsoft.IdentityModel.Tokens对SAML2.0登录断言校验

如题。使用SAML单点登录对IDP返回的Response断言使用微软提供的Microsoft.IdentityModel.Tokens对断言&#xff08;Assertion&#xff09;进行校验。 首先需要安装Muget包&#xff0c;Microsoft.IdentityModel.Tokens和Microsoft.IdentityModel.Tokens.Saml。 简易示例代码如…...

性能测试学习二

瓶颈的精准判断 TPS曲线 tps图 响应时间图 拐点在哪里呢? 这是一个阶梯式增加的场景,拐点在第二个压力阶梯上就出现了,因为响应时间增加了,tps增加的却不多,在第三个阶段时,tps增加的就更少了,响应时间也在不断增加,所以性能瓶颈在加剧,越往后越明显【tps的增长,…...