Day 28 MySQL的数据备份与恢复

news2025/2/28 17:02:34

数据备份及恢复

1.概述

​ 所有备份数据都应放在非数据库本地,而且建议有多份副本

备份: 能够防止由于机械故障以及人为误操作带来的数据丢失,例如将数据库文件保存在了其它地方

冗余: 数据有多份冗余,但不等备份,只能防止机械故障还来的数据丢失,例如主备模式、数据库集群

备份考虑的因素:

​ 数据的一致性

​ 服务的可用性

分类:

​ 逻辑备份

​ 备份的是建表、建库、插入等操作所执行SQL语句;适用于中小型数据库,效率相对较低(mysqldump,binlog日志)

​ 物理备份

​ 直接复制数据库文件,适用于大型数据库环境,不受存储引擎的限制,但不能恢复到不同的MySQL版本(tar、xtrabackup)

备份方式分类:

​ 完全备份

​ 备份所有数据

​ 增量备份

​ 每次备份上一次备份到现在产生的新数据

image-20220925184632820

​ 差异备份

​ 只备份跟完整备份不一样的

备份方案:

①完全备份+增量备份

设定一个周期(一周或一月),每周一对数据完整备份,周二到周天做增量备份,定期清理旧的数据,只保留最新的若干份
在这里插入图片描述

②完全备份+差异备份

设定一个周期(一周或一月),每周一对数据完整备份,周二到周天做差异备份(以周一的完整备份为基准),定期清理旧的数据,只保留最新的若干份
在这里插入图片描述

2.tar备份

​ 注意:备份期间,服务不可用

备份过程:完全物理备份

​ 停止数据库

[root@xingdian ~]# systemctl stop mysqld

​ tar备份数据

[root@xingdian ~]# mkdir /backup
[root@xingdian ~]# cd /var/lib/mysql
[root@xingdian ~]# tar -zcvf /backup/`date +%F`-mysql-all.tar.gz ./*

​ 启动数据库(备份完成后启动数据库,继续为其他服务提供服务)

[root@xingdian ~]# systemctl start mysqld

恢复过程:模拟数据丢失,恢复数据

​ 停止数据库

[root@xingdian ~]# systemctl stop mysqld

​ 清理环境

[root@xingdian ~]# rm -rf /var/lib/mysql/* 

​ 导入备份数据

[root@xingdian ~]# tar -xvf /backup/2019-08-20-mysql-all.tar.gz -C /usr/lib/mysql
[root@xingdian ~]# chown mysql.mysql /var/lib/mysql/* -R

​ 启动数据库(恢复后验证数据是否恢复成功)

[root@xingdian ~]# systemctl start mysqld
3.xtrabackup备份

简介:

​ percona-xtrabackup是开源免费的支持MySQL 数据库热备份的软件;能对InnoDB和XtraDB存储引擎的数据库非阻塞地备份;它不暂停服务创建Innodb热备份;为mysql做增量备份;在mysql服务器之间做在线表迁移;使创建replication更加容易;备份mysql而不增加服务器的负载

image-20220925185829126

安装软件:

[root@xingdian ~]# yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y
[root@xingdian ~]# yum install percona-xtrabackup-24 -y
完整备份

​ 创建备份目录:

[root@xingdian ~]# mkdir -p /xtrabackup/full/

​ 备份:

[root@xingdian ~]# innobackupex --user=root --password='QianFeng@123' /xtrabackup/full/

​ 查看备份数据:

[root@xingdian ~]# ls /xtrabackup/full/
2022-09-25_19-40-47

​ 模拟数据丢失数据恢复:(以下操作模拟数据丢失)

丢失前数据库中的数据:

[root@xingdian ~]# mysql -u root -pQianFeng@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 7
Server version: 5.7.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, 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                |
| t1                 |
+--------------------+
5 rows in set (0.00 sec)

数据丢失:

[root@xingdian ~]# systemctl stop mysqld
[root@xingdian ~]# rm -rf /var/lib/mysql/*
[root@xingdian ~]# rm -rf /var/log/mysqld.log 
[root@xingdian ~]# rm -rf /var/log/mysql-slow/slow.log (有则删除,无则不需要操作)

恢复前的验证:

该步骤主要是验证备份的数据是否可用

[root@xingdian ~]# innobackupex --apply-log /xtrabackup/full/2022-09-25_19-40-47/

恢复之前需要确认配置文件内有数据库目录指定,不然xtrabackup不知道恢复到哪里

[root@xingdian ~]# cat /etc/my.cnf
datadir=/var/lib/mysql

​ 恢复数据:

[root@xingdian ~]# innobackupex --copy-back /xtrabackup/full/2022-09-25_19-40-47/

​ 修改权限:

[root@xingdian ~]# chown  mysql.mysql /var/lib/mysql -R

​ 启动服务:

[root@xingdian ~]# systemctl start mysqld

​ 验证:

[root@xingdian ~]# mysql -u root -pQianFeng@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 2
Server version: 5.7.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, 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                |
| t1                 |
+--------------------+
5 rows in set (0.00 sec)
增量备份

原理:每次备份上一次备份到现在产生的新数据

注意:在进行增量备份前先进行完整备份

案例:周一进行全备,周二到周天进行增量备份

​ 完整备份:(周一)

[root@xingdian ~]# innobackupex --user=root --password='QianFeng@123' /xtrabackup/full

​ 创建增量备份存放数据目录:

[root@xingdian ~]# mkdir /xtrabackup/zeng -p

​ 模拟数据增加(略)

​ 第一次增量备份:(周二)

[root@xingdian ~]# innobackupex --user=root --password='QianFeng@123' --incremental /xtrabackup/zeng/ --incremental-basedir=/xtrabackup/full/2022-09-25_19-40-47/

第一次增量备份的数据:
[root@xingdian ~]# ls /xtrabackup/zeng/
2022-09-25_19-56-00

​ 模拟数据增加(略)

​ 第二次增量备份:(周三)

[root@xingdian ~]# innobackupex --user=root --password='QianFeng@123' --incremental /xtrabackup/zeng/ --incremental-basedir=/xtrabackup/zeng/2022-09-25_19-56-00/

第二次增量备份的数据:
[root@xingdian ~]# ls /xtrabackup/zeng/
2022-09-25_19-56-00  2022-09-25_19-58-12

​ 后面的增量备份重复上面的操作(略)

增量备份数据恢复流程:(需要模拟数据的丢失)

​ 停止数据库:

[root@xingdian ~]# systemctl stop mysqld

​ 删除数据:

[root@xingdian ~]# rm -rf /var/lib/mysql/*
[root@xingdian ~]# rm -rf /var/log/mysqld.log

其他数据根据实际情况删除

​ 依次重演回滚:

全备回滚:
[root@xingdian ~]# innobackupex --apply-log --redo-only /xtrabackup/full/2022-09-25_19-40-47/

第一次增量回滚:
[root@xingdian ~]# innobackupex --apply-log --redo-only /xtrabackup/full/2022-09-25_19-40-47/ --incremental-dir=/xtrabackup/zeng/2022-09-25_19-56-00/

第二次增量回滚:
[root@xingdian ~]# innobackupex --apply-log --redo-only /xtrabackup/full/2022-09-25_19-40-47/ --incremental-dir=/xtrabackup/zeng/2022-09-25_19-58-12/

根据实际增量备份的次数回滚,可以想恢复到那个时间节点就回滚到那个时间节点,所有的回滚都给全备

​ 恢复数据:

[root@xingdian ~]# innobackupex --copy-back /xtrabackup/full/2022-09-25_19-40-47/

​ 修改权限:

[root@xingdian ~]# chown mysql.mysql /var/lib/mysql -R

​ 启动数据库:

[root@xingdian ~]# systemctl start mysqld

​ 验证:

[root@xingdian ~]# mysql -u root -pQianFeng@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 2
Server version: 5.7.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, 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                |
| t1                 |
| t2                 |
| t3                 |
+--------------------+
差异备份

原理:只备份跟完整备份不一样的

注意:在进行增量备份前先进行完整备份

案例:周一进行全备,周二到周天进行差异备份

​ 完整备份:(周一)

[root@xingdian ~]# mkdir -p /xtrabackup/full
[root@xingdian ~]# innobackupex --user=root --password=QianFeng@123 /xtrabackup/full

​ 模拟数据增加(略)

​ 第一次差异备份:(周二)

[root@xingdian ~]# mkdir -p /xtrabackup/jian
[root@xingdian ~]# innobackupex --user=root --password=QianFeng@123 --incremental /xtrabackup/jian --incremental-basedir=/xtrabackup/full/2022-09-25_20-10-52/

查看第一次差异备份的数据:
[root@xingdian ~]# ls /xtrabackup/jian/
2022-09-25_20-12-55

​ 模拟数据增加(略)

​ 第二次差异备份:(周三)

[root@xingdian ~]# innobackupex --user=root --password=QianFeng@123 --incremental /xtrabackup/jian --incremental-basedir=/xtrabackup/full/2022-09-25_20-10-52/

查看第二次差异备份的数据:
[root@xingdian ~]# ls /xtrabackup/jian/
2022-09-25_20-12-55  2022-09-25_20-14-32

注意:后面的差异备份跟之前一样,根据需求可以继续差异备份

差异备份恢复流程:(模拟数据丢失)

​ 停止数据库:

[root@xingdian ~]# systemctl stop mysqld

​ 删除数据:

[root@xingdian ~]# rm -rf /var/lib/mysql/*
[root@xingdian ~]# rm -rf /var/log/mysqld.log 

​ 重演数据回滚:

完整备份回滚:
[root@xingdian ~]# innobackupex --apply-log --redo-only /xtrabackup/full/2022-09-25_20-10-52/

差异备份回滚(根据差异备份的原理,如果恢复所有数据只需要将最后依次差异回滚)
[root@xingdian ~]# innobackupex --apply-log --redo-only /xtrabackup/full/2022-09-25_20-10-52/ --incremental-dir=/xtrabackup/jian/2022-09-25_20-14-32/

​ 恢复数据:

[root@xingdian ~]#  innobackupex --copy-back /xtrabackup/full/2022-09-25_20-10-52/

​ 修改权限:

[root@xingdian ~]# chown  mysql.mysql /var/lib/mysql -R

​ 启动数据库:

[root@xingdian ~]# systemctl start  mysqld

​ 数据验证:

[root@xingdian ~]# mysql -u root -pQianFeng@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 2
Server version: 5.7.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, 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 |
| k1                 |
| k2                 |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
9 rows in set (0.00 sec)
4.mysqldump备份

备份表:(前提有库有表)

[root@xingdian ~]# mysqldump -u root -pQianFeng@123 k1 t1 > /t1.sql

恢复表:(恢复之前模拟数据丢失)

[root@xingdian ~]# mysql -u root -pQianFeng@123 k1 < /t1.sql 
mysql: [Warning] Using a password on the command line interface can be insecure.

验证:

[root@xingdian ~]# mysql -u root -pQianFeng@123 -e "use k1;show tables"
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------+
| Tables_in_k1 |
+--------------+
| t1           |
+--------------+

备份一个库:

[root@xingdian ~]# mysqldump -u root -pQianFeng@123 k1 > /k1.sql

-B 备份多个库:

[root@xingdian ~]# mysqldump -u root -pQianFeng@123 -B k1 k2 > /kall.sql

-A 备份所有库:

[root@xingdian ~]# mysqldump -u root -pQianFeng@123 -A > /all.sql

数据恢复:

​ 为保证数据一致性,应在恢复数据之前停止数据库对外的服务,停止binlog日志

​ binlog使用binlog日志恢复数据时也会产生binlog日志(如果开启的话,需要关闭)

mysql> set sql_log_bin=0;
Query OK, 0 rows affected (0.00 sec)

​ 模拟数据丢失(略)

[root@xingdian ~]# mysql -u root -pQianFeng@123 -D k1 < /k1.sql 
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1049 (42000): Unknown database 'k1'
出现该错误是因为在恢复的时候需要有库的存在

[root@xingdian ~]# mysql -u root -pQianFeng@123 -e "create database k1"
[root@xingdian ~]# mysql -u root -pQianFeng@123 -D k1 < /k1.sql 

[root@xingdian ~]# mysql -u root -pQianFeng@123 -e "create database k1"
[root@xingdian ~]# mysql -u root -pQianFeng@123 -e "create database k2"
[root@xingdian ~]# mysql -u root -pQianFeng@123 -D k1 k2 < /kall.sql

或者
mysql> source  /k1.sql

验证:

[root@xingdian ~]# mysql -u root -pQianFeng@123 -e "use k1; show tables;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------+
| Tables_in_k1 |
+--------------+
| t1           |
+--------------+
[root@xingdian ~]# mysql -u root -pQianFeng@123 -e "use k2; show tables;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------+
| Tables_in_k2 |
+--------------+
| t1           |
+--------------+
5.binlog日志备份

原理:日志方法备份恢复数据

日志默认存储位置:

​ rpm : /var/lib/mysql

​ 编译: 安装目录的var下

产生日志:

​ 方式一:编译安装

[root@xingdian ~]# mysqld_safe --log-bin --user=mysql --server-id=1 &

查看binlog日志
[root@xingdian ~]# mysqlbinlog slave2-bin.000001     -v --base64-output=decode-rows
        时间点  :  141126 14:04:49
        位置点  :     at  106

​ 方式二:rpm安装(永久)

[root@xingdian ~]# vim /etc/my.cnf
log-bin=mylog
server-id=1        //做主从复制使用

[root@xingdian ~]# systemctl restart mysqld

查看:
[root@xingdian ~]# ls /var/lib/mysql
auto.cnf         client-key.pem  ib_logfile1   mysql               private_key.pem  sys
ca-key.pem       ib_buffer_pool  ibtmp1        mysql.sock          public_key.pem   xingdian-bin.index
ca.pem           ibdata1         mylog.000001  mysql.sock.lock     server-cert.pem  xtrabackup_info
client-cert.pem  ib_logfile0     mylog.index

[root@xingdian ~]# mysqlbinlog /var/lib/mysql/mylog.000001 -v --base64-output=decode-rows
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#220925 21:12:47 server id 1  end_log_pos 123 CRC32 0x52358645  Start: binlog v 4, server v 5.7.39-log created 220925 21:12:47 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
# at 123
#220925 21:12:47 server id 1  end_log_pos 154 CRC32 0xa84d8536  Previous-GTIDs
# [empty]
# at 154
#220925 21:13:38 server id 1  end_log_pos 219 CRC32 0xc2b00431  Anonymous_GTID  last_committed=0        sequence_number=1    rbr_only=no
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;
# at 219
#220925 21:13:38 server id 1  end_log_pos 307 CRC32 0x635401a5  Query   thread_id=2     exec_time=0     error_code=0
SET TIMESTAMP=1664111618/*!*/;
SET @@session.pseudo_thread_id=2/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=1436549152/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
create database t1
/*!*/;
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;
# End of log file
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

方法二:
mysql>  show binlog events in  "mylog.000001";
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
| Log_name     | Pos | Event_type     | Server_id | End_log_pos | Info                                  |
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
| mylog.000001 |   4 | Format_desc    |         1 |         123 | Server ver: 5.7.39-log, Binlog ver: 4 |
| mylog.000001 | 123 | Previous_gtids |         1 |         154 |                                       |
| mylog.000001 | 154 | Anonymous_Gtid |         1 |         219 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS'  |
| mylog.000001 | 219 | Query          |         1 |         307 | create database t1                    |
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
4 rows in set (0.00 sec)

默认查看第一个
mysql>  show binlog events;
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
| Log_name     | Pos | Event_type     | Server_id | End_log_pos | Info                                  |
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
| mylog.000001 |   4 | Format_desc    |         1 |         123 | Server ver: 5.7.39-log, Binlog ver: 4 |
| mylog.000001 | 123 | Previous_gtids |         1 |         154 |                                       |
| mylog.000001 | 154 | Anonymous_Gtid |         1 |         219 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS'  |
| mylog.000001 | 219 | Query          |         1 |         307 | create database t1                    |
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
4 rows in set (0.00 sec)

数据恢复:

​ 根据时间点恢复数据:

[root@xingdian ~]# mysqlbinlog --start-datetime='2022-9-25 21:12:47' --stop-datetime='2022-9-25 21:16:55' /var/lib/mysql/mylog.000001  | mysql -u root -pQianFeng@123

​ 根据位置点恢复数据:

mysql>  show binlog events;
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
| Log_name     | Pos | Event_type     | Server_id | End_log_pos | Info                                  |
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
| mylog.000001 |   4 | Format_desc    |         1 |         123 | Server ver: 5.7.39-log, Binlog ver: 4 |
| mylog.000001 | 123 | Previous_gtids |         1 |         154 |                                       |
| mylog.000001 | 154 | Anonymous_Gtid |         1 |         219 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS'  |
| mylog.000001 | 219 | Query          |         1 |         307 | create database t1                    |
| mylog.000001 | 307 | Anonymous_Gtid |         1 |         372 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS'  |
| mylog.000001 | 372 | Query          |         1 |         453 | drop database t1                      |
| mylog.000001 | 453 | Anonymous_Gtid |         1 |         518 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS'  |
| mylog.000001 | 518 | Query          |         1 |         606 | create database t1                    |
| mylog.000001 | 606 | Anonymous_Gtid |         1 |         671 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS'  |
| mylog.000001 | 671 | Query          |         1 |         752 | drop database t1                      |
+--------------+-----+----------------+-----------+-------------+---------------------------------------+
[root@xingdian ~]# mysqlbinlog --start-position 219 --stop-position 307 /var/lib/mysql/mylog.000001 | mysql -u root -pQianFeng@123

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

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

相关文章

GNU Radio FFT模块窗函数对比

文章目录 前言一、grc 图二、窗函数及对应的运行结果1、矩形窗2、汉明窗3、汉宁窗4、黑曼窗5、黑曼-哈里斯窗6、凯泽窗7、巴特利特窗8、平顶窗 前言 GNU Radio 中 FFT 模块的窗函数包括以下几种&#xff1a;矩形窗&#xff08;Rectangular Window&#xff09;、汉明窗&#xf…

分割模型Maskformer系列

maskformer&#xff1a;Per-Pixel Classification is Not All You Need for Semantic Segmentation 论文地址&#xff1a;https://arxiv.org/pdf/2107.06278 1.概述 传统的语义分割方法通常采用逐像素分类&#xff08;per-pixel classification&#xff09;&#xff0c;而实…

邦注科技 模具保护器 CCD电子眼 专业工业视觉检测设备

模具保护器是一种用于保护模具的设备&#xff0c;可以在塑料压铸和冲床等加工过程中起到保护模具的作用。以下是关于模具保护器在保护塑料压铸和冲床模具方面的应用&#xff1a; 塑料压铸模具保护器&#xff1a; 防止碰撞&#xff1a;在塑料压铸过程中&#xff0c;模具可能会…

【CSS基础--CSS选择器的常见用法】

CSS选择器的常见用法 1.CSS介绍1.1 基本语法规范1.2 引入样式1.3 规范 2. CSS选择器2.1 标签选择器2.2 类选择器2.3 ID选择器2.4 复合选择器 1.CSS介绍 CSS&#xff08;Cascading Style Sheet&#xff09;&#xff0c;层叠样式表&#xff0c;由于控制页面的样式。CSS能够对网页…

【已解决】‘pip‘ 不是内部或外部命令问题

&#x1f60e; 作者介绍&#xff1a;我是程序员行者孙&#xff0c;一个热爱分享技术的制能工人。计算机本硕&#xff0c;人工制能研究生。公众号&#xff1a;AI Sun&#xff0c;视频号&#xff1a;AI-行者Sun &#x1f388; 本文专栏&#xff1a;本文收录于《AI实战中的各种bug…

Linux网站服务

1.概念:HTML:超级文本编辑语言 网页:使用HTML,PHP,JAVA语言格式书写的文件。 主页:网页中呈现用户的第一个界面。 网站:多个网页组合而成的一台网站服务器。 URL:统一资源定位符&#xff0c;访问网站的地址。 网站架构:LAMP: LinuxApacheMYSQLPHP(系统服务器程序数据管理…

【JAVA语言-第20话】多线程详细解析(二)——线程安全,非线程安全的集合转换成线程安全

目录 线程安全 1.1 概述 1.2 案例分析 1.3 解决线程安全 1.3.1 synchronized关键字 1.3.1.1 同步代码块 1.3.1.2 同步方法 1.3.2 使用Lock锁 1.3.2.1 概述 代码示例 1.4 线程安全的类 1.4.1 非线程安全集合转换成线程安全集合 线程安全 1.1 概述 指如果有多…

外贸企业邮箱怎么注册?五款外贸企业邮箱注册步骤

专业的公司邮箱不但能提高企业形象&#xff0c;也能保证商业沟通的流畅与信息安全性。本文将详解五种常见的外贸企业邮箱——Zoho Mail公司邮箱、腾讯公司邮箱、阿里公司邮箱、网易公司邮箱以及Gmail公司邮箱的注册流程&#xff0c;协助外贸企业轻松完成邮箱注册&#xff0c;打…

安装Nox夜神模拟器关闭了HyperV后Docker运行不了怎么办?

1.背景 为了模拟真机&#xff0c;尝试安装了Nox夜神模拟器&#xff0c; 安装过程要求关闭Hyper-V。当时只是在程序安装卸载中关闭了系统服务。以为到时勾选上就好了。操作路径&#xff1a;控制面板\所有控制面板项\程序和功能\启用或关闭Windows功能\Hyper-V。 后来卸载掉了夜神…

代码随想录第四十七天|打家劫舍、打家劫舍Ⅱ、打家劫舍Ⅲ

题目链接&#xff1a;. - 力扣&#xff08;LeetCode&#xff09; 代码如下&#xff1a; 打家劫舍问题需要注意相邻房子不能偷&#xff0c;因此在偷与不偷的选择上可以归类为&#xff1a; 偷当前&#xff08;i&#xff09;的房子&#xff0c;则子问题变为前i-2个房子的偷取金额…

VMware虚拟机提示内存不足

VMware虚拟机&#xff0c;k8s集群搭建内存不足的问题 疑问&#xff1a;我的电脑是8G8G双通道的内存&#xff0c;当我在搭建k8s集群时给master-2G内存&#xff0c;node1-3G内存&#xff0c;node2-3G内存&#xff1b; 当依次打开虚拟机到node2时VM提示“物理内存不足&#xff0c;…

【第14章】spring-mvc之ajax

文章目录 前言一、准备二、单个值1.前端2.后端3. 结果 三、对象1.前端2.后端3. 结果 四、JSON对象1.前端2.后端3. 结果 五、JSON数组1.前端2.后端3. 结果 总结 前言 AJAX&#xff08;Asynchronous JavaScript and XML&#xff09;是一种用于创建快速动态网页的技术&#xff0c…

大模型微调实战之强化学习 贝尔曼方程及价值函数(一)

大模型微调实战之强化学习 贝尔曼方程及价值函数 强化学习&#xff08;RL&#xff09;是机器学习中一个话题&#xff0c;不仅在人工智能方面。它解决问题的方式与人类类似&#xff0c;我们每天都在学习并在生活中变得更好。 作为一名大模型学习者&#xff0c;当开始深入研究强…

2024蓝桥杯网络安全部分赛题wp

爬虫协议 题目给了提示访问robots.txt 会出三个目录 访问最后一个 点进去就flag{22560c15-577c-4c8b-9944-815473758bad} packet 下载附件&#xff0c;这个是流量包 放wireshark流量分析 搜http协议 发现有cat flag命令&#xff0c;直接看他返回的流量 最后base64解码即可…

Web服务器和Tomcat

Web介绍 对于http协议操作进行封装、简化web程序开发 部署web项目&#xff0c;对外提供上网信息浏览 Tomcat介绍 一个轻量级的web服务器 也称为web容器 Tomcat的文件夹介绍 下载地址&#xff1a;Apache Tomcat - Apache Tomcat 9 Software Downloads 安装&#xff1a;直…

嵌入式数据库SQLite 3配置使用详细笔记教程

0、惨痛教训 随着管理开发的项目体积越来越庞大&#xff0c;产品系统涉及的数据量也越来越多&#xff0c;并且伴随着项目不久就要交付给甲方了。如果项目的数据信息没有被妥善管理&#xff0c;后期设备的运行状态、操作状况等数据流信息不能被溯源&#xff0c;当出现了一些特殊…

typescript的入门到吐槽:看了typescript,发现前端真的卷,

typescript TypeScript 是一种由微软开发的自由和开源的编程语言。它是 JavaScript 的一个超集&#xff0c;而且本质上向这个语言添加了可选的静态类型和基于类的面向对象编程。 TypeScript 与 JavaScript 的区别 其实就是对JavaScript的封装&#xff0c;把一个弱类型语言封…

“王翦五讨赏地,萧何三贬其身”的背后,正是智者安身的处世之道

冯子曰&#xff1a;智者&#xff0c;术所以生也&#xff1b;术者&#xff0c;智所以转也。 智慧的人&#xff0c;从不蛮行横性&#xff0c;而是懂得如何在世道和自我之间谋得最佳的处境。 01、王翦五讨赏地 战国时期&#xff0c;秦始皇派王翦率六十万大军攻打楚国&#xff0…

【SpringBoot】 什么是springboot(一)?如何搭建springboot项目?

文章目录 SpringBoot第一章1、什么是springboot1、回顾ssm项目搭建流程2、springboot项目的优点2、搭建springboot项目方式1:方式2:第二章1、基本配置1、热部署2、注解3、端口配置application.properties特点application.yml特点注意4、环境配置springboot中的配置文件要求5、…

深度学习——前馈全连接神经网络

前馈全连接神经网络 1.导入需要的工具包2.数据导入与数据观察&#xff08;1&#xff09;读取csv的文件信息&#xff1a;&#xff08;2&#xff09;训练数据前5行&#xff08;3&#xff09;打印第一个图&#xff08;4&#xff09;观察数据中的信息&#xff08;5&#xff09;查看…