利用binlog2sql閃回丟失數據

来源:https://www.cnblogs.com/aaron8219/archive/2018/06/06/9144547.html
-Advertisement-
Play Games

today,i'll using the open source tool named "binlog2sql" which is release by danfengchao to do some flashback test. here's the github address:https:// ...


    today,i'll using the open source tool named "binlog2sql" which is release by danfengchao to do some flashback test.     here's the github address:https://github.com/danfengcao/binlog2sql     according to the readme.md doc,using "git" command to download it at the beginning:  

 

1 ns-notepc399+jujun@ns-notepc399 MINGW64 /d/vagrant
2 $ git clone https://github.com/danfengcao/binlog2sql.git && cd binlog2sql
3 Cloning into 'binlog2sql'...
4 remote: Counting objects: 294, done.
5 remote: Total 294 (delta 0), reused 0 (delta 0), pack-reused 294
6 Receiving objects: 100% (294/294), 142.05 KiB | 108.00 KiB/s, done.
7 Resolving deltas: 100% (152/152), done.
8 ns-notepc399+jujun@ns-notepc399 MINGW64 /d/vagrant/binlog2sql (master)

 

    secondly,"pip" command need to be installed,which can be downloaded on the official website:https://pypi.org/project/pip/     the latest version is 10.0.1 now,i choose the tar package to download.  
 1 [root@zlm3 07:46:15 /vagrant/pip-10.0.1]
 2 #pwd
 3 /vagrant/pip-10.0.1
 4 
 5 [root@zlm3 07:46:24 /vagrant/pip-10.0.1]
 6 #ls -l
 7 total 104
 8 -rwxrwxrwx 1 vagrant vagrant 14750 Jun  6 07:46 AUTHORS.txt
 9 drwxrwxrwx 1 vagrant vagrant     0 Jun  6 07:47 build
10 drwxrwxrwx 1 vagrant vagrant     0 Jun  6 07:47 dist
11 drwxrwxrwx 1 vagrant vagrant  4096 Apr 19 20:52 docs
12 -rwxrwxrwx 1 vagrant vagrant  1110 Jun  6 07:46 LICENSE.txt
13 -rwxrwxrwx 1 vagrant vagrant   663 Jun  6 07:46 MANIFEST.in
14 -rwxrwxrwx 1 vagrant vagrant 75033 Jun  6 07:46 NEWS.rst
15 -rwxrwxrwx 1 vagrant vagrant  2972 Jun  6 07:46 PKG-INFO
16 -rwxrwxrwx 1 vagrant vagrant   886 Jun  6 07:46 pyproject.toml
17 -rwxrwxrwx 1 vagrant vagrant  1472 Jun  6 07:46 README.rst
18 -rwxrwxrwx 1 vagrant vagrant   627 Jun  6 07:46 setup.cfg
19 -rwxrwxrwx 1 vagrant vagrant  2879 Jun  6 07:46 setup.py
20 drwxrwxrwx 1 vagrant vagrant     0 Apr 19 20:52 src
21 
22 [root@zlm3 07:46:37 /vagrant/pip-10.0.1]
23 #python install setup.py
24 python: can't open file 'install': [Errno 2] No such file or directory
25 
26 [root@zlm3 07:46:51 /vagrant/pip-10.0.1]
27 #python setup.py install
28 /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
29   warnings.warn(msg)
30 running install
31 running bdist_egg
32 running egg_info
33 writing requirements to src/pip.egg-info/requires.txt
34 writing src/pip.egg-info/PKG-INFO
35 writing top-level names to src/pip.egg-info/top_level.txt
36 writing dependency_links to src/pip.egg-info/dependency_links.txt
37 writing entry points to src/pip.egg-info/entry_points.txt
38 reading manifest file 'src/pip.egg-info/SOURCES.txt'
39 reading manifest template 'MANIFEST.in'
40 ... -- Here,i omitted the output 'cause too many rows.

 

    then,use the "pip" command to install necessary python package below:  
 1 [root@zlm3 08:54:58 /root/binlog2sql]
 2 #pwd
 3 /vagrant/binlog2sql
 4 
 5 [root@zlm3 08:56:00 /root/binlog2sql]
 6 #ls -l
 7 total 52
 8 drwxrwxrwx 2 root root    69 Jun  6 07:21 binlog2sql
 9 drwxrwxrwx 2 root root    53 Jun  6 07:21 example
10 -rwxrwxrwx 1 root root 35815 Jun  6 07:21 LICENSE
11 -rwxrwxrwx 1 root root  9749 Jun  6 07:21 README.md
12 -rwxrwxrwx 1 root root    57 Jun  6 07:21 requirements.txt
13 drwxrwxrwx 2 root root    36 Jun  6 07:21 tests
14 
15 [root@zlm3 08:56:20 /root/binlog2sql]
16 #cat requirements.txt 
17 PyMySQL==0.7.11
18 wheel==0.29.0
19 mysql-replication==0.13
20 
21 [root@zlm3 08:57:05 /root/binlog2sql]
22 #pip install -r requirements.txt
23 Collecting PyMySQL==0.7.11 (from -r requirements.txt (line 1))
24   Downloading https://files.pythonhosted.org/packages/c6/42/c54c280d8418039bd2f61284f99cb6d9e0eae80383fc72ceb6eac67855fe/PyMySQL-0.7.11-py2.py3-none-any.whl (78kB)
25     100% |?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..| 81kB 145kB/s 
26 Collecting wheel==0.29.0 (from -r requirements.txt (line 2))
27   Downloading https://files.pythonhosted.org/packages/8a/e9/8468cd68b582b06ef554be0b96b59f59779627131aad48f8a5bce4b13450/wheel-0.29.0-py2.py3-none-any.whl (66kB)
28     100% |?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..| 71kB 356kB/s 
29 Collecting mysql-replication==0.13 (from -r requirements.txt (line 3))
30   Downloading https://files.pythonhosted.org/packages/dd/23/384047702e694139e9fe75a8ba7ad007e8942fd119ebadabc32ce19f70f2/mysql-replication-0.13.tar.gz
31 Installing collected packages: PyMySQL, wheel, mysql-replication
32   Running setup.py install for mysql-replication ... done
33 Successfully installed PyMySQL-0.7.11 mysql-replication-0.13 wheel-0.29.0
34 
35 [root@zlm3 08:56:20 /root/binlog2sql]
36 #

 

  the binlog2sql tool has been installed,let's begin the test now:  
 1 (root@localhost mysql3306.sock)[zlm]09:27:16>create table flash_test(
 2     -> id int unsigned not null auto_increment,
 3     -> code bigint unsigned not null default '0',
 4     -> primary key(id)
 5     -> ) engine=innodb charset utf8mb4;
 6 Query OK, 0 rows affected (0.02 sec)
 7 
 8 (root@localhost mysql3306.sock)[zlm]09:27:26>delimiter $$
 9 (root@localhost mysql3306.sock)[zlm]09:27:41>create procedure pro_insert (count int)
10     -> begin
11     -> declare i int unsigned default 0;
12     -> start transaction;
13     -> while i < count do
14     -> insert into flash_test(code) values(i);
15     -> set i=i+1;
16     -> end while;
17     -> commit;
18     -> end;
19     -> $$
20 Query OK, 0 rows affected (0.00 sec)
21 
22 (root@localhost mysql3306.sock)[zlm]09:27:41>delimiter ;
23 (root@localhost mysql3306.sock)[zlm]09:27:42>call pro_insert(10000);
24 Query OK, 0 rows affected (0.33 sec)
25 
26 (root@localhost mysql3306.sock)[zlm]09:27:55>select count(*) from flash_test;
27 +----------+
28 | count(*) |
29 +----------+
30 |    10000 |
31 +----------+
32 1 row in set (0.01 sec)
33 
34 (root@localhost mysql3306.sock)[zlm]09:28:43>select * from flash_test limit 5;
35 +----+------+
36 | id | code |
37 +----+------+
38 |  1 |    0 |
39 |  2 |    1 |
40 |  3 |    2 |
41 |  4 |    3 |
42 |  5 |    4 |
43 +----+------+
44 5 rows in set (0.00 sec)
45 
46 (root@localhost mysql3306.sock)[zlm]09:28:50>

 

  then,pretend to delete all the records in the table "flash_table" by accidentally:  
 1 (root@localhost mysql3306.sock)[zlm]09:28:50>show binary logs;
 2 +------------------+-----------+
 3 | Log_name         | File_size |
 4 +------------------+-----------+
 5 | mysql-bin.000001 |       177 |
 6 | mysql-bin.000002 |       177 |
 7 | mysql-bin.000003 |   1012934 |
 8 +------------------+-----------+
 9 3 rows in set (0.00 sec)
10 
11 (root@localhost mysql3306.sock)[zlm]09:30:07>flush logs;
12 Query OK, 0 rows affected (0.02 sec)
13 
14 (root@localhost mysql3306.sock)[zlm]09:30:21>delete from flash_test;
15 Query OK, 10000 rows affected (0.05 sec)
16 
17 (root@localhost mysql3306.sock)[zlm]09:30:39>select count(*) from flash_test;
18 +----------+
19 | count(*) |
20 +----------+
21 |        0 |
22 +----------+
23 1 row in set (0.00 sec)
24 
25 (root@localhost mysql3306.sock)[zlm]09:30:47>show binary logs;
26 +------------------+-----------+
27 | Log_name         | File_size |
28 +------------------+-----------+
29 | mysql-bin.000001 |       177 |
30 | mysql-bin.000002 |       177 |
31 | mysql-bin.000003 |   1012981 |
32 | mysql-bin.000004 |    130974 |
33 +------------------+-----------+
34 4 rows in set (0.00 sec)
35 
36 (root@localhost mysql3306.sock)[zlm]09:31:33>

 

   it's the right time using the binlog2sql to flashback the missing data:  
  1 [root@zlm3 09:36:57 ~/binlog2sql/binlog2sql]
  2 #python binlog2sql.py -h192.168.1.102 -P3306 -uroot -pPassw0rd -dzlm -tflash_table --start-file='mysql-bin.000004'
  3 Traceback (most recent call last):
  4   File "binlog2sql.py", line 149, in <module>
  5     back_interval=args.back_interval, only_dml=args.only_dml, sql_type=args.sql_type)
  6   File "binlog2sql.py", line 46, in __init__
  7     self.connection = pymysql.connect(**self.conn_setting)
  8   File "/usr/lib/python2.7/site-packages/pymysql/__init__.py", line 90, in Connect
  9     return Connection(*args, **kwargs)
 10   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 706, in __init__
 11     self.connect()
 12   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 932, in connect
 13     self._request_authentication()
 14   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1152, in _request_authentication
 15     auth_packet = self._read_packet()
 16   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1014, in _read_packet
 17     packet.check_error()
 18   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 393, in check_error
 19     err.raise_mysql_exception(self._data)
 20   File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
 21     raise errorclass(errno, errval)
 22 pymysql.err.OperationalError: (1045, u"Access denied for user 'root'@'zlm3' (using password: YES)")  --It seems the connection failure.
 23 
 24 [root@zlm3 09:37:32 ~/binlog2sql/binlog2sql]
 25 #mysql
 26 Welcome to the MySQL monitor.  Commands end with ; or \g.
 27 Your MySQL connection id is 15
 28 Server version: 5.7.21-log MySQL Community Server (GPL)
 29 
 30 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 31 
 32 Oracle is a registered trademark of Oracle Corporation and/or its
 33 affiliates. Other names may be trademarks of their respective
 34 owners.
 35 
 36 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 37 
 38 (root@localhost mysql3306.sock)[(none)]09:43:33>alter user 'root'@'192.168.1.102' identified by 'Passw0rd';
 39 ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'192.168.1.102'
 40 (root@localhost mysql3306.sock)[(none)]09:44:10>create user 'root'@'192.168.1.102' identified by 'Passw0rd';
 41 Query OK, 0 rows affected (0.00 sec)
 42 
 43 (root@localhost mysql3306.sock)[(none)]09:47:37>exit
 44 Bye
 45 
 46 [root@zlm3 09:47:40 ~/binlog2sql/binlog2sql]
 47 #python binlog2sql.py -h192.168.1.102 -P3306 -uroot -pPassw0rd -dzlm -tflash_table --start-file='mysql-bin.000004'
 48 Traceback (most recent call last):
 49   File "binlog2sql.py", line 149, in <module>
 50     back_interval=args.back_interval, only_dml=args.only_dml, sql_type=args.sql_type)
 51   File "binlog2sql.py", line 48, in __init__
 52     cursor.execute("SHOW MASTER STATUS")
 53   File "/usr/lib/python2.7/site-packages/pymysql/cursors.py", line 166, in execute
 54     result = self._query(query)
 55   File "/usr/lib/python2.7/site-packages/pymysql/cursors.py", line 322, in _query
 56     conn.query(q)
 57   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 856, in query
 58     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
 59   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1057, in _read_query_result
 60     result.read()
 61   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1340, in read
 62     first_packet = self.connection._read_packet()
 63   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1014, in _read_packet
 64     packet.check_error()
 65   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 393, in check_error
 66     err.raise_mysql_exception(self._data)
 67   File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
 68     raise errorclass(errno, errval)
 69 pymysql.err.InternalError: (1227, u'Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation')  --The user 'root'@'192.168.1.102' is short of imperative privileges.
 70 
 71 [root@zlm3 09:47:43 ~/binlog2sql/binlog2sql]
 72 #mysql
 73 Welcome to the MySQL monitor.  Commands end with ; or \g.
 74 Your MySQL connection id is 17
 75 Server version: 5.7.21-log MySQL Community Server (GPL)
 76 
 77 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 78 
 79 Oracle is a registered trademark of Oracle Corporation and/or its
 80 affiliates. Other names may be trademarks of their respective
 81 owners.
 82 
 83 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 84 
 85 (root@localhost mysql3306.sock)[(none)]09:49:43>grant select,replication slave,replication client on *.* to 'root'@'192.168.1.102';
 86 Query OK, 0 rows affected (0.00 sec)
 87 
 88 (root@localhost mysql3306.sock)[(none)]09:50:24>exit
 89 Bye
 90 
 91 [root@zlm3 09:50:29 ~/binlog2sql/binlog2sql]
 92 #python binlog2sql.py -h192.168.1.102 -P3306 -uroot -pPassw0rd -dzlm -tflash_table --start-file='mysql-bin.000004'
 93 CREATE USER 'root'@'192.168.1.102' IDENTIFIED WITH 'mysql_native_password' AS '*DDFB542AA0BD1D251995D81AEBEB96DEEAD1132F';
 94 GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'root'@'192.168.1.102';
 95 
 96 [root@zlm3 09:50:32 ~/binlog2sql/binlog2sql]
 97 #python binlog2sql.py -h192.168.1.102 -P3306 -uroot -pPassw0rd -dzlm -tflash_table --start-file='mysql-bin.000003'
 98 CREATE USER 'repl'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*872ECE72A7EBAC6A183C90D7043D5F359BD85A9E';
 99 GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
100 USE zlm;
101 create table flash_test(
102 id int unsigned not null auto_increment,
103 code bigint unsigned not null default '0',
104 primary key(id)
105 ) engine=innodb charset utf8mb4;
106 USE zlm;
107 CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insert`(count int)
108 begin
109 declare i int unsigned default 0;
110 start transaction;
111 while i < count do
112 insert into flash_test(code) values(i);
113 set i=i+1;
114 end while;
115 commit;
116 end;
117 
118 [root@zlm3 09:51:06 ~/binlog2sql/binlog2sql]
119 #python binlog2sql.py -h192.168.1.102 -P3306 -uroot -pPassw0rd -dzlm -tflash_table --start-file='mysql-bin.000004' --only-dml --sql-typedelete --stop-never > flashback.sql
120 usage: binlog2sql.py [-h HOST] [-u USER] [-p PASSWORD] [-P PORT]
121                      [--start-file START_FILE] [--start-position START_POS]
122                      [--stop-file END_FILE] [--stop-position END_POS]
123                      [--start-datetime START_TIME] [--stop-datetime STOP_TIME]
124                      [--stop-never] [--help] [-d [DATABASES [DATABASES ...]]]
125                      [-t [TABLES [TABLES ...]]] [--only-dml]
126                      [--sql-type [SQL_TYPE [SQL_TYPE ...]]] [-K] [-B]
127                      [--back-interval BACK_INTERVAL]
128 binlog2sql.py: error: unrecognized arguments: --sql-typedelete
129 
130 [root@zlm3 10:00:12 ~/binlog2sql/binlog2sql]
131 #python binlog2sql.py -h192.168.1.102 -P3306 -uroot -pPassw0rd -dzlm -tflash_table --start-file='mysql-bin.000004' --only-dml --sql-type delete --stop-never > flashback.sql
132 
133 [root@zlm3 10:00:35 ~/binlog2sql/binlog2sql]
134 #cat flashback.sql
135 
136 [root@zlm3 10:00:47 ~/binlog2sql/binlog2sql]
137 #ls -l
138 total 36
139 -rwxrwxrwx 1 root root  7882 Jun  6 07:21 binlog2sql.py
140 -rwxrwxrwx 1 root root 11696 Jun  6 07:21 binlog2sql_util.py
141 -rw-r--r-- 1 root root 10344 Jun  6 09:35 binlog2sql_util.pyc
142 -rw-r--r-- 1 root root     0 Jun  6 10:00 flashback.sql
143 -rwxrwxrwx 1 root root    98 Jun  6 07:21 __init__.py
144 
145 [root@zlm3 10:00:52 ~/binlog2sql/binlog2sql]
146 #python binlog2sql.py -h192.168.1.102 -P3306 -uroot -pPassw0rd -dzlm -tflash_table --start-file='mysql-bin.000003' --only-dml --sql-type delete --stop-never > flashback.sql
147 
148 [root@zlm3 10:01:26 ~/binlog2sql/binlog2sql]
149 #cat flashback.sql
150 
151 [root@zlm3 10:01:32 ~/binlog2sql/binlog2sql]
152 #

 

    what's amazing is that there're no delete operation found in the existent binlog files at all,how can that happen?let's use the original tool of MySQL itself's to see the details:  
  1 [root@zlm3 10:12:51 ~/binlog2sql/binlog2sql]
  2 #mysqlbinlog -vv --base64-output=decode-rows /data/mysql/mysql3306/logs/mysql-bin.000004 > flashback1.sql
  3 
  4 [root@zlm3 10:13:32 ~/binlog2sql/binlog2sql]
  5 #ls -l
  6 total 1536
  7 -rwxrwxrwx 1 root root    7882 Jun  6 07:21 binlog2sql.py
  8 -rwxrwxrwx 1 root root   11696 Jun  6 07:21 binlog2sql_util.py
  9 -rw-r--r-- 1 root root   10344 Jun  6 09:35 binlog2sql_util.pyc
 10 -rw-r--r-- 1 root root 1532363 Jun  6 10:13 flashback1.sql
 11 -rw-r--r-- 1 root root       0 Jun  6 10:01 flashback.sql
 12 -rwxrwxrwx 1 root root      98 Jun  6 07:21 __init__.py
 13 
 14 [root@zlm3 10:20:49 ~/binlog2sql/binlog2sql]
 15 #	   

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

-Advertisement-
Play Games
更多相關文章
  • Redis主要數據結構:簡單動態字元串(SDS)、雙端鏈表、字典、跳躍表、整數集合、壓縮列表和快速列表; 一、簡單動態字元串(SDS): Redis沒有直接使用C語言中的傳統的位元組數組保存字元串,而是自行構建了簡單動態字元串(SDS),C字元串只是作為簡單動態字元串(SDS)的字面量,用於在無需對字 ...
  • 1、資料庫簡介-》解決的問題:持久化存儲,優化讀寫,保證數據的有效性-》關係型資料庫: 基於E-R模型(數據關係模型) 使用sql語言進行操作-》分類:文檔型sqlite,服務型-》資料庫設計 三範式:列不可拆分,唯一標識,引用主鍵 關係及存儲: 1對1:1個對象A對應著1個對象B,1個對象B對應著 ...
  • 原本以為 正則表達式裡面的特殊\d匹配數字放到sql語句裡面也是適用的,沒想到一直不匹配。但是放到編程語言java或者js裡面又匹配。看了一下原來sql對正則的支持沒有那麼全面。一定要用[0-9]代表數字。原因的話我猜是sql是一門查詢語言,設計原則不應該有和編程語言靠近的東西 ...
  • 第1章 初探大數據 本章將介紹為什麼要學習大數據、如何學好大數據、如何快速轉型大數據崗位、本項目實戰課程的內容安排、本項目實戰課程的前置內容介紹、開發環境介紹。同時為大家介紹項目中涉及的Hadoop、Hive相關的知識 第2章 Spark及其生態圈概述 Spark作為近幾年最火爆的大數據處理技術,是 ...
  • 實驗案例一:驗證索引的作用 1、首先創建一個數據量大的表,名稱為“學生表”,分別有三列,學號,姓名和班級,如下圖所示,學號為自動編號,班級為預設值“一班”。 2、向表中插入大量數據,數據越多,驗證索引的效果越好。 使用語句完成:While 1>0 Insert into 學生表(姓名) values ...
  • 數據中心是智慧保護區的信息倉庫,為整個信息化平臺的高效運營提供豐富的數據源,全面支撐保護區各項應用。數據中心主要是通過保護區基礎資料庫建設工程的實施,通過規範生物多樣性信息分類、採集存儲、處理、交換和服務的標準,建成基礎資料庫。按照統一標準、共建共用、互聯互通的原則,以高端、集約、安全為目標,加強林 ...
  • 佛曰:“不可說,說既是錯”,所以本篇也是錯! 技術人的世界是一塊凈土,也許世界並不該這麼複雜。 ——KK 這篇感悟也許帶著些許悲涼、無奈,也許又帶著激情滿滿,也許還透著辛酸。 技術男 很多人眼裡的技術宅是[傻傻的] [情商低的] [不愛說話的][邋遢的]....當然也有一些好詞 [踏實] [誠實] ...
  • Kafka中存在大量的延遲操作,比如延遲生產、延遲拉取以及延遲刪除等。Kafka並沒有使用JDK自帶的Timer或者DelayQueue來實現延遲的功能,而是基於時間輪自定義了一個用於實現延遲功能的定時器(SystemTimer)。JDK的Timer和DelayQueue插入和刪除操作的平均時間複雜 ...
一周排行
    -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.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...