關於mysqldump備份非事務表的註意事項

来源:https://www.cnblogs.com/aaron8219/archive/2018/07/29/9388204.html
-Advertisement-
Play Games

占座 ...


  Preface       We're used to get a logical backup set(whole instance) by simply specifying "--single-transaction" and "--master-data" options.For innodb engine tables,we can get a consistent backup.But the non-innodb(not supporting transaction) tables may be not backed up consistently in MySQL 5.7.   Procedure   Check and open general log(if have not enabled it yet).
 1 (zlm@192.168.1.101 3306)[(none)]>show variables like 'general_log';
 2 +---------------+-------+
 3 | Variable_name | Value |
 4 +---------------+-------+
 5 | general_log   | OFF   |
 6 +---------------+-------+
 7 1 row in set (0.00 sec)
 8 
 9 (zlm@192.168.1.101 3306)[(none)]>set @@global.general_log=on;
10 Query OK, 0 rows affected (0.01 sec)
11 
12 (zlm@192.168.1.101 3306)[(none)]>show variables like 'general_log';
13 +---------------+-------+
14 | Variable_name | Value |
15 +---------------+-------+
16 | general_log   | ON    |
17 +---------------+-------+
18 1 row in set (0.00 sec)

 

Clear the content of general log and tail it.

1 [root@zlm2 09:35:07 /data/mysql/mysql3306/data]
2 #echo ''> zlm2.log
3 
4 [root@zlm2 09:35:13 /data/mysql/mysql3306/data]
5 #tail -f zlm2.log

 

Create test tables.

 1 (zlm@192.168.1.101 3306)[(none)]>create database zlm;
 2 Query OK, 1 row affected (0.00 sec)
 3 
 4 (zlm@192.168.1.101 3306)[(none)]>use zlm;
 5 Database changed
 6 
 7 (zlm@192.168.1.101 3306)[(none)]>create table test_trx(
 8     -> id int,
 9     -> name varchar(10)
10     -> ) engine=innodb;
11 Query OK, 0 rows affected (0.01 sec)
12 
13 (zlm@192.168.1.101 3306)[zlm]>insert into test_trx values(1,'zlm');
14 Query OK, 1 row affected (0.01 sec)
15 
16 (zlm@192.168.1.101 3306)[zlm]>create table test_notrx like test_trx;
17 Query OK, 0 rows affected (0.01 sec)
18 
19 (zlm@192.168.1.101 3306)[zlm]>insert into test_notrx values(2,'aaron8219');
20 Query OK, 1 row affected (0.00 sec)
21 
22 (zlm@192.168.1.101 3306)[zlm]>alter table test_notrx engine=MyISAM;
23 Query OK, 1 row affected (0.01 sec)
24 Records: 1  Duplicates: 0  Warnings: 0
25 
26 (zlm@192.168.1.101 3306)[zlm]>show create table test_trx\G
27 *************************** 1. row ***************************
28        Table: test_trx
29 Create Table: CREATE TABLE `test_trx` (
30   `id` int(11) DEFAULT NULL,
31   `name` varchar(10) DEFAULT NULL
32 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
33 1 row in set (0.00 sec)
34 
35 (zlm@192.168.1.101 3306)[zlm]>show create table test_notrx\G
36 *************************** 1. row ***************************
37        Table: test_notrx
38 Create Table: CREATE TABLE `test_notrx` (
39   `id` int(11) DEFAULT NULL,
40   `name` varchar(10) DEFAULT NULL
41 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
42 1 row in set (0.00 sec)
43 
44 (zlm@192.168.1.101 3306)[zlm]>select * from test_trx;
45 +------+------+
46 | id   | name |
47 +------+------+
48 |    1 | zlm  |
49 +------+------+
50 1 row in set (0.00 sec)
51 
52 (zlm@192.168.1.101 3306)[zlm]>select * from test_notrx;
53 +------+-----------+
54 | id   | name      |
55 +------+-----------+
56 |    2 | aaron8219 |
57 +------+-----------+
58 1 row in set (0.00 sec)

 

Generate a backup with mysqldump specifying common option of "--single-transaction" together with "--master-data=2".

 1 [root@zlm2 09:36:23 ~]
 2 #mysqldump --single-transaction --master-data=2 zlm > test1.sql
 3 
 4 //General log output below.
 5 2018-07-30T09:45:17.815021+01:00        4 Connect    zlm@zlm2 on  using TCP/IP
 6 2018-07-30T09:45:17.815290+01:00        4 Query    /*!40100 SET @@SQL_MODE='' */
 7 2018-07-30T09:45:17.815445+01:00        4 Query    /*!40103 SET TIME_ZONE='+00:00' */
 8 2018-07-30T09:45:17.815862+01:00        4 Query    FLUSH /*!40101 LOCAL */ TABLES
 9 2018-07-30T09:45:17.823118+01:00        4 Query    FLUSH TABLES WITH READ LOCK //Generate a FTWRL.
10 2018-07-30T09:45:17.823435+01:00        4 Query    SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ
11 2018-07-30T09:45:17.823684+01:00        4 Query    START TRANSACTION /*!40100 WITH CONSISTENT SNAPSHOT */
12 2018-07-30T09:45:17.823904+01:00        4 Query    SHOW VARIABLES LIKE 'gtid\_mode'
13 2018-07-30T09:45:17.826626+01:00        4 Query    SELECT @@GLOBAL.GTID_EXECUTED
14 2018-07-30T09:45:17.827032+01:00        4 Query    SHOW MASTER STATUS
15 2018-07-30T09:45:17.827278+01:00        4 Query    UNLOCK TABLES //Release the locks on all tables in whole instance.
16 2018-07-30T09:45:17.827480+01:00        4 Query    SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('zlm'))) GROUP BY LOGFILE_GROUP_NAME, FILE_NAME, ENGINE, TOTAL_EXTENTS, INITIAL_SIZE ORDER BY LOGFILE_GROUP_NAME
17 2018-07-30T09:45:17.828912+01:00        4 Query    SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('zlm')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME
18 2018-07-30T09:45:17.830942+01:00        4 Query    SHOW VARIABLES LIKE 'ndbinfo\_version'
19 2018-07-30T09:45:17.833548+01:00        4 Init DB    zlm
20 2018-07-30T09:45:17.833785+01:00        4 Query    SAVEPOINT sp
21 2018-07-30T09:45:17.833963+01:00        4 Query    show tables
22 2018-07-30T09:45:17.834252+01:00        4 Query    show table status like 'test\_notrx'
23 2018-07-30T09:45:17.834449+01:00        4 Query    SET SQL_QUOTE_SHOW_CREATE=1
24 2018-07-30T09:45:17.834582+01:00        4 Query    SET SESSION character_set_results = 'binary'
25 2018-07-30T09:45:17.834781+01:00        4 Query    show create table `test_notrx`
26 2018-07-30T09:45:17.835621+01:00        4 Query    SET SESSION character_set_results = 'utf8'
27 2018-07-30T09:45:17.835851+01:00        4 Query    show fields from `test_notrx`
28 2018-07-30T09:45:17.836362+01:00        4 Query    show fields from `test_notrx`
29 2018-07-30T09:45:17.836843+01:00        4 Query    SELECT /*!40001 SQL_NO_CACHE */ * FROM `test_notrx`
30 2018-07-30T09:45:17.837327+01:00        4 Query    SET SESSION character_set_results = 'binary'
31 2018-07-30T09:45:17.838289+01:00        4 Query    use `zlm`
32 2018-07-30T09:45:17.838723+01:00        4 Query    select @@collation_database
33 2018-07-30T09:45:17.838908+01:00        4 Query    SHOW TRIGGERS LIKE 'test\_notrx'
34 2018-07-30T09:45:17.839457+01:00        4 Query    SET SESSION character_set_results = 'utf8'
35 2018-07-30T09:45:17.839678+01:00        4 Query    ROLLBACK TO SAVEPOINT sp
36 2018-07-30T09:45:17.839821+01:00        4 Query    show table status like 'test\_trx'
37 2018-07-30T09:45:17.840112+01:00        4 Query    SET SQL_QUOTE_SHOW_CREATE=1
38 2018-07-30T09:45:17.840248+01:00        4 Query    SET SESSION character_set_results = 'binary'
39 2018-07-30T09:45:17.840364+01:00        4 Query    show create table `test_trx`
40 2018-07-30T09:45:17.840675+01:00        4 Query    SET SESSION character_set_results = 'utf8'
41 2018-07-30T09:45:17.840828+01:00        4 Query    show fields from `test_trx`
42 2018-07-30T09:45:17.841258+01:00        4 Query    show fields from `test_trx`
43 2018-07-30T09:45:17.841774+01:00        4 Query    SELECT /*!40001 SQL_NO_CACHE */ * FROM `test_trx`
44 2018-07-30T09:45:17.842205+01:00        4 Query    SET SESSION character_set_results = 'binary'
45 2018-07-30T09:45:17.842370+01:00        4 Query    use `zlm`
46 2018-07-30T09:45:17.842646+01:00        4 Query    select @@collation_database
47 2018-07-30T09:45:17.842814+01:00        4 Query    SHOW TRIGGERS LIKE 'test\_trx'
48 2018-07-30T09:45:17.844200+01:00        4 Query    SET SESSION character_set_results = 'utf8'
49 2018-07-30T09:45:17.844540+01:00        4 Query    ROLLBACK TO SAVEPOINT sp
50 2018-07-30T09:45:17.844803+01:00        4 Query    RELEASE SAVEPOINT sp
51 2018-07-30T09:45:17.847871+01:00        4 Quit
52 
53 //The "unlock tables" operation was executed very soon after a short period of time of getting gtid information.
54 //After the releasing lock operation,the consistency of transaction table can be guaranteed while the non-transaction table cannot be.

 

This time merely use "--master-data=2".

 1 [root@zlm2 09:45:17 ~]
 2 #mysqldump --master-data=2 zlm > test2.sql
 3 
 4 //General log output below.
 5 2018-07-30T10:06:41.766819+01:00        5 Connect    zlm@zlm2 on  using TCP/IP
 6 2018-07-30T10:06:41.767265+01:00        5 Query    /*!40100 SET @@SQL_MODE='' */
 7 2018-07-30T10:06:41.767495+01:00        5 Query    /*!40103 SET TIME_ZONE='+00:00' */
 8 2018-07-30T10:06:41.767852+01:00        5 Query    FLUSH /*!40101 LOCAL */ TABLES
 9 2018-07-30T10:06:41.768067+01:00        5 Query    FLUSH TABLES WITH READ LOCK //It still generate a FTWRL.
10 2018-07-30T10:06:41.768237+01:00        5 Query    SHOW VARIABLES LIKE 'gtid\_mode'
11 2018-07-30T10:06:41.770245+01:00        5 Query    SELECT @@GLOBAL.GTID_EXECUTED
12 2018-07-30T10:06:41.770659+01:00        5 Query    SHOW MASTER STATUS //No releasing lock operation here.
13 2018-07-30T10:06:41.770955+01:00        5 Query    SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('zlm'))) GROUP BY LOGFILE_GROUP_NAME, FILE_NAME, ENGINE, TOTAL_EXTENTS, INITIAL_SIZE ORDER BY LOGFILE_GROUP_NAME
14 2018-07-30T10:06:41.773632+01:00        5 Query    SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('zlm')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME
15 2018-07-30T10:06:41.775734+01:00        5 Query    SHOW VARIABLES LIKE 'ndbinfo\_version'
16 2018-07-30T10:06:41.777953+01:00        5 Init DB    zlm
17 2018-07-30T10:06:41.778223+01:00        5 Query    show tables
18 2018-07-30T10:06:41.778529+01:00        5 Query    show table status like 'test\_notrx'
19 2018-07-30T10:06:41.778898+01:00        5 Query    SET SQL_QUOTE_SHOW_CREATE=1
20 2018-07-30T10:06:41.779149+01:00        5 Query    SET SESSION character_set_results = 'binary'
21 2018-07-30T10:06:41.780362+01:00        5 Query    show create table `test_notrx`
22 2018-07-30T10:06:41.780722+01:00        5 Query    SET SESSION character_set_results = 'utf8'
23 2018-07-30T10:06:41.780907+01:00        5 Query    show fields from `test_notrx`
24 2018-07-30T10:06:41.781665+01:00        5 Query    show fields from `test_notrx`
25 2018-07-30T10:06:41.782447+01:00        5 Query    SELECT /*!40001 SQL_NO_CACHE */ * FROM `test_notrx`
26 2018-07-30T10:06:41.782788+01:00        5 Query    SET SESSION character_set_results = 'binary'
27 2018-07-30T10:06:41.782945+01:00        5 Query    use `zlm`
28 2018-07-30T10:06:41.783298+01:00        5 Query    select @@collation_database
29 2018-07-30T10:06:41.783425+01:00        5 Query    SHOW TRIGGERS LIKE 'test\_notrx'
30 2018-07-30T10:06:41.784086+01:00        5 Query    SET SESSION character_set_results = 'utf8'
31 2018-07-30T10:06:41.790618+01:00        5 Query    show table status like 'test\_trx'
32 2018-07-30T10:06:41.791015+01:00        5 Query    SET SQL_QUOTE_SHOW_CREATE=1
33 2018-07-30T10:06:41.791094+01:00        5 Query    SET SESSION character_set_results = 'binary'
34 2018-07-30T10:06:41.791192+01:00        5 Query    show create table `test_trx`
35 2018-07-30T10:06:41.791285+01:00        5 Query    SET SESSION character_set_results = 'utf8'
36 2018-07-30T10:06:41.791360+01:00        5 Query    show fields from `test_trx`
37 2018-07-30T10:06:41.792328+01:00        5 Query    show fields from `test_trx`
38 2018-07-30T10:06:41.792837+01:00        5 Query    SELECT /*!40001 SQL_NO_CACHE */ * FROM `test_trx`
39 2018-07-30T10:06:41.793036+01:00        5 Query    SET SESSION character_set_results = 'binary'
40 2018-07-30T10:06:41.793147+01:00        5 Query    use `zlm`
41 2018-07-30T10:06:41.793277+01:00        5 Query    select @@collation_database
42 2018-07-30T10:06:41.793381+01:00        5 Query    SHOW TRIGGERS LIKE 'test\_trx'
43 2018-07-30T10:06:41.794223+01:00        5 Query    SET SESSION character_set_results = 'utf8'
44 2018-07-30T10:06:41.799961+01:00        5 Quit
45 
46 //No RR isolation level and consistent snapshot this time what means the consistency of transaction table cannot be guaranteed,too.
47 //As for the non-transaction table,it will hold the FTWRL until the backup finishes.That means it's consistent in the course.
48 //The bad influence is that the locking time will be extremly long.Because option of "--master-data" will enbale "--lock-all-tables" or "-x" option.

 

This time execute mysqldump without any option.

 1 [root@zlm2 10:16:20 ~]
 2 #mysqldump zlm > test3.sql
 3 
 4 //General log output below.
 5 2018-07-30T10:24:04.371650+01:00        6 Connect    zlm@zlm2 on  using TCP/IP
 6 2018-07-30T10:24:04.371651+01:00        6 Query    /*!40100 SET @@SQL_MODE='' */
 7 2018-07-30T10:24:04.371885+01:00        6 Query    /*!40103 SET TIME_ZONE='+00:00' */
 8 2018-07-30T10:24:04.372048+01:00        6 Query    SHOW VARIABLES LIKE 'gtid\_mode'
 9 2018-07-30T10:24:04.374903+01:00        6 Query    SELECT @@GLOBAL.GTID_EXECUTED
10 2018-07-30T10:24:04.376278+01:00        6 Query    SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('zlm'))) GROUP BY LOGFILE_GROUP_NAME, FILE_NAME, ENGINE, TOTAL_EXTENTS, INITIAL_SIZE ORDER BY LOGFILE_GROUP_NAME
11 2018-07-30T10:24:04.378718+01:00        6 Query    SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('zlm')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME
12 2018-07-30T10:24:04.380381+01:00        6 Query    SHOW VARIABLES LIKE 'ndbinfo\_version'
13 2018-07-30T10:24:04.383136+01:00        6 Init DB    zlm
14 2018-07-30T10:24:04.383512+01:00        6 Query    show tables
15 2018-07-30T10:24:04.383922+01:00        6 Query    LOCK TABLES `test_notrx` READ /*!32311 LOCAL */,`test_trx` READ /*!32311 LOCAL */ //There're two individual locks here.
16 2018-07-30T10:24:04.384267+01:00        6 Query    show table status like 'test\_notrx'

              
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • VxWorks 7 是新一代的嵌入式實時操作系統,全新的架構設計,靈活化的組件配置,高可靠性與安全性,豐富的第三方軟體包,極大的方便用戶的開發和使用。本文對VxWorks7 的功能做個簡要的記錄。 VxWorks 7 平臺和配置 VxWorks 7 內核平臺提供 VxWorks 和 Workbenc ...
  • 1、yum:基於RPM包構建軟體更新機制自動解決依賴關係,軟體包由軟體包庫提供 提供方式:ftp服務:ftp://IP地址/倉庫目錄 Http服務:http :// IP地址/倉庫目錄 本地目錄:file://本地目錄 2、構建本地yum vim /etc/yum.repos.d/hanming.r ...
  • 1、yum配置 yum的配置文件在 /etc/yum.conf $releasever 當前系統的發行版本,$basearch CPU體系,使用命令 arch 查看 2、配置yum源 yum源文件在 /etc/yum.repos.d/ 中 看到 .repo 結尾的文件都是yum文件,其中,CentO ...
  • 1,Startx:切換到圖形界面 2,Pwd:查看當前目錄 3,Whoami:查看當前用戶 4,Cd: 1. 命令格式: cd [目錄名] 2. 命令功能: 切換當前目錄至dirName 3. 常用範例 3.1 例一:進入系統根目錄 命令: 輸出: 說明:進入系統根目錄,上面命令執行完後拿ls命令看 ...
  • 本篇文章主要介紹SqlServer使用時的註意事項。 想成為一個高級程式員,資料庫的使用是必須要會的。而資料庫的使用純熟程度,也側面反映了一個開放的水平。 下麵介紹SqlServer在使用和設計的過程中需要註意的事項。 SqlServer註意事項 Sql事務啟動語句 開始事務:BEGIN TRANS ...
  • 系列目錄 一、安裝MySql 二、安裝並破解Navicat 三、沒有my.in配置文件怎麼辦 四、設置MySql的大小寫敏感 五、重置MySql登陸密碼 這一篇可以說是我的踩坑的血淚史了。。。 MySql在Windows下預設是大小寫不敏感的,當表名中有大寫字母的時候,MySql會直接把它轉化成小寫 ...
  • 本文通過大量圖片來分析和描述分庫、分表以及資料庫分區是怎樣進行的。 1.sharding前的初始數據分佈 在本文中,我打算用高考考生相關信息作為實驗數據。請無視表的欄位是否符合現實,也請無視表的設計是否符合範式。 3張表: 考生表,存放全國所有高考考生信息,假設34個省、(直轄)市、(自治區、特別行 ...
  • if exists(select * from sys.objects where name='存儲過程名稱')drop proc 存儲過程名稱goCREATE proc 存儲過程名稱@tableName varchar(8000), --表名、視圖名@indexCol varchar(50) = ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...