Nginx四层负载均衡

news2024/9/22 13:44:49

1、Nginx四层负载均衡

1.1 负载均衡概述

负载均衡是一种分布式计算技术,用于将网络流量和用户请求分散到多台服务器上,以此来提高网络服务的可用性和可靠性。它通过优化资源使用、最大化吞吐量以及最小化响应时间,增强了网络、服务器和数据中心的伸缩性和灵活性。

Nginx的负载均衡功能主要通过其反向代理模式实现。当客户端发送请求到Nginx服务器时,Nginx会根据预设的负载均衡策略将请求转发给后端服务器,并将后端服务器的响应返回给客户端。Nginx作为代理服务器,有效地分摊了请求压力,提高了系统的处理能力。

1.2 负载均衡的目的

提高可用性:通过将请求分散到多个服务器,即使部分服务器出现故障,整个系统仍然可以继续提供服务。

增强性能:负载均衡可以提高系统处理大量并发请求的能力,从而提升整体性能。

故障转移:当一台服务器发生故障时,负载均衡器可以自动将流量转移到其他健康的服务器上,以避免服务中断。

降低延迟:通过选择最佳的服务器来处理请求,减少数据传输的延迟。

资源优化:合理分配请求到各个服务器,避免某些服务器过载而其他服务器空闲,优化资源使用。

1.3 Nginx的负载均衡调度算法

1.3.1 轮询(Round Robin)
  • 轮询是最简单的负载均衡算法,它将请求按顺序分发到每个服务器。当一个请求被发送到一个服务器后,下一个请求将被发送到列表中的下一个服务器。这种方法简单易行使用,但可能不适合所有场景,特别是当某些服务器的处理能力不同时。

1.3.2 最少连接(Least Connections)
  • 最少的连接算法将请求发送到当前连接数最少的服务器。这种方法可以更有效地利用服务器资源,因为它完全避免过载服务器。然而,这种方法可能会导致负载不均衡,特别是在服务器性能差异方面更大的情况发生。

1.3.3 IP哈希(IP Hash)
  • IP哈希算法根据客户端的IP地址哈希值将请求发送到服务器。该方法可以保证来自相同客户端的这种请求总是被发送到相同服务器,这对于需要会话保持的应用程序很有用。该方法可能会导致负载不均衡,特别是在服务器数量变化时。

1.3.4 加权轮询(Weighted Round Robin)
  • 加权轮询是轮询算法的一个变体,它允许为每个服务器分配重权。权重损失的服务器将接收到更多的请求。这种方法可以根据服务器的性能和负载情况动态调整负载分配。

1.4.5 加权最少连接(Weighted Least Connections)
  • 加权最小连接算法结合了最小连接和加权轮询的概念。它根据服务器的权重和当前连接数来选择服务器,以实现更平衡的负载分配。

1.3.6 哈希(Hash)
  • 哈希算法根据请求的某些属性(如 URL 或请求头)来选择服务器。这种方法可以保证相同的请求总是被发送到相同的服务器,但需要注意的是,如果服务器数量发生变化,可能会导致负载不均衡。

1.4 Nginx四层负载均衡基本配置

 

 1.4.1 后端主机配置
 1.4.1.1 web-01配置
[root@web-01 ~]# mkdir -p /nginx/web
[root@web-01 ~]# echo "This is `hostname` IP=`hostname -I`" >> /nginx/web/index.html
[root@web-01 ~]# vim /etc/nginx/conf.d/VirtualHost.conf 
server {
        listen 192.168.110.32:80;
        root /nginx/web;
​
        location /{
                index index.html;
        }
}      
​
[root@web-01 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-01 ~]# nginx -s reload
[root@web-01 ~]# curl 192.168.110.32
This is web-01 IP=192.168.110.32 
1.4.1.2 web-02配置
[root@web-02 ~]# mkdir -p /nginx/web
[root@web-02 ~]# echo "This is `hostname` IP=`hostname -I`" >> /nginx/web/index.html
[root@web-02 ~]# vim /etc/nginx/conf.d/VirtualHost.conf
server {
        listen 192.168.110.33:80;
        root /nginx/web;
​
        location /{
                index index.html;
        }
}
​
[root@web-02 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-02 ~]# nginx -s reload
[root@web-02 web]# curl 192.168.110.33
This is web-02 IP=192.168.110.33 
 1.4.1.3 web-03配置
[root@web-03 ~]# mkdir -p /nginx/web
[root@web-03 ~]# echo "This is `hostname` IP=`hostname -I`" >> /nginx/web/index.html
[root@web-03 ~]# vim /etc/nginx/conf.d/VirtualHost.conf
server {
        listen 192.168.110.34:80;
        root /nginx/web;
​
        location /{
                index index.html;
        }
}
​
[root@web-03 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-03 ~]# nginx -s reload
[root@web-03 ~]# curl 192.168.110.34:80
This is web-03 IP=192.168.110.34 
 1.4.2 代理服务器配置
[root@proxy ~]# vim /etc/nginx/conf.d/proxy.conf
upstream wwwPools {
        server 192.168.110.32;
        server 192.168.110.33;
        server 192.168.110.34;
}
​
server {        
        location / {     
        proxy_pass http://wwwPools;              
        }
}
​
[root@proxy ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@proxy ~]# nginx -s reload
 1.4.3 客户端端访问测试
[root@client ~]# for ((i=1;i<=9;i++)); do curl http://www.proxy.com; done   #默认算法为RR
This is web-01 IP=192.168.110.32 
This is web-02 IP=192.168.110.33 
This is web-03 IP=192.168.110.34 
This is web-01 IP=192.168.110.32 
This is web-02 IP=192.168.110.33 
This is web-03 IP=192.168.110.34 
This is web-01 IP=192.168.110.32 
This is web-02 IP=192.168.110.33 
This is web-03 IP=192.168.110.34 
1.4.4 upstream模块参数解释

server  :定义后端服务器的IP地址或域名,可选地指定端口号,默认为80端口。
weight :服务器权重,默认为1。权重越高,处理的请求比例越大。
max fails :Nginx尝试连接后端服务器失败的次数,默认为1。超过此次数,Nginx将服务器标记为失败。
fail timeout : 在max fails定义的失败次数后,距离下次检查的间隔时间,默认为10秒。
backup : 热备配置,仅当所有激活的服务器失败后,请求才会被转发到标记为backup的服务器。
down  :标记服务器永远不可用,通常用于维护或测试。配合ip_hash使用时,服务器不能被标记为down。

1.4.5 增加权重
[root@proxy ~]# vim /etc/nginx/conf.d/proxy.conf
upstream wwwPools {
        server 192.168.110.32 weight=1;
        server 192.168.110.33 weight=2;
        server 192.168.110.34 weight=3 down;
}
​
server {
        location / {
        proxy_pass http://wwwPools;
        }
}
​
[root@proxy ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@proxy ~]# nginx -s reload

访问测试

[root@client ~]# for ((i=1;i<=9;i++)); do curl http://www.proxy.com; done  #web-01和web-02为2:1 ,web-03处于维护中
This is web-02 IP=192.168.110.33 
This is web-01 IP=192.168.110.32 
This is web-02 IP=192.168.110.33 
This is web-02 IP=192.168.110.33 
This is web-01 IP=192.168.110.32 
This is web-02 IP=192.168.110.33 
This is web-02 IP=192.168.110.33 
This is web-01 IP=192.168.110.32 
This is web-02 IP=192.168.110.33 

1.5 多台虚拟主机之间基于端口实现负载均衡

1.5.1 后端主机配置
1.5.1.1 web-01配置
[root@web-01 ~]# echo "This is `hostname` IP:`hostname -I` port=80" >> /nginx/web/index80.html
[root@web-01 ~]# echo "This is `hostname` IP:`hostname -I` port=81" >> /nginx/web/index81.html
[root@web-01 ~]# echo "This is `hostname` IP:`hostname -I` port=82" >> /nginx/web/index82.html
[root@web-01 ~]# vim /etc/nginx/conf.d/VirtualHost.conf 
server {
        listen 192.168.110.32:80;
        root /nginx/web;
​
        location /{ 
                index index80.html;
        }
}
​
server {
        listen 192.168.110.32:81;
        root /nginx/web;
​
        location /{
                index index81.html;
        }
}
​
server {
        listen 192.168.110.32:82;
        root /nginx/web;
​
        location /{
                index index82.html;
        }
}
​
[root@web-01 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-01 ~]# nginx -s reload
[root@web-01 ~]# curl 192.168.110.32:80
This is web-01 IP:192.168.110.32  port=80
[root@web-01 ~]# curl 192.168.110.32:81
This is web-01 IP:192.168.110.32  port=81
[root@web-01 ~]# curl 192.168.110.32:82
This is web-01 IP:192.168.110.32  port=82
1.5.1.2 web-02配置
[root@web-02 web]# echo "This is `hostname` IP:`hostname -I` port=80" >> /nginx/web/index80.html
[root@web-02 web]# echo "This is `hostname` IP:`hostname -I` port=81" >> /nginx/web/index81.html
[root@web-02 web]# echo "This is `hostname` IP:`hostname -I` port=82" >> /nginx/web/index82.html
[root@web-02 web]# vim /etc/nginx/conf.d/VirtualHost.conf 
server {
        listen 192.168.110.33:80;
        root /nginx/web;
​
        location / {
                index index80.html;
        }
}
​
server {
        listen 192.168.110.33:81;
        root /nginx/web;
​
        location / {
                index index81.html;
        }
}
​
server {
        listen 192.168.110.33:82;
        root /nginx/web;
​
        location / {
                index index82.html;
        }
}
​
​
[root@web-02 web]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-02 web]# nginx -s reload
[root@web-02 ~]# curl 192.168.110.33:80
This is web-02 IP:192.168.110.33  port=80
[root@web-02 ~]# curl 192.168.110.33:81
This is web-02 IP:192.168.110.33  port=81
[root@web-02 ~]# curl 192.168.110.33:82
This is web-02 IP:192.168.110.33  port=82
1.5.1.3 web-03配置
[root@web-03 ~]# echo "This is `hostname` IP:`hostname -I` port=80" >> /nginx/web/index80.html
[root@web-03 ~]# echo "This is `hostname` IP:`hostname -I` port=81" >> /nginx/web/index81.html
[root@web-03 ~]# echo "This is `hostname` IP:`hostname -I` port=82" >> /nginx/web/index82.html
[root@web-03 ~]# vim /etc/nginx/conf.d/VirtualHost.conf 
server {
        listen 192.168.110.34:80;
        root /nginx/web;
​
        location / {
                index index80.html;
        }
}
​
server {
        listen 192.168.110.34:81;
        root /nginx/web;
​
        location / {
                index index81.html;
        }
}
​
server {
        listen 192.168.110.34:82;
        root /nginx/web;
​
        location / {
                index index82.html;
        }
}
​
[root@web-03 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-03 ~]# nginx -s reload
[root@web-03 ~]# curl 192.168.110.34:80
This is web-03 IP:192.168.110.34  port=80
[root@web-03 ~]# curl 192.168.110.34:81
This is web-03 IP:192.168.110.34  port=81
[root@web-03 ~]# curl 192.168.110.34:82
This is web-03 IP:192.168.110.34  port=82
1.5.2 代理服务器配置
[root@proxy ~]# vim /etc/nginx/conf.d/proxy.conf 
upstream wwwPools {
        server 192.168.110.32:80;
        server 192.168.110.33:80;
        server 192.168.110.34:80;
        server 192.168.110.32:81;
        server 192.168.110.33:81;
        server 192.168.110.34:81;
        server 192.168.110.32:82;
        server 192.168.110.33:82;
        server 192.168.110.34:82;
​
}
​
server {
        location / {
        proxy_pass http://wwwPools;
        }
}
​
[root@proxy ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@proxy ~]# nginx -s reload
1.5.3 客户端访问测试
[root@client ~]# for ((i=1;i<=12;i++)); do curl http://www.proxy.com; done
This is web-01 IP:192.168.110.32  port=80
This is web-02 IP:192.168.110.33  port=80
This is web-03 IP:192.168.110.34  port=80
This is web-01 IP:192.168.110.32  port=81
This is web-02 IP:192.168.110.33  port=81
This is web-03 IP:192.168.110.34  port=81
This is web-01 IP:192.168.110.32  port=82
This is web-02 IP:192.168.110.33  port=82
This is web-03 IP:192.168.110.34  port=82
This is web-01 IP:192.168.110.32  port=80
This is web-02 IP:192.168.110.33  port=80
This is web-03 IP:192.168.110.34  port=80

1.5 反向代理多虚拟主机节点服务器

1.5.1 模块主要参数

在 Nginx 的配置中使用 proxy_set_header 指令是为了在 Nginx 作为反向代理服务器时,向真实的后端服务器传递客户端的原始信息。以下是对 proxy_set_header 指令的详细解释,以及它如何影响代理请求:

proxy_set_header host $host;
这条指令的作用是:

proxy_set_header:这是 Nginx 用来设置由代理服务器发送给后端服务器的 HTTP 请求头的指令。

host:这是 HTTP 请求头中的一个字段,通常包含了客户端请求的原始主机信息,如域名或 IP 地址。

$host:这是 Nginx 变量,它代表客户端请求中的 Host 头部的值。

1.5.2 为什么需要 proxy_set_header host $host;

当 Nginx 作为反向代理时,它默认会将客户端的请求转发给配置好的后端服务器,但是在这个过程中,原始的 Host 请求头可能会丢失或被修改。这可能导致后端服务器无法正确识别客户端请求的虚拟主机,尤其是在后端服务器配置了多个虚拟主机时。

例如,如果客户端发送了一个带有 Host: www.yunjisuan.com 的请求,但是 Nginx 在转发请求时没有保留这个 Host 头部,后端服务器可能会默认提供一个它配置的第一个虚拟主机的响应,而不是客户端请求的那个特定的虚拟主机。

1.5.3 配置示例
1.5.3.1 web-01配置
[root@web-01 ~]# mkdir -p /nginx/web-{1..3}
[root@web-01 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-1" >> /nginx/web-1/index.html
[root@web-01 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-2" >> /nginx/web-2/index.html
[root@web-01 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-3" >> /nginx/web-3/index.html
[root@web-01 ~]# vim /etc/nginx/conf.d/VirtualHost.conf 
server {
        listen 192.168.110.32:80;
        server_name www.web-01.com;
        root /nginx/web-1;
​
        location /{ 
                index index.html;
        }
}
​
server {
        listen 192.168.110.32:80;
        server_name www.web-02.com;
        root /nginx/web-2;
​
        location /{
                index index.html;
        }
}
​
server {
        listen 192.168.110.32:80;
        server_name www.web-03.com;
        root /nginx/web-3;
​
        location /{
                index index.html;
        }
}
​
[root@web-01 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-01 ~]# nginx -s reload
1.5.3.2 web-02配置
[root@web-02 ~]# mkdir -p /nginx/web-{1..3}
[root@web-02 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-1" >> /nginx/web-1/index.html
[root@web-02 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-2" >> /nginx/web-2/index.html
[root@web-02 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-3" >> /nginx/web-3/index.html
[root@web-02 ~]# vim /etc/nginx/conf.d/VirtualHost.conf 
server {
        listen 192.168.110.33:80;
        server_name www.web-01.com;
        root /nginx/web-1;
​
        location /{ 
                index index.html;
        }
}
​
server {
        listen 192.168.110.33:80;
        server_name www.web-02.com;
        root /nginx/web-2;
​
        location /{
                index index.html;
        }
}
​
server {
        listen 192.168.110.33:80;
        server_name www.web-03.com;
        root /nginx/web-3;
​
        location /{
                index index.html;
        }
}
​
[root@web-02 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-02 ~]# nginx -s reload
1.5.3.3 web-03配置
[root@web-03 ~]# mkdir -p /nginx/web-{1..3}
[root@web-03 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-1" >> /nginx/web-1/index.html
[root@web-03 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-2" >> /nginx/web-2/index.html
[root@web-03 ~]# echo "This is `hostname`  IP=`hostname -I` dir=/nginx/web-3" >> /nginx/web-3/index.html
[root@web-03 ~]# vim /etc/nginx/conf.d/VirtualHost.conf
server {
        listen 192.168.110.34:80;
        server_name www.web-01.com;
        root /nginx/web-1;
​
        location /{ 
                index index.html;
        }
}
​
server {
        listen 192.168.110.34:80;
        server_name www.web-02.com;
        root /nginx/web-2;
​
        location /{
                index index.html;
        }
}
​
server {
        listen 192.168.110.34:80;
        server_name www.web-03.com;
        root /nginx/web-3;
​
        location /{
                index index.html;
        }
}
​
[root@web-03 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web-03 ~]# nginx -s reload
1.5.3.4 代理服务器配置(不加proxy_set_header host $host;)
[root@proxy ~]# vim /etc/nginx/conf.d/proxy.conf 
upstream wwwPools {
        server 192.168.110.32:80;
        server 192.168.110.33:80;
        server 192.168.110.34:80;
}
​
server {
        listen 80;
        server_name www.web-01.com;
​
        location / {
                proxy_pass http://wwwPools;
        }
}
​
server {
        listen 80;
        server_name www.web-02.com;
​
        location / {
                proxy_pass http://wwwPools;
        }
}
​
server {
        listen 80;
        server_name www.web-03.com;
​
        location / {
                proxy_pass http://wwwPools;
        }
}
​
[root@proxy ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@proxy ~]# nginx -s reload
1.5.3.5 客户端访问
[root@client ~]# echo '192.168.110.31 www.web-01.com www.web-02.com www.web-03.com' >> /etc/hosts   #添加hosts解析,ip为proxy的ip
[root@client ~]# for ((i=1;i<=3;i++)); do curl http://www.web-01.com; done
This is web-01  IP=192.168.110.32  dir=/nginx/web-1
This is web-02  IP=192.168.110.33  dir=/nginx/web-1
This is web-03  IP=192.168.110.34  dir=/nginx/web-1
[root@client ~]# for ((i=1;i<=3;i++)); do curl http://www.web-02.com; done
This is web-01  IP=192.168.110.32  dir=/nginx/web-1
This is web-02  IP=192.168.110.33  dir=/nginx/web-1
This is web-03  IP=192.168.110.34  dir=/nginx/web-1
[root@client ~]# for ((i=1;i<=3;i++)); do curl http://www.web-03.com; done
This is web-01  IP=192.168.110.32  dir=/nginx/web-1
This is web-02  IP=192.168.110.33  dir=/nginx/web-1
This is web-03  IP=192.168.110.34  dir=/nginx/web-1
​
注:无论访问那个域名,都是第一台虚拟主机提供服务

注意:若后端有多台虚拟主机如果不添加proxy_set_header host $host;的话代理服务器无法判断代理的是哪个虚拟主机,所以不管访问的是哪个域名返还的都是第一台虚拟主机的内容

1.5.3.6 代理服务器配置包含proxy_set_header host $host;
[root@proxy ~]# vim /etc/nginx/conf.d/proxy.conf 
upstream wwwPools {
        server 192.168.110.32:80;
        server 192.168.110.33:80;
        server 192.168.110.34:80;
}
​
server {
        listen 80;
        server_name www.web-01.com;
​
        location / {
                proxy_pass http://wwwPools;
                proxy_set_header host $host;
                proxy_set_header X-Forwarded-For $remote_addr;
        }
}
​
server {
        listen 80;
        server_name www.web-02.com;
​
        location / {
                proxy_pass http://wwwPools;
                proxy_set_header host $host;
                proxy_set_header X-Forwarded-For $remote_addr;
        }
}
​
server {
        listen 80;
        server_name www.web-03.com;
​
        location / {
                proxy_pass http://wwwPools;
                proxy_set_header host $host;
                proxy_set_header X-Forwarded-For $remote_addr;
        }
}
​
[root@proxy ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@proxy ~]# nginx -s reload

1.5.3.6 客户端访问
[root@client ~]# for ((i=1;i<=3;i++)); do curl http://www.web-01.com; done
This is web-01  IP=192.168.110.32  dir=/nginx/web-1
This is web-02  IP=192.168.110.33  dir=/nginx/web-1
This is web-03  IP=192.168.110.34  dir=/nginx/web-1
[root@client ~]# for ((i=1;i<=3;i++)); do curl http://www.web-02.com; done
This is web-01  IP=192.168.110.32  dir=/nginx/web-2
This is web-02  IP=192.168.110.33  dir=/nginx/web-2
This is web-03  IP=192.168.110.34  dir=/nginx/web-2
[root@client ~]# for ((i=1;i<=3;i++)); do curl http://www.web-03.com; done
This is web-01  IP=192.168.110.32  dir=/nginx/web-3
This is web-02  IP=192.168.110.33  dir=/nginx/web-3
This is web-03  IP=192.168.110.34  dir=/nginx/web-3
1.5.3.7 查看访问日志
[root@web-01 ~]# tail -3 /var/log/nginx/access.log
192.168.110.31 - - [21/Apr/2024:15:31:38 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
192.168.110.31 - - [21/Apr/2024:15:31:39 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
192.168.110.31 - - [21/Apr/2024:15:31:41 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
​
[root@web-02 ~]# tail -3 /var/log/nginx/access.log
192.168.110.31 - - [21/Apr/2024:15:31:38 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
192.168.110.31 - - [21/Apr/2024:15:31:39 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
192.168.110.31 - - [21/Apr/2024:15:31:41 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
​
[root@web-03 ~]# tail -3 /var/log/nginx/access.log
192.168.110.31 - - [21/Apr/2024:15:31:38 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
192.168.110.31 - - [21/Apr/2024:15:31:39 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"
192.168.110.31 - - [21/Apr/2024:15:31:41 +0800] "GET / HTTP/1.0" 200 52 "-" "curl/7.61.1" "192.168.110.35"

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2074884.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

资源受限的智能陷阱:集成TinyML的果蝇监控框架

这篇论文的标题是《Resource-Constrained Intelligent Trap: Fruit Flies Surveillance Framework with TinyML Integration》&#xff0c;作者是Quan Minh Nguyen、Minh Nhat Lai、Vu Thanh Le和Hien Bich Vo。论文介绍了一种资源受限的智能陷阱系统&#xff0c;用于监测和控制…

开放式耳机什么牌子好用?五款备受赞誉的单品推荐

开放式耳机设计不堵耳道&#xff0c;让用户听歌或打电话时还能听到周围的声音&#xff0c;这对喜欢户外运动的人很好。这种耳机戴着稳&#xff0c;舒服&#xff0c;也更安全。根据我自己的试戴体验&#xff0c;我挑出了几款不错的开放式耳机。接下来&#xff0c;让我们一起探讨…

【办公类-54-01】20240826每周安排文件夹制作

背景需求&#xff1a; 今天开始上班了&#xff0c;做开学前准备。我先整理电脑&#xff0c;然后把一些文件夹搭建好。 桌面上有一个超链接文件夹 作为通讯上报员&#xff0c;每周我都要保存每周的周计划安排表(包含每周五天活动内容和通讯文章&#xff09; 以上学期为例 每个…

来自DeepSeek:形式化证明的RL框架

今天为大家带来来自DeepSeek(DS)的一篇内容详实且思想完备的形式化证明强化学习框架。 因篇幅有限&#xff0c;文中的预训练及SFT阶段不做展开&#xff0c;仅对文中的RLPAF的核心观点浅述&#xff1a; 为了在证明步骤生成中过程性引入中间策略状态&#xff0c;同时保持全证明生…

案例:LVS-DR模式

一、LVS-DR数据包流向分析 &#xff08;1&#xff09;客户端发送请求到 Director Server&#xff08;负载均衡器&#xff09;&#xff0c;请求的数据报文&#xff08;源 IP 是 CIP,目标 IP 是 VIP&#xff09;到达内核空间。 &#xff08;2&#xff09;Director Server 和 Real…

0、LVGL PC模拟器CodeBlocks

本篇文章目录导航 ♠♠ LVGL PC模拟器 ♣♣♣♣ 一、LVGL简介 ♦♦♦♦♦♦♦♦ 1.1 配置要求&#xff08;LVGL V9版本&#xff09; ♣♣♣♣ 二、LVGL PC模拟器 ♦♦♦♦♦♦♦♦ 2.1 CodeBlocks安装 ♦♦♦♦♦♦♦♦ 2.2 CodeBlocks环境包下载 ♦♦♦♦♦♦♦♦ 2.3 CodeBl…

【前端基础篇】JavaScript之BOM介绍

文章目录 浏览器对象模型&#xff08;BOM&#xff09;介绍1. 什么是BOM&#xff1f;2. Window 对象2.1 弹出框2.1.1 警告框2.1.2 确认框2.1.3 提示框 2.2 定时事件2.2.1 延时器2.2.2 定时器 2.3 Window 对象其他常用属性与方法2.3.1 获取窗口尺寸2.3.2 打开新窗口与关闭窗口2.3…

企业级数据采集解决方案:三步骤搞定大数据抓取

面对浩瀚如海的互联网数据&#xff0c;如何才能高效、准确地完成企业级数据采集&#xff1f;本文将揭秘一种简化大数据抓取的三步骤策略&#xff0c;助力企业与开发者轻松应对数据挑战&#xff0c;实现数据价值最大化。 正文&#xff1a; 在数字化转型的浪潮中&#xff0c;大…

【C/C++进阶】——文件操作之文本文件与二进制文件指针读写

【文件】——操作文件 目录 一&#xff1a;文件的定义 二&#xff1a;文件名 三&#xff1a;文件类型 3.1&#xff1a;二进制文件 3.2&#xff1a;文本文件 四&#xff1a;文件的打开与关闭 4.1&#xff1a;文件指针 4.2&#xff1a;文件的打开与关闭 五&#xff1a;…

【Stable Diffusion】ComfyUI-插件-IPAdapter图片融合

哈喽大家好&#xff0c;这期来分享下如何利用IPAdapter实现两张图的融合 参考图1 参考图2 融合图 图片融合 1、工作流 将基础工作流中的【IPAdapter Unified Loader】节点换成【IPAdapter Unified Loader Community】 【IPAdapter】节点换成【IPAdapter advanced】 【IPAd…

C语言指针详解(1)

目录 一、什么是指针 1.1、定义 1.2、取地址操作符&#xff08;&&#xff09; 1.3、指针变量和解引用操作符&#xff08;*&#xff09; 二、指针变量类型的意义 三、const修饰指针 3.1、const修饰变量 3.2、const修饰指针变量 3.2.1、const放在*的左边 3.2.2、 con…

docker的安装+docker镜像的基本操作

一&#xff0e;docker的介绍 1、Docker 是什么&#xff1f; Docker 是⼀个开源的应⽤容器引擎&#xff0c;可以实现虚拟化&#xff0c;完全采⽤“沙 盒”机制&#xff0c;容器之间不会存在任何接⼝。 Docker 通过 Linux Container&#xff08;容器&#xff09;技术将任意…

中秋节送礼推荐,数码好物精选推荐

中秋节将至&#xff0c;想要为家人或朋友准备一份特别的礼物吗&#xff1f;不妨考虑南卡Runner Pro5骨传导耳机。这款耳机不仅在功能上表现出色&#xff0c;而且设计独特&#xff0c;非常适合作为节日赠品。 卓越的性能&#xff0c;完美的体验 南卡Runner Pro5凭借其卓越的性…

移情别恋c++ ദ്ദി˶ー̀֊ー́ ) ——7.list(模拟实现)

1.前言 1.1list与vector的不同 区别&#xff1a;list的迭代器底层和其他两个迭代器底层有很大区别&#xff0c;因为list的链式结构决定了与它们两个的不一样 相同&#xff1a;迭代器用法大致一样&#xff0c;其他成员函数的使用也大致一样。 vector与list都是STL中非常重要的序…

关于安装hbase的问题(操作系统-windows)

&#x1f3c6;本文收录于《CSDN问答解惑-专业版》专栏&#xff0c;主要记录项目实战过程中的Bug之前因后果及提供真实有效的解决方案&#xff0c;希望能够助你一臂之力&#xff0c;帮你早日登顶实现财富自由&#x1f680;&#xff1b;同时&#xff0c;欢迎大家关注&&收…

快速学习“堆“排序(C语言数据结构)

前言&#xff1a; 堆的实现其实并不难&#xff0c;难的是要用堆实现排序&#xff0c;也就是堆的运用。 下面需要探究一下堆的排序是怎样的。 如何利用堆进行升序或者降序的排序。 "堆排序"&#xff1a; 原理&#xff1a; 例如&#xff1a;此时要将数组里的数组int a…

干货实用帖 | PARASOFT与JENKINS 插件集成

&#x1f4d6; 介绍&#xff1a; 本篇介绍如何使用Jenkins上的插件Parasoft Findings&#xff0c;应用到C/Ctest项目中。 ✅ 准备工作&#xff1a; Jenkins项目C/Ctest 10.4以上版本及有效的许可证 视频教学&#xff1a; Parasoft与Jenkins插件集成 安装插件&#xff1a; 首先…

Vue3 获取农历(阴历)日期,并封装日历展示组件

前言&#xff1a;哈喽&#xff0c;大家好&#xff0c;我是码喽的自我修养&#xff01;今天给大家分享vue3项目中使用 chinese-lunar-calendar 插件获取农历(阴历)日期&#xff0c;并封装了日历展示组件&#xff01;提供了具体的代码帮助大家深入理解&#xff0c;彻底掌握&#…

【舞动生命,营养护航】亨廷顿舞蹈症患者的维生素补给站

Hey小伙伴们~&#x1f44b; 在这个充满色彩的世界里&#xff0c;每个人都在以自己的方式绽放光彩。但你知道吗&#xff1f;有一群特别的朋友&#xff0c;他们面对着亨廷顿舞蹈症的挑战&#xff0c;却依然以不屈不挠的精神舞动着生命的旋律。&#x1f483;✨ 今天&#xff0c;就…

游戏如何对抗 IL2cppDumper逆向分析

众所周知&#xff0c;Unity引擎中有两种脚本编译器&#xff0c;分别是 Mono 和 IL2CPP 。相较于Mono&#xff0c;IL2CPP 具备执行效率高、跨平台支持等优势&#xff0c;已被大多数游戏采用。 IL2CPP 模式下&#xff0c;可以将游戏 C# 代码转换为 C 代码&#xff0c;然后编译为…