部署tomcat单机多实例,keepalived+mysql的互为主从高可用,mysql+keepalived高可用

部署tomcat单机多实例

在Tomcat中部署单机多实例是一种常见的做法,它允许您在同一台服务器上运行多个独立的Tomcat实例,每个实例都有自己的配置、日志和应用程序。

安装jdk环境

首先配置java环境
[root@tomcat ~]# tar xf  jdk-8u211-linux-x64.tar.gz -C /usr/local改名,设置环境变量
[root@tomcat ~]# cd /usr/local
[root@tomcat local]# mv jdk1.8.0_211/ java
[root@tomcat local]# vim  /etc/profile.d/java.shJAVA_HOME=/usr/local/java
PATH=$PATH:$JAVA_HOME/bin重载环境变量
[root@tomcat local]# source /etc/profile.d/java.sh 
查看jdk是否安装成功
[root@tomcat local]# java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

安装tomcat

解压 
[root@tomcat ~]# tar xf apache-tomcat-8.5.92.tar.gz -C /usr/local进入
[root@tomcat ~]# cd /usr/local
改名
[root@tomcat local]# mv  apache-tomcat-8.5.92 tomcat复制
[root@tomcat local]# cp -r tomcat tomcat-2
[root@tomcat local]# cp -r tomcat tomcat-3

配置文件

tomcat

修改配置文件
tomcat
[root@tomcat local]# vim ./tomcat/conf/server.xml 

tomcat-2

[root@tomcat local]# vim ./tomcat-2/conf/server.xml 

tomcat-3

[root@tomcat local]# vim ./tomcat-3/conf/server.xml 

启动tomcat

[root@tomcat local]# ./tomcat/bin/startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/java
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.[root@tomcat local]# ./tomcat-2/bin/startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat-2
Using CATALINA_HOME:   /usr/local/tomcat-2
Using CATALINA_TMPDIR: /usr/local/tomcat-2/temp
Using JRE_HOME:        /usr/local/java
Using CLASSPATH:       /usr/local/tomcat-2/bin/bootstrap.jar:/usr/local/tomcat-2/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.[root@tomcat local]# ./tomcat-3/bin/startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat-3
Using CATALINA_HOME:   /usr/local/tomcat-3
Using CATALINA_TMPDIR: /usr/local/tomcat-3/temp
Using JRE_HOME:        /usr/local/java
Using CLASSPATH:       /usr/local/tomcat-3/bin/bootstrap.jar:/usr/local/tomcat-3/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.

查看端口

[root@tomcat local]# ss -nplt
State       Recv-Q Send-Q                                        Local Address:Port                                                       Peer Address:Port              
LISTEN      0      128                                                       *:22                                                                    *:*                   users:(("sshd",pid=920,fd=3))
LISTEN      0      100                                               127.0.0.1:25                                                                    *:*                   users:(("master",pid=1148,fd=13))
LISTEN      0      1                                        [::ffff:127.0.0.1]:8005                                                               [::]:*                   users:(("java",pid=1902,fd=61))
LISTEN      0      1                                        [::ffff:127.0.0.1]:8006                                                               [::]:*                   users:(("java",pid=2043,fd=61))
LISTEN      0      1                                        [::ffff:127.0.0.1]:8007                                                               [::]:*                   users:(("java",pid=2095,fd=61))
LISTEN      0      80                                                     [::]:3306                                                               [::]:*                   users:(("mysqld",pid=1004,fd=29))
LISTEN      0      100                                                    [::]:8080                                                               [::]:*                   users:(("java",pid=1902,fd=52))
LISTEN      0      100                                                    [::]:8081                                                               [::]:*                   users:(("java",pid=2043,fd=52))
LISTEN      0      100                                                    [::]:8082                                                               [::]:*                   users:(("java",pid=2095,fd=52))
LISTEN      0      128  

访问实例

keepalived+mysql互为主从的高可用

IP1:10.36.192.223 安装msyql

IP2:10.36.192.222 安装mysql

首先做IP1为主,IP2为从

IP1的操作

IP1的操作
[root@IP1 ~]# mkdir /var/log/mysql
[root@IP1 ~]# chown  -R mysql.mysql /var/log/mysqlvim /etc/my.cnf
###
log-bin=/var/log/mysql/mysql-bin       #启用二进制文件日志记录
server-id=1 
###
重启mysql
# systemctl restart mysqld
登录数据库
创建主从登录的用户
mysql> grant replication slave on *.* to  'zc'@'%' identified by 'Qianfeng@123';刷新
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)查看二进制日志
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 |      587 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

IP2的操作

[root@IP2 ~]# mkdir /var/log/mysql
[root@IP2 ~]# chown  -R mysql.mysql /var/log/mysqlvim /etc/my.cnf
###
server-id=2重启msyql
# systemctl restart mysqld
登录数据库
mysql> CHANGE MASTER TO->   MASTER_HOST='10.36.192.223',->   MASTER_USER='zc',->   MASTER_PASSWORD='Qianfeng@123',->   MASTER_PORT=3306,->   MASTER_LOG_FILE='mysql-bin.000001',->   MASTER_LOG_POS=587,->   MASTER_CONNECT_RETRY=10;
Query OK, 0 rows affected, 2 warnings (0.01 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)启动主从,查看主从状态
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 10.36.192.223Master_User: zcMaster_Port: 3306Connect_Retry: 10Master_Log_File: mysql-bin.000001Read_Master_Log_Pos: 587Relay_Log_File: slave-relay-bin.000002Relay_Log_Pos: 320Relay_Master_Log_File: mysql-bin.000001Slave_IO_Running: YesSlave_SQL_Running: Yes

做IP2为主,IP1为从

IP2的操作

vim /etc/my.cnf
###
添加第二行
[mysqld]
log-bin=/var/log/mysql/mysql-bin       #启用二进制文件日志记录重启mysql
# systemctl restart mysqld登录数据库创建主从登录的用户
mysql> grant replication slave on *.* to  'zxd'@'%' identified by 'Qianfeng@123';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)查看二进制日志坐标
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 |      154 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

IP1的操作

mysql> CHANGE MASTER TO->   MASTER_HOST='10.36.192.222',->   MASTER_USER='zxd',->   MASTER_PASSWORD='Qianfeng@123',->   MASTER_PORT=3306,->   MASTER_LOG_FILE='mysql-bin.000001',->   MASTER_LOG_POS=154,->   MASTER_CONNECT_RETRY=10;
Query OK, 0 rows affected, 2 warnings (0.01 sec)刷新
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)启动主从
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)查看主从状态
mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 10.36.192.222Master_User: zxdMaster_Port: 3306Connect_Retry: 10Master_Log_File: mysql-bin.000001Read_Master_Log_Pos: 154Relay_Log_File: master-relay-bin.000002Relay_Log_Pos: 320Relay_Master_Log_File: mysql-bin.000001Slave_IO_Running: YesSlave_SQL_Running: Yes

互为主从成功配置

在IP1的数据库创库,IP2也可以看到

IP1
mysql> create database zhangxiaodong;
Query OK, 1 row affected (0.00 sec)mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| zhangxiaodong      |
+--------------------+
5 rows in set (0.00 sec)IP2
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| zhangxiaodong      |
+--------------------+
5 rows in set (0.00 sec)

安装keepalived

IP1  IP2都操作
# yum -y install keepalived

编写当某一台的MySQL停掉以后,就自动停掉那台机器的keepalived服务的脚本

cd /etc/keepalived
[root@IP1 keepalived]# cat keepalived_check_mysql.sh 
#!/bin/bash
/usr/bin/mysql -uroot -p'Qianfeng@123' -e "show status" &>/dev/null
if [ $? -ne 0 ] ;then
#	service keepalived stopsystemctl stop keepalived
ficd /etc/keepalived
[root@IP2 keepalived]# cat keepalived_check_mysql.sh 
#!/bin/bash
/usr/bin/mysql -uroot -p'Qianfeng@123' -e "show status" &>/dev/null
if [ $? -ne 0 ] ;then
#	service keepalived stopsystemctl stop keepalived
fi

给脚本执行权限

chmod a+x keepalived_check_mysql.sh 

在keepalived的配置文件中引用脚本

IP1
[root@IP1  keepalived]# cat keepalived.conf 
! Configuration File for keepalivedglobal_defs {router_id directory1 
}
vrrp_script check_run {script "/etc/keepalived/keepalived_check_mysql.sh"interval 5
}vrrp_instance VI_1 {state MASTERinterface ens33virtual_router_id 66priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.36.192.233/24}track_script {check_run}
}
IP2
[root@IP2 keepalived]# cat keepalived.conf 
! Configuration File for keepalivedglobal_defs {router_id directory2
}
vrrp_script check_run {script "/etc/keepalived/keepalived_check_mysql.sh"interval 5
}vrrp_instance VI_1 {state BACKUPnopreemptinterface ens33virtual_router_id 66priority 50advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.36.192.233/24}track_script {#check_runcheck_run}
}

启动keepqlived

#systemctl start keepalived
[root@IP1 keepalived]# 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 foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:99:b8:b4 brd ff:ff:ff:ff:ff:ffinet 10.36.192.223/24 brd 10.36.192.255 scope global noprefixroute dynamic ens33valid_lft 255232sec preferred_lft 255232secinet 10.36.192.233/24 scope global secondary ens33valid_lft forever preferred_lft forever

此时的虚拟IP为10.36.192.233,在IP1上,但由于互为主从,因此查到数据相同

在那俩台数据库都创建可以允许远程登录数据库的用户

IP1
mysql> grant all on *.* to 'malong'@'%' identified by 'Qianfeng@123!';
Query OK, 0 rows affected, 1 warning (0.00 sec)IP2
mysql> grant all on *.* to 'malong'@'%' identified by 'Qianfeng@123!';
Query OK, 0 rows affected, 1 warning (0.00 sec)

准备另一台机器,做测试实验

[root@mysql ~]# mysql -umalong -pQianfeng@123! -h10.36.192.233 
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.42-log MySQL Community Server (GPL)Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| zhangxiaodong      |
+--------------------+
5 rows in set (0.00 sec)

经过测试发现,当IP1的数据库停掉以后,keepalived也会停掉,此时虚拟IP会飘向IP2的机器上,但是由于俩台数据库是互为主从,因此测试机器登上去查看到的数据是相同的.这样可以保证数据库的高可用.

MySQL+keepalived高可用

实验机器IP
master(干净机器)10.36.192.223        
slave (干净机器)10.36.192.222
测试(已有MySQL)10.36.192.199

俩台服务器都安装mysql,keepalived,并修改mysql初始密码

[root@master ~]# yum install -y mysql-server keepalived[root@master ~]# systemctl restart mysqld[root@master ~]# grep "password" /var/log/mysqld.log2023-11-02T07:46:28.937422Z 1 [Note] A temporary password is generated for root@localhost: fB#sVi1UyRW;[root@master ~]# mysqladmin -uroot -p'fB#sVi1UyRW;' password 'Qianfeng@123'
[root@slave ~]# yum install -y mysql-server keepalived[root@slave ~]# systemctl restart mysqld[root@slave ~]# grep "password" /var/log/mysqld.log2023-11-02T07:46:28.937422Z 1 [Note] A temporary password is generated for root@localhost: ?Huo=g>tQ9tn;[root@slave ~]# mysqladmin -uroot -p'?Huo=g>tQ9tn' password 'Qianfeng@123'

登录俩台数据库创建允许远程登录的用户

[root@master ~]# mysql -uroot -p'Qianfeng@123'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
...mysql> grant all on *.* to 'malong'@'%' identified by 'Qianfeng@123!';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> \q
Bye[root@slave ~]# mysql -uroot -p'Qianfeng@123'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
...mysql> grant all on *.* to 'malong'@'%' identified by 'Qianfeng@123!';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> \q
Bye

在master的数据库创建一个库

create database dbtest;

master配置keepalived

[root@master ~]# vim /etc/keepalived/keepalived.conf
! Configuration File for keepalivedglobal_defs {router_id directory1 
}
vrrp_instance VI_1 {state MASTERinterface ens33virtual_router_id 66priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.36.192.233/24   ###虚拟的IP}
}

slave配置keepalived

[root@slave ~]# vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {router_id directory2
}
vrrp_instance VI_1 {state BACKUPnopreemptinterface ens33virtual_router_id 66priority 50advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.36.192.233/24}
}

配置数据库检查脚本

[root@master keepalived]# cat keepalived_check_mysql.sh 
#!/bin/bash
/usr/bin/mysql -uroot -p'Qianfeng@123' -e "show status" &>/dev/null
if [ $? -ne 0 ] ;then
#	service keepalived stopsystemctl stop keepalived
fi[root@slave keepalived]# cat keepalived_check_mysql.sh 
#!/bin/bash
/usr/bin/mysql -uroot -p'Qianfeng@123' -e "show status" &>/dev/null
if [ $? -ne 0 ] ;then
#	service keepalived stopsystemctl stop keepalived
fi

记得给脚本执行权限

chmod a+x keepalived_check_mysql.sh 

在配置文件中引用脚本

[root@master  keepalived]# cat keepalived.conf 
! Configuration File for keepalivedglobal_defs {router_id directory1 
}
vrrp_script check_run {script "/etc/keepalived/keepalived_check_mysql.sh"interval 5
}vrrp_instance VI_1 {state MASTERinterface ens33virtual_router_id 66priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.36.192.233/24}track_script {check_run}
}
[root@slave keepalived]# cat keepalived.conf 
! Configuration File for keepalivedglobal_defs {router_id directory2
}
vrrp_script check_run {script "/etc/keepalived/keepalived_check_mysql.sh"interval 5
}vrrp_instance VI_1 {state BACKUPnopreemptinterface ens33virtual_router_id 66priority 50advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.36.192.233/24}track_script {#check_runcheck_run}
}

启动keepalived

systemctl start keepalived

在master端查看到虚拟IP

[root@master ~]# 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 foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:99:b8:b4 brd ff:ff:ff:ff:ff:ffinet 10.36.192.223/24 brd 10.36.192.255 scope global noprefixroute dynamic ens33valid_lft 250228sec preferred_lft 250228secinet 10.36.192.233/24 scope global secondary ens33valid_lft forever preferred_lft forever

在测试机器测试

[root@mysql ~]# mysql -umalong -pQianfeng@123! -h10.36.192.233 
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 635
Server version: 5.7.42 MySQL Community Server (GPL)Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| dbtest             |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

此时查看的是master端的数据库

停掉master端的msyql

[root@master ~]# systemctl stop mysqld[root@master ~]# systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability MonitorLoaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled)Active: inactive (dead)此时的虚拟ip在slave端
[root@slave ~]# 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 foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:9f:83:60 brd ff:ff:ff:ff:ff:ffinet 10.36.192.222/24 brd 10.36.192.255 scope global noprefixroute dynamic ens33valid_lft 258272sec preferred_lft 258272secinet 10.36.192.233/24 scope global secondary ens33valid_lft forever preferred_lft forever

使用测试机子登录远程MySQL

[root@mysql ~]# mysql -umalong -pQianfeng@123! -h10.36.192.233 -P 3306
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
...
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

此时查看到的是slave机器的数据库

此时先启动master端的数据库,与keepalived,顺序不能乱

[root@master ~]# systemctl start mysqld
[root@master ~]# systemctl start keepalived查看此时的虚拟IP 在master端上
[root@master ~]# 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 foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:99:b8:b4 brd ff:ff:ff:ff:ff:ffinet 10.36.192.223/24 brd 10.36.192.255 scope global noprefixroute dynamic ens33valid_lft 257980sec preferred_lft 257980secinet 10.36.192.233/24 scope global secondary ens33valid_lft forever preferred_lft forever

测试机查看到数据库此时是master端的数据库

[root@mysql ~]# mysql -umalong -pQianfeng@123! -h10.36.192.233 -P 3306
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
...
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| dbtest             |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.01 sec)

也就是当master,slave端的MySQL与keepalived同时开启时,虚拟IP会在master端,此时测试机远程登录的MySQL也是master端的

当master端的MySQL与keepalived停掉后,虚拟IP会飘向slave端,此时测试机远程登录的MySQL是slave端的。

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

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

相关文章

nodejs+vue+ElementUi会员制停车场车位系统

总之&#xff0c;智能停车系统使停车场管理工作规范化&#xff0c;系统化&#xff0c;程序化&#xff0c;避免停车场管理的随意性&#xff0c;提高信息处理的速度和准确性&#xff0c;能够及时、准确、有效的查询和修改停车场情况。 三、任务&#xff1a;小组任务和个人任务 智…

旅游海报图怎么做二维码展示?扫码即可查看图片

现在旅游攻略的海报可以做成二维码印刷在宣传单单页或者分享给用户来了解目的地的实际情况&#xff0c;出行路线、宣传海报等。用户只需要扫描二维码就可以查看内容&#xff0c;更加的方便省劲&#xff0c;那么旅游海报的图片二维码制作的技巧有哪些呢&#xff1f;使用图片二维…

2015年第四届数学建模国际赛小美赛A题飞机上的细长座椅解题全过程文档及程序

2015年第四届数学建模国际赛小美赛 A题 飞机上的细长座椅 原题再现&#xff1a; 航空公司座位是指在旅途中乘客可以乘坐的座位。一些航空公司现在推出了新的经济舱“超薄”座位。这些座椅除了重量较轻外&#xff0c;理论上还允许航空公司在不显著影响乘客舒适度的情况下增加运…

STL中优先队列的模拟实现与仿函数的介绍

文章目录 仿函数优先队列的模拟实现 仿函数 上回我们说到&#xff0c;优先队列的实现需要用到仿函数的特性 让我们再回到这里 这里我们发现他传入的用于比较的东西竟然是一个类模板&#xff0c;而不是我们所见到的函数 我们可以先创建一个类&#xff0c;用于比较大小 struc…

陶建辉在 CIAS 2023 谈“新能源汽车的数字化”

近年&#xff0c;中国的新能源汽车发展迅猛&#xff0c;在全球竞争中表现出色&#xff0c;已经连续 8 年保持全球销量第一。在新兴技术的推动下&#xff0c;新能源汽车的数字化转型也正在加速进行&#xff0c;从汽车制造到能源利用、人机交互&#xff0c;各个环节都在进行数字化…

RobotMaster学习——工序导入,参数设置,轨迹生成

目录 引出1.导入工序2.修改刀具其他刀具参数 3.进行工序分配4.设置TCP5.设置工作站6.工序整体导入配置7.进行计算 总结 引出 RobotMaster的操作流程&#xff0c;从导入工序到生产轨迹。 1.导入工序 2.修改刀具 要选择第七把刀具 其他刀具参数 第一把刀具 第二把刀具 第三把刀…

C语言的分支和循环语句

各位少年&#xff0c;今天和大家分享的是分支语句循环体语句&#xff0c;C语言是结构体的程序设计语言&#xff0c;这里的结构指的是&#xff08;顺序结构&#xff09;&#xff08;选择结构&#xff09;&#xff08;循环结构&#xff09;C语言是能够实现这三种结构的&#xff0…

作为程序员,你知道 Notion 吗?

Notion 是一款极其出色的个人笔记软件&#xff0c;它将“万物皆对象”的思维运用到笔记中&#xff0c;让使用者可以天马行空地去创造、拖拽、链接。也适用于康奈尔笔记法哦。 不知大家会不会有如下烦恼&#xff1a; 1.当你下载了许多 APP&#xff0c;也注册了许多账号&#x…

Prometheus-JVM

一. JVM监控 通过 jmx_exporter 启动端口来实现JVM的监控 Github Kubernetes Deployment Java 服务&#xff0c;修改 wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.19.0/jmx_prometheus_javaagent-0.19.0.jar# 编写配置文件&#xff0…

Nacos单机安装

采用的版本是Nacos Release 2.3.0 (Nov 30, 2023) alibaba/nacos GitHub 依赖于jdk&#xff0c;要先安装好jdk1.8。 修改配置 下载解压后&#xff0c;修改配置文件&#xff1a;conf/application.properties。 nacos.core.auth.plugin.nacos.token.secret.key 官方文档Na…

【SVN】centos7搭建svn--亲测能通

centos7.6搭建svn 1 知识小课堂1.1 CentOS1.2 SVN 2 搭建过程2.1 前期准备2.2 通过yum命令安装svnserve2.3 创建版本库目录2.4 创建svn版本库2.5 配置修改2.5 防火墙配置2.6 启动或关闭svn服务器2.6.1 进程守护2.6.2 检测svn端口3690是否已经监听&#xff1a;2.6.3 关闭SVN 2.7…

随机森林 2(决策树)

通过 随机森林 1 的介绍&#xff0c;相信大家对随机森林都有了一个初步的认知&#xff0c;知道了随机和森林分别指的是什么&#xff0c;以及决策树根据什么选择内部节点。本文将会从森林深入到树&#xff0c;去看一下决策树是如何构建的。网上很多文章都讲了决策树如何构建&…

Linux常用基本命令(三)

一、显示命令 1. cat 通式&#xff1a;cat 选项 文件名 只能看普通的文本文件 缺点&#xff1a;如果内容过多会显示不全 选项效果-n显示行号包括空行-b跳过空白行编号-s讲所有的连续的多个空行替换为一个空行&#xff08;压缩成一个空行&#xff09;-A显示隐藏字符 三个标准文件…

【XR806开发板试用】通过http请求从心知天气网获取天气预报信息

1. 开发环境搭建 本次评测开发环境搭建在windows11的WSL2的Ubuntu20.04中&#xff0c;关于windows安装WSL2可以参考文章: Windows下安装Linux(Ubuntu20.04)子系统&#xff08;WSL&#xff09; (1) 在WSL的Ubuntu20.04下安装必要的工具的. 安装git: sudo apt-get install git …

【UML】第9篇 类图(概念、作用和抽象类)(1/3)

目录 一、类图的概念 二、类图的主要作用 三、类图的构成 3.1 类的名称 3.2 抽象类&#xff08;Abstract Class&#xff09; 一、类图的概念 类图是UML模型中静态视图。它用来描述系统中的有意义的概念&#xff0c;包括具体的概念、抽象的概念、实现方面的概念等。静态视…

服务器数据恢复-误操作导致xfs分区数据丢失的数据恢复案例

服务器数据恢复环境&#xff1a; 某品牌OceanStorT系列某型号存储MD1200磁盘柜&#xff0c;组建的raid5磁盘阵列。上层分配了1个lun&#xff0c;安装的linux操作系统&#xff0c;划分两个分区&#xff0c;分区一通过lvm进行扩容&#xff0c;分区二格式化为xfs文件系统。 服务器…

深入了解C编译管道

文章目录 引言1. 预处理阶段2. 编译阶段3. 汇编阶段4. 链接阶段5.流程图结论 引言 C编译管道是软件开发中至关重要的工具&#xff0c;它负责将C语言源代码转换为可执行的机器代码。理解C编译管道的工作原理有助于提高代码的可读性、可维护性&#xff0c;并有助于优化生成的可执…

css画三角形

css画三角形 <!doctype html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport"content"widthdevice-width, user-scalableno, initial-scale1.0, maximum-scale1.0, minimum-scale1.0"&g…

python调用GPT API

每次让gpt给我生成一个调用api的程序时&#xff0c;他经常会调用以前的一些api的方法&#xff0c;导致我的程序运行错误&#xff0c;所以这期记录一下使用新的方法区调用api 参考网址 Migration Guide&#xff0c;这里简要地概括了一下新版本做了哪些更改 OpenAI Python API l…

WEB 3D技术 three.js 设置图像随窗口大小变化而变化

本文 我们来讲讲我们图层适应窗口变化的效果 可能这样说有点笼统 那么 自适应应该大家更熟悉 就是 当我们窗口发生变化说 做一些界面调整比例 例如 我们这样一个i项目界面 我们打开 F12 明显有一部分被挡住了 那么 我们可以刷新 这样是正常了 但是 我们将F12关掉 给F12的…