docker-centos中基于keepalived+niginx模擬主從熱備完整過程

文章目錄

  • 一、環境準備
  • 二、主機
    • 1、環境搭建
      • 1.1 鏡像拉取
      • 1.2 創建網橋
      • 1.3 啟動容器
      • 1.4 配置鏡像源
      • 1.5 下載工具包
      • 1.6 下載keepalived
      • 1.7 下載nginx
    • 2、配置
      • 2.1 配置keepalived
      • 2.2 配置nginx
        • 2.2.1 查看nginx.conf
        • 2.2.2 修改index.html
    • 3、啟動
      • 3.1 啟動nginx
      • 3.2 啟動keepalived
    • 4、狀態查看
    • 4.1 查看nginx狀態
      • 4.2 查看keepalived狀態
    • 4、停止
      • 4.1 停止nginx
      • 4.2 停止keepalived
  • 三、從機
    • 1、方法一:重復主機步驟
      • 1.1 將步驟 (1.2 創建網橋)改為如下:
      • 1.2 將步驟2.1 配置keepalived內容改為如下
      • 1.3 將步驟(2.2.2 修改index.html)修改網頁內容(可選)
    • 2、方法二:克隆主機虛擬機
      • 2.1 克隆完成、啟動虛擬機,修改網橋
        • 2.1.1 創建網橋
        • 2.1.2 啟動容器連接到創建的網橋
      • 2.2 修改keepalived的配置
  • 四、路由
    • 1、主機
      • 1.1 網卡情況
      • 1.2 查看路由
      • 1.3 添加路由
      • 1.4 最后路由表
    • 2、從機
      • 2.1 網卡情況
      • 2.2 查看路由
      • 2.3 添加路由
      • 2.4 最后路由情況
    • 3、宿主機(windows主機)
      • 3.1 添加路由

一、環境準備

根據宿主機的系統選擇安裝docker
??? ??? 🔗在Ubuntu中安裝docker
??? ??? 🔗在CentOS中安裝docker

二、主機

1、環境搭建

1.1 鏡像拉取

docker pull centos

1.2 創建網橋

docker network create -d=bridge --subnet=192.168.99.0/24 br2

1.3 啟動容器

docker run -it --name centos-1 --privileged -v /home/vac/linux:/mnt/software -p 9901:80 --net=br2 centos bash

1.4 配置鏡像源

找到目錄

cd /etc/yum.repos.d/

修改源

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

修改url

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

更新一下(時間較長)

yum -y update

1.5 下載工具包

ifconfig、route命令使用的net-tools工具包

yum -y install net-tools

vim編輯器

yum -y install vim

1.6 下載keepalived

yum -y install keepalived

1.7 下載nginx

yum -y install nginx

2、配置

2.1 配置keepalived

編輯keepalived.conf文件

vim /etc/keepalived/keepalived.conf

輸入以下內容

! Configuration File for keepalivedglobal_defs {#路由id:當前安裝keepalived節點主機的標識符,全局唯一router_id keep_150
}vrrp_instance VI_1 {# 表示的狀態,當前的130服務器為nginx的主節點,MASTER/BACKUPstate MASTER# 當前實例綁定的網卡interface eth0# 保證主備節點一致virtual_router_id 51# 優先級/權重,誰的優先級高,在MASTER掛掉以后,就能成為MASTERpriority 100# 主備之間同步檢查的時間間隔,默認1sadvert_int 1# 認證授權的密碼,防止非法節點的進入authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.200.17}
}

2.2 配置nginx

2.2.1 查看nginx.conf
vim /etc/nginx/nginx.conf

內容如下

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;events {worker_connections 1024;
}http {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  /var/log/nginx/access.log  main;sendfile            on;tcp_nopush          on;tcp_nodelay         on;keepalive_timeout   65;types_hash_max_size 2048;include             /etc/nginx/mime.types;default_type        application/octet-stream;# Load modular configuration files from the /etc/nginx/conf.d directory.# See http://nginx.org/en/docs/ngx_core_module.html#include# for more information.include /etc/nginx/conf.d/*.conf;server {listen       80 default_server;listen       [::]:80 default_server;server_name  _;root         /usr/share/nginx/html;# Load configuration files for the default server block.include /etc/nginx/default.d/*.conf;location / {}error_page 404 /404.html;location = /40x.html {}error_page 500 502 503 504 /50x.html;location = /50x.html {}}# Settings for a TLS enabled server.
#
#    server {
#        listen       443 ssl http2 default_server;
#        listen       [::]:443 ssl http2 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        ssl_certificate "/etc/pki/nginx/server.crt";
#        ssl_certificate_key "/etc/pki/nginx/private/server.key";
2.2.2 修改index.html
vim /usr/share/nginx/html/index.html

輸入以下內容

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>Test Page for the Nginx HTTP Server on Red Hat Enterprise Linux</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style type="text/css">/*<![CDATA[*/body {background-color: #fff;color: #000;font-size: 0.9em;font-family: sans-serif,helvetica;margin: 0;padding: 0;}:link {color: #c00;}:visited {color: #c00;}a:hover {color: #f50;}h1 {text-align: center;margin: 0;padding: 0.6em 2em 0.4em;background-color: #900;color: #fff;font-weight: normal;font-size: 1.75em;border-bottom: 2px solid #000;}h1 strong {font-weight: bold;font-size: 1.5em;}h2 {text-align: center;background-color: #900;font-size: 1.1em;font-weight: bold;color: #fff;margin: 0;padding: 0.5em;border-bottom: 2px solid #000;}hr {display: none;}.content {padding: 1em 5em;}.alert {border: 2px solid #000;}img {border: 2px solid #fff;padding: 2px;margin: 2px;}a:hover img {border: 2px solid #294172;}.logos {margin: 1em;text-align: center;}/*]]>*/</style></head><body><h1>Welcome to <strong>nginx</strong> on Red Hat Enterprise Linux!(Master)</h1><h1>192.168.99.2</h1><div class="content"><p>This page is used to test the proper operation of the<strong>nginx</strong> HTTP server after it has beeninstalled. If you can read this page, it means that theweb server installed at this site is workingproperly.</p><div class="alert"><h2>Website Administrator</h2><div class="content"><p>This is the default <tt>index.html</tt> page thatis distributed with <strong>nginx</strong> onRed Hat Enterprise Linux.  It is located in<tt>/usr/share/nginx/html</tt>.</p><p>You should now put your content in a location ofyour choice and edit the <tt>root</tt> configurationdirective in the <strong>nginx</strong>configuration file<tt>/etc/nginx/nginx.conf</tt>.</p><p>For information on Red Hat Enterprise Linux, please visit the <a href="http://www.redhat.com/">Red Hat, Inc. website</a>. The documentation for Red Hat Enterprise Linux is <a href="http://www.redhat.com/docs/manuals/enterprise/">available on the Red Hat, Inc. website</a>.</p></div></div><div class="logos"><a href="http://nginx.net/"><imgsrc="nginx-logo.png" alt="[ Powered by nginx ]"width="121" height="32" /></a><a href="http://www.redhat.com/"><imgsrc="poweredby.png"alt="[ Powered by Red Hat Enterprise Linux ]"width="88" height="31" /></a></div></div></body>
</html>

3、啟動

3.1 啟動nginx

nginx

3.2 啟動keepalived

keepalived -l -f /etc/keepalived/keepalived.conf

4、狀態查看

4.1 查看nginx狀態

ps -ef|grep nginx

打印返回

root          43       1  0 08:40 ?        00:00:00 nginx: master process nginx
nginx         44      43  0 08:40 ?        00:00:00 nginx: worker process
nginx         45      43  0 08:40 ?        00:00:00 nginx: worker process
nginx         46      43  0 08:40 ?        00:00:00 nginx: worker process
nginx         47      43  0 08:40 ?        00:00:00 nginx: worker process
root          57      19  0 08:49 pts/1    00:00:00 grep --color=auto nginx

4.2 查看keepalived狀態

查看進程

ps -ef|grep keepalived

打印返回

root          62       1  2 08:51 ?        00:00:00 keepalived -l -f /etc/keepalived/keepalived.conf
root          63      62  4 08:51 ?        00:00:00 keepalived -l -f /etc/keepalived/keepalived.conf
root          67      19  0 08:51 pts/1    00:00:00 grep --color=auto keepalived

查看vip掛載情況

ip a

打印返回

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft forever
26: eth0@if27: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:c0:a8:63:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0inet 192.168.99.2/24 brd 192.168.99.255 scope global eth0valid_lft forever preferred_lft foreverinet 192.168.200.17/32 scope global eth0valid_lft forever preferred_lft forever

4、停止

4.1 停止nginx

nginx -s stop

4.2 停止keepalived

pkill keepalived

三、從機

1、方法一:重復主機步驟

1.1 將步驟 (1.2 創建網橋)改為如下:

docker network create -d=bridge --subnet=192.168.111.0/24 br2

1.2 將步驟2.1 配置keepalived內容改為如下

! Configuration File for keepalivedglobal_defs {#路由id:當前安裝keepalived節點主機的標識符,全局唯一router_id keep_151
}vrrp_instance VI_1 {# 表示的狀態,當前的130服務器為nginx的主節點,MASTER/BACKUPstate BACKUP# 當前實例綁定的網卡interface eth0# 保證主備節點一致virtual_router_id 51# 優先級/權重,誰的優先級高,在MASTER掛掉以后,就能成為MASTERpriority 60# 主備之間同步檢查的時間間隔,默認1sadvert_int 1# 認證授權的密碼,防止非法節點的進入authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.200.17}
}

1.3 將步驟(2.2.2 修改index.html)修改網頁內容(可選)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>Test Page for the Nginx HTTP Server on Red Hat Enterprise Linux</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style type="text/css">/*<![CDATA[*/body {background-color: #fff;color: #000;font-size: 0.9em;font-family: sans-serif,helvetica;margin: 0;padding: 0;}:link {color: #c00;}:visited {color: #c00;}a:hover {color: #f50;}h1 {text-align: center;margin: 0;padding: 0.6em 2em 0.4em;background-color: #900;color: #fff;font-weight: normal;font-size: 1.75em;border-bottom: 2px solid #000;}h1 strong {font-weight: bold;font-size: 1.5em;}h2 {text-align: center;background-color: #900;font-size: 1.1em;font-weight: bold;color: #fff;margin: 0;padding: 0.5em;border-bottom: 2px solid #000;}hr {display: none;}.content {padding: 1em 5em;}.alert {border: 2px solid #000;}img {border: 2px solid #fff;padding: 2px;margin: 2px;}a:hover img {border: 2px solid #294172;}.logos {margin: 1em;text-align: center;}/*]]>*/</style></head><body><h1>Welcome to <strong>nginx</strong> on Red Hat Enterprise Linux!(Master)</h1><h1>192.168.111.2</h1><div class="content"><p>This page is used to test the proper operation of the<strong>nginx</strong> HTTP server after it has beeninstalled. If you can read this page, it means that theweb server installed at this site is workingproperly.</p><div class="alert"><h2>Website Administrator</h2><div class="content"><p>This is the default <tt>index.html</tt> page thatis distributed with <strong>nginx</strong> onRed Hat Enterprise Linux.  It is located in<tt>/usr/share/nginx/html</tt>.</p><p>You should now put your content in a location ofyour choice and edit the <tt>root</tt> configurationdirective in the <strong>nginx</strong>configuration file<tt>/etc/nginx/nginx.conf</tt>.</p><p>For information on Red Hat Enterprise Linux, please visit the <a href="http://www.redhat.com/">Red Hat, Inc. website</a>. The documentation for Red Hat Enterprise Linux is <a href="http://www.redhat.com/docs/manuals/enterprise/">available on the Red Hat, Inc. website</a>.</p></div></div><div class="logos"><a href="http://nginx.net/"><imgsrc="nginx-logo.png" alt="[ Powered by nginx ]"width="121" height="32" /></a><a href="http://www.redhat.com/"><imgsrc="poweredby.png"alt="[ Powered by Red Hat Enterprise Linux ]"width="88" height="31" /></a></div></div></body>
</html>

2、方法二:克隆主機虛擬機

2.1 克隆完成、啟動虛擬機,修改網橋

2.1.1 創建網橋
docker network create -d=bridge --subnet=192.168.111.0/24 br0
2.1.2 啟動容器連接到創建的網橋
docker run -it --name centos-1 --privileged -v /home/vac/linux:/mnt/software -p 9901:80 --network=br0 centos bash

2.2 修改keepalived的配置

輸入命令

vim /etc/keepalived/keepalived.conf

修改內容如下:

! Configuration File for keepalivedglobal_defs {#路由id:當前安裝keepalived節點主機的標識符,全局唯一router_id keep_151
}vrrp_instance VI_1 {# 表示的狀態,當前的130服務器為nginx的主節點,MASTER/BACKUPstate BACKUP# 當前實例綁定的網卡interface eth0# 保證主備節點一致virtual_router_id 51# 優先級/權重,誰的優先級高,在MASTER掛掉以后,就能成為MASTERpriority 60# 主備之間同步檢查的時間間隔,默認1sadvert_int 1# 認證授權的密碼,防止非法節點的進入authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.200.17}
}

四、路由

具體路由情況示意圖
在這里插入圖片描述

1、主機

1.1 網卡情況

輸入命令

ifconfig

打印返回

br-4bd1ee90e211: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.99.1  netmask 255.255.255.0  broadcast 192.168.99.255inet6 fe80::42:29ff:fee8:aade  prefixlen 64  scopeid 0x20<link>ether 02:42:29:e8:aa:de  txqueuelen 0  (Ethernet)RX packets 51808  bytes 3263249 (3.2 MB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 71190  bytes 130020293 (130.0 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255inet6 fe80::42:65ff:fe2d:ef09  prefixlen 64  scopeid 0x20<link>ether 02:42:65:2d:ef:09  txqueuelen 0  (Ethernet)RX packets 4  bytes 224 (224.0 B)RX errors 0  dropped 0  overruns 0  frame 0TX packets 228  bytes 23485 (23.4 KB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.100.157  netmask 255.255.255.0  broadcast 192.168.100.255inet6 fe80::f040:fdbe:78e1:5077  prefixlen 64  scopeid 0x20<link>ether 00:0c:29:b6:5d:6c  txqueuelen 1000  (Ethernet)RX packets 4329116  bytes 940869997 (940.8 MB)RX errors 0  dropped 345204  overruns 0  frame 0TX packets 284583  bytes 29536782 (29.5 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536inet 127.0.0.1  netmask 255.0.0.0inet6 ::1  prefixlen 128  scopeid 0x10<host>loop  txqueuelen 1000  (Local Loopback)RX packets 26728  bytes 3141066 (3.1 MB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 26728  bytes 3141066 (3.1 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0vethd5c0922: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet6 fe80::a075:3cff:fe3c:d62  prefixlen 64  scopeid 0x20<link>ether a2:75:3c:3c:0d:62  txqueuelen 0  (Ethernet)RX packets 385  bytes 20670 (20.6 KB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 1841  bytes 83533 (83.5 KB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

1.2 查看路由

輸入命令

route -n

打印返回

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.1   0.0.0.0         UG    100    0        0 ens33
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ens33
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.99.0    0.0.0.0         255.255.255.0   U     0      0        0 br-4bd1ee90e211
192.168.100.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33

1.3 添加路由

主機到從機的路由

route add -net 192.168.111.0/24 gw 192.168.100.158

主機到vip的路由

route add -net 192.168.200.0/24 gw 192.168.99.2

vip到從機的路由

route add -net 192.168.200.0/24 gw 192.168.100.158

1.4 最后路由表

輸入命令

route -n

打印返回

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.1   0.0.0.0         UG    100    0        0 ens33
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ens33
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.99.0    0.0.0.0         255.255.255.0   U     0      0        0 br-4bd1ee90e211
192.168.100.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33
192.168.111.0   192.168.100.158 255.255.255.0   UG    0      0        0 ens33
192.168.200.0   192.168.99.2    255.255.255.0   UG    0      0        0 br-4bd1ee90e211
192.168.200.0   192.168.100.158 255.255.255.0   UG    0      0        0 ens33

2、從機

2.1 網卡情況

輸入命令

ip a

打印返回

br-feca604495c7: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500inet 192.168.111.1  netmask 255.255.255.0  broadcast 192.168.111.255inet6 fe80::42:7ff:fe57:5d4d  prefixlen 64  scopeid 0x20<link>ether 02:42:07:57:5d:4d  txqueuelen 0  (Ethernet)RX packets 86544  bytes 7152949 (7.1 MB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 92024  bytes 132312772 (132.3 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255inet6 fe80::42:69ff:fe89:fc8c  prefixlen 64  scopeid 0x20<link>ether 02:42:69:89:fc:8c  txqueuelen 0  (Ethernet)RX packets 4358  bytes 264361 (264.3 KB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 8778  bytes 19961998 (19.9 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.100.158  netmask 255.255.255.0  broadcast 192.168.100.255inet6 fe80::5d22:1c65:d887:63e6  prefixlen 64  scopeid 0x20<link>ether 00:0c:29:6a:2e:27  txqueuelen 1000  (Ethernet)RX packets 4140156  bytes 766431979 (766.4 MB)RX errors 0  dropped 342651  overruns 0  frame 0TX packets 212125  bytes 22585816 (22.5 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536inet 127.0.0.1  netmask 255.0.0.0inet6 ::1  prefixlen 128  scopeid 0x10<host>loop  txqueuelen 1000  (Local Loopback)RX packets 47516  bytes 4932330 (4.9 MB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 47516  bytes 4932330 (4.9 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0vethbe7b7fe: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet6 fe80::18e7:2fff:fea9:3b8e  prefixlen 64  scopeid 0x20<link>ether 1a:e7:2f:a9:3b:8e  txqueuelen 0  (Ethernet)RX packets 271733  bytes 15045369 (15.0 MB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 43223  bytes 2358797 (2.3 MB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2.2 查看路由

輸入命令

route -n

打印返回

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.1   0.0.0.0         UG    100    0        0 ens33
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ens33
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.100.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33
192.168.111.0   0.0.0.0         255.255.255.0   U     0      0        0 br-feca604495c7

2.3 添加路由

從機到主機的路由

route add -net 192.168.99.0/24 gw 192.168.100.157

從機到vip的路由

route add -net 192.168.200.0/24 gw 192.168.111.2

vip到主機的路由

route add -net 192.168.200.0/24 gw 192.168.100.157

2.4 最后路由情況

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.1   0.0.0.0         UG    100    0        0 ens33
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ens33
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.99.0    192.168.100.157 255.255.255.0   UG    0      0        0 ens33
192.168.100.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33
192.168.111.0   0.0.0.0         255.255.255.0   U     0      0        0 br-feca604495c7
192.168.200.0   192.168.111.2   255.255.255.0   UG    0      0        0 br-feca604495c7
192.168.200.0   192.168.100.157 255.255.255.0   UG    0      0        0 ens33

3、宿主機(windows主機)

3.1 添加路由

vip到主機

route add 192.168.200.0 mask 255.255.255.0 192.168.100.157

vip到從機

route add 192.168.200.0 mask 255.255.255.0 192.168.100.158

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/212680.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/212680.shtml
英文地址,請注明出處:http://en.pswp.cn/news/212680.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【HarmonyOS開發】控件開發過程中,知識點記錄

1、問題記錄及解決方案 1.1 資源&#xff08;Icon&i18n&#xff09;問題 控件&#xff1a;只有一個JS文件&#xff0c;不會將任何資源型文件&#xff08;圖片、字體、默認文字等&#xff09;打包到SO中。因此&#xff0c;當我們開發控件時&#xff0c;需要將需要使用到的資…

【機器學習】042_遷移學習

一、概述、定義 目的&#xff1a; 遷移學習的目的是將某個領域或任務上學習到的模式、知識應用到不同但相關的領域里&#xff0c;獲取更多數據&#xff0c;而不必投入許多時間人力來進行數據的標注。 舉例&#xff1a; 已經會下中國象棋&#xff0c;就可以類比著來學習國際…

Java單元測試:JUnit和Mockito的使用指南

引言&#xff1a; 在軟件開發過程中&#xff0c;單元測試是一項非常重要的工作。通過單元測試&#xff0c;我們可以驗證代碼的正確性、穩定性和可維護性&#xff0c;幫助我們提高代碼質量和開發效率。本文將介紹Java中兩個常用的單元測試框架&#xff1a;JUnit和Mockito&#x…

Navicat連接Oracle數據庫

Navicat連接Oracle數據庫 打開服務里面找到Oracle服務 OracleServerXE或者OracleServerTTL 創建數據庫連接 連接名默認自己起 主機選擇本地 端口默認 服務名在服務中可以找到輸入后綴 用戶名默認都是system 密碼是創建oracle時候填寫的口令 點擊測試連接即可

Spring Boot中的事務是如何實現的?懂嗎?

SpringBoot中的事務管理&#xff0c;用得好&#xff0c;能確保數據的一致性和完整性&#xff1b;用得不好&#xff0c;可能會給性能帶來不小的影響哦。 基本使用 在SpringBoot中&#xff0c;事務的使用非常簡潔。首先&#xff0c;得感謝Spring框架提供的Transactional注解&am…

【金融數據分析】計算滬深300指數行業權重分布并用餅圖展示

前言 前面的文章我們已經介紹了如何獲取滬深300成分股所述行業以及權重的數據&#xff0c;想要了解這部分內容的小伙伴可以閱讀上一篇文章 springbootjdbcTemplatesqlite編程示例——以滬深300成分股數據處理為例-CSDN博客 那么有了上文獲取的數據&#xff0c;我們實際上可以…

【rabbitMQ】rabbitMQ控制臺模擬收發消息

目錄 1.新建隊列 2.交換機綁定隊列 3.查看消息是否到達隊列 總結&#xff1a; 1.新建隊列 2.交換機綁定隊列 點擊amq.fonout 3.查看消息是否到達隊列 總結&#xff1a; 生產者&#xff08;publisher&#xff09;發送消息&#xff0c;先到達交換機&#xff0c;再到隊列&…

微信小程序uni-app:常用Form表單組件使用示例

目錄 input 輸入框picker 選擇器 input 輸入框 https://developers.weixin.qq.com/miniprogram/dev/component/input.htmlhttps://uniapp.dcloud.net.cn/component/input.html <inputclass"input-class"type"text"v-model"value"placeholde…

Linux下文本三劍客:grep、awk、sed之對比

一、grep 主要用于搜索某些字符串&#xff1b;sed、awk 用于處理文本&#xff1a; grep基本是以行為單位處理文本的&#xff1b; 而awk可以做更細分的處理&#xff0c;通過指定分隔符將一行&#xff08;一條記錄&#xff09;劃分為多個字段&#xff0c;以字段為單位處理文本。…

python輸出菱形字符圖案 附實戰代碼

下面是一個Python程序&#xff0c;可以用來輸出菱形字符圖案。這個程序使用了兩個嵌套的for循環&#xff0c;以及字符串連接操作。 # 獲取用戶輸入 n int(input("請輸入菱形的邊長&#xff1a;"))# 生成上半部分菱形 for i in range(1, n 1, 2):print(" &quo…

SDK,但未在應用內的隱私政策/在AppGallery Connect上提交的隱私政策內容中進行明示,不符合華為應用市場審核標準。

&#xff08;暫時用不到的也建議收藏一下&#xff0c;因為文章持續更新中&#xff09; 最新更改時間&#xff1a;20023-12-10 第三方SDK合集列表 為了確保用戶個人信息的安全&#xff0c;我們對使用到的第三方提供的軟件開發包&#xff08;SDK&#xff09;進行了嚴格的安全檢…

期末速成數據庫極簡版【存儲過程】(5)

目錄 【7】系統存儲過程 【8】用戶存儲過程——帶輸出參數的存儲過程 創建存儲過程 存儲過程調用 【9】用戶存儲過程——不帶輸出參數的存儲過程 【7】系統存儲過程 系統存儲我們就不做過程講解用戶存儲過程會考察一道大題&#xff0c;所以我們把重點放在用戶存儲過程。…

vscode 編寫爬蟲爬取王者榮耀壁紙

網上關于爬蟲大部分教程和編輯器用的都不是vscode &#xff0c;此教程用到了vscode、Python、bs4、requests。 vscode配置Python安裝環境可以看看這個大佬的教程 03-vscode安裝和配置_嗶哩嗶哩_bilibili vscode配置爬蟲環境可以參考這個大佬的教程【用Vscode實現簡單的python…

U4_1 語法分析之自頂向下分析

文章目錄 一、定義1、任務2、對比3、方法4、自頂向下面臨問題 二、自頂向下分析1、概念2、特點3、二義性問題4、左遞歸問題1&#xff09;概念2&#xff09;消除3&#xff09;間接左遞歸 5、回溯問題1&#xff09;概念2&#xff09;消除3&#xff09;解決方法 6、總結 三、遞歸子…

Java 線程池中 submit() 和 execute() 方法有什么區別?

Java 線程池中 submit() 和 execute() 方法有什么區別&#xff1f; 在 Java 中&#xff0c;ExecutorService 接口是用于管理和執行線程的框架&#xff0c;它定義了兩個用于提交任務的方法&#xff1a;submit() 和 execute()。這兩種方法有一些區別&#xff1a; 返回值&#xf…

【Proteus仿真】【51單片機】光照強度檢測系統

文章目錄 一、功能簡介二、軟件設計三、實驗現象聯系作者 一、功能簡介 本項目使用Proteus8仿真51單片機控制器&#xff0c;使共陰數碼管&#xff0c;PCF8591 ADC模塊、光敏傳感器等。 主要功能&#xff1a; 系統運行后&#xff0c;數碼管顯示光傳感器采集光照強度值&#xff…

Gitzip插件【Github免翻下載】

今天給大家推薦一個github下載的插件&#xff0c;平常大家下載應該無外乎就是以下兩種&#xff1a; Download zip利用git clone 但是這兩種各有各的弊端&#xff0c;前者一般需要科學上網才可以&#xff0c;后者下載不穩定經常中途斷掉。 今天給推薦一個款瀏覽器插件-Gitzip.大…

基于SSM的java衣服商城

基于SSM的java衣服商城 一、系統介紹二、功能展示四、其他系統實現五、獲取源碼 一、系統介紹 項目類型&#xff1a;Java EE項目 項目名稱&#xff1a;基于SSM的美衣商城 項目架構&#xff1a;B/S架構 開發語言&#xff1a;Java語言 前端技術&#xff1a;Layui等 后端技術…

Flask和Vue框架實現WebSocket消息通信

1 安裝環境 1.1 安裝Flask環境 主要的安裝包 Flask、Flask-SocketIO&#xff0c;注意Python版本要求3.6 # Flask-SocketIO參考地址 https://flask-socketio.readthedocs.io/en/latest/ https://github.com/miguelgrinberg/flask-socketio更新基礎環境 # 更新pip python -m …

Unity發布WebGL測試界面處理方式參考

如果使用Unity發布WebGL經常會和網頁進行交互&#xff0c;為了能夠做到界面統一&#xff0c;往往所有UI都是在頁面上開發的&#xff0c;Unity本身不做任何UI或者只做三維UI&#xff0c;但是在開發過程中&#xff0c;為了測試接口&#xff0c;難免要在Unity中做一些UI來方便測試…