Percona-Tookit工具包之pt-duplicate-key-checker

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

占座 ...


  Preface       I've been demonstrated how to implement a master-slave structure using mysqldump in my previous blog.I'm gonna use Xtrabackup to do it again now.   Framework  
Hostname IP/Port Identity OS Version MySQL Version GTID Mode Binlog Format
zlm2 192.168.1.101/3306 master CentOS 7.0 5.7.21 on row
zlm3 192.168.1.102/3306 slave CentOS 7.0 5.7.21 on row
  Procedure   Generate a physical backup on master.
  1 [root@zlm2 03:59:24 ~]
  2 #innobackupex --defaults-file-/data/mysql/mysql3306/my3306.cnf /data/backup
  3 xtrabackup: recognized server arguments: 
  4 xtrabackup: recognized client arguments: 
  5 180725 04:00:42 innobackupex: Starting the backup operation
  6 
  7 IMPORTANT: Please check that the backup run completes successfully.
  8            At the end of a successful backup run innobackupex
  9            prints "completed OK!".
 10 
 11 180725 04:00:42  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=192.168.1.101;mysql_socket=/tmp/mysql3306.sock' as 'zlm'  (using password: YES).
 12 180725 04:00:42  version_check Connected to MySQL server
 13 180725 04:00:42  version_check Executing a version check against the server...
 14 180725 04:00:42  version_check Done.
 15 180725 04:00:42 Connecting to MySQL server host: 192.168.1.101, user: zlm, password: set, port: not set, socket: /tmp/mysql3306.sock
 16 Using server version 5.7.21-log
 17 innobackupex version 2.4.12 based on MySQL server 5.7.19 Linux (x86_64) (revision id: 170eb8c)
 18 xtrabackup: uses posix_fadvise().
 19 xtrabackup: cd to /data/mysql/mysql3306/data/ //Change directory to the datadir of current instance.
 20 xtrabackup: open files limit requested 0, set to 1024
 21 xtrabackup: using the following InnoDB configuration:
 22 xtrabackup:   innodb_data_home_dir = .
 23 xtrabackup:   innodb_data_file_path = ibdata1:100M:autoextend
 24 xtrabackup:   innodb_log_group_home_dir = ./
 25 xtrabackup:   innodb_log_files_in_group = 3
 26 xtrabackup:   innodb_log_file_size = 104857600
 27 InnoDB: Number of pools: 1
 28 180725 04:00:43 >> log scanned up to (10055645489)
 29 xtrabackup: Generating a list of tablespaces
 30 InnoDB: Allocated tablespace ID 2 for mysql/plugin, old maximum was 0
 31 180725 04:00:43 [01] Copying ./ibdata1 to /data/backup/2018-07-25_04-00-42/ibdata1 //Copy shared tablespace file to the target of backup directory.
 32 180725 04:00:44 >> log scanned up to (10055645489) //The redo logfiles are continuously written before copy .ibd files.
 33 180725 04:00:45 >> log scanned up to (10055645489)
 34 180725 04:00:45 [01]        ...done
 35 180725 04:00:46 >> log scanned up to (10055645489)
 36 180725 04:00:47 >> log scanned up to (10055645489)
 37 180725 04:00:47 [01] Copying ./mysql/plugin.ibd to /data/backup/2018-07-25_04-00-42/mysql/plugin.ibd //begins to copy data of innodb table(.ibd).
 38 180725 04:00:47 [01]        ...done
 39 180725 04:00:47 [01] Copying ./mysql/servers.ibd to /data/backup/2018-07-25_04-00-42/mysql/servers.ibd
 40 180725 04:00:47 [01]        ...done
 41 180725 04:00:47 [01] Copying ./mysql/help_topic.ibd to /data/backup/2018-07-25_04-00-42/mysql/help_topic.ibd
 42 180725 04:00:47 [01]        ...done
 43 180725 04:00:48 >> log scanned up to (10055645489)
 44 180725 04:00:48 [01] Copying ./mysql/help_category.ibd to /data/backup/2018-07-25_04-00-42/mysql/help_category.ibd
 45 180725 04:00:48 [01]        ...done
 46 180725 04:00:48 [01] Copying ./mysql/help_relation.ibd to /data/backup/2018-07-25_04-00-42/mysql/help_relation.ibd
 47 180725 04:00:48 [01]        ...done
 48 180725 04:00:48 [01] Copying ./mysql/help_keyword.ibd to /data/backup/2018-07-25_04-00-42/mysql/help_keyword.ibd
 49 180725 04:00:48 [01]        ...done
 50 180725 04:00:48 [01] Copying ./mysql/time_zone_name.ibd to /data/backup/2018-07-25_04-00-42/mysql/time_zone_name.ibd
 51 180725 04:00:48 [01]        ...done
 52 180725 04:00:48 [01] Copying ./mysql/time_zone.ibd to /data/backup/2018-07-25_04-00-42/mysql/time_zone.ibd
 53 180725 04:00:48 [01]        ...done
 54 180725 04:00:48 [01] Copying ./mysql/time_zone_transition.ibd to /data/backup/2018-07-25_04-00-42/mysql/time_zone_transition.ibd
 55 180725 04:00:48 [01]        ...done
 56 180725 04:00:48 [01] Copying ./mysql/time_zone_transition_type.ibd to /data/backup/2018-07-25_04-00-42/mysql/time_zone_transition_type.ibd
 57 180725 04:00:48 [01]        ...done
 58 180725 04:00:48 [01] Copying ./mysql/time_zone_leap_second.ibd to /data/backup/2018-07-25_04-00-42/mysql/time_zone_leap_second.ibd
 59 180725 04:00:48 [01]        ...done
 60 180725 04:00:48 [01] Copying ./mysql/innodb_table_stats.ibd to /data/backup/2018-07-25_04-00-42/mysql/innodb_table_stats.ibd
 61 180725 04:00:48 [01]        ...done
 62 180725 04:00:48 [01] Copying ./mysql/innodb_index_stats.ibd to /data/backup/2018-07-25_04-00-42/mysql/innodb_index_stats.ibd
 63 180725 04:00:48 [01]        ...done
 64 180725 04:00:48 [01] Copying ./mysql/slave_relay_log_info.ibd to /data/backup/2018-07-25_04-00-42/mysql/slave_relay_log_info.ibd
 65 180725 04:00:48 [01]        ...done
 66 180725 04:00:48 [01] Copying ./mysql/slave_master_info.ibd to /data/backup/2018-07-25_04-00-42/mysql/slave_master_info.ibd
 67 180725 04:00:48 [01]        ...done
 68 180725 04:00:48 [01] Copying ./mysql/slave_worker_info.ibd to /data/backup/2018-07-25_04-00-42/mysql/slave_worker_info.ibd
 69 180725 04:00:48 [01]        ...done
 70 180725 04:00:48 [01] Copying ./mysql/gtid_executed.ibd to /data/backup/2018-07-25_04-00-42/mysql/gtid_executed.ibd
 71 180725 04:00:48 [01]        ...done
 72 180725 04:00:48 [01] Copying ./mysql/server_cost.ibd to /data/backup/2018-07-25_04-00-42/mysql/server_cost.ibd
 73 180725 04:00:48 [01]        ...done
 74 180725 04:00:48 [01] Copying ./mysql/engine_cost.ibd to /data/backup/2018-07-25_04-00-42/mysql/engine_cost.ibd
 75 180725 04:00:48 [01]        ...done
 76 180725 04:00:48 [01] Copying ./sys/sys_config.ibd to /data/backup/2018-07-25_04-00-42/sys/sys_config.ibd
 77 180725 04:00:48 [01]        ...done
 78 180725 04:00:48 [01] Copying ./zlm/test_innodb.ibd to /data/backup/2018-07-25_04-00-42/zlm/test_innodb.ibd
 79 180725 04:00:48 [01]        ...done
 80 180725 04:00:48 [01] Copying ./zlm/test_ddl.ibd to /data/backup/2018-07-25_04-00-42/zlm/test_ddl.ibd
 81 180725 04:00:48 [01]        ...done
 82 180725 04:00:48 [01] Copying ./zlm/test_ddl_no_pk.ibd to /data/backup/2018-07-25_04-00-42/zlm/test_ddl_no_pk.ibd
 83 180725 04:00:48 [01]        ...done
 84 180725 04:00:48 [01] Copying ./zlm/test_index_usage.ibd to /data/backup/2018-07-25_04-00-42/zlm/test_index_usage.ibd
 85 180725 04:00:48 [01]        ...done
 86 180725 04:00:49 >> log scanned up to (10055645489)
 87 180725 04:00:49 [01] Copying ./zlm/test_charset.ibd to /data/backup/2018-07-25_04-00-42/zlm/test_charset.ibd
 88 180725 04:00:49 [01]        ...done
 89 180725 04:00:49 [01] Copying ./zlm/test_null.ibd to /data/backup/2018-07-25_04-00-42/zlm/test_null.ibd
 90 180725 04:00:49 [01]        ...done
 91 180725 04:00:49 [01] Copying ./zlm/test_convert.ibd to /data/backup/2018-07-25_04-00-42/zlm/test_convert.ibd
 92 180725 04:00:49 [01]        ...done
 93 180725 04:00:50 >> log scanned up to (10055645489)
 94 180725 04:00:50 Executing FLUSH NO_WRITE_TO_BINLOG TABLES... //In order to avoid writting binlog,new version will use "NO_WRITE_TO_BINLOG" option.
 95 180725 04:00:50 Executing FLUSH TABLES WITH READ LOCK... //Generate a FTWRL.
 96 180725 04:00:50 Starting to backup non-InnoDB tables and files
 97 180725 04:00:50 [01] Copying ./mysql/db.opt to /data/backup/2018-07-25_04-00-42/mysql/db.opt
 98 180725 04:00:50 [01]        ...done
 99 180725 04:00:50 [01] Copying ./mysql/db.frm to /data/backup/2018-07-25_04-00-42/mysql/db.frm
100 180725 04:00:50 [01]        ...done
101 180725 04:00:50 [01] Copying ./mysql/db.MYI to /data/backup/2018-07-25_04-00-42/mysql/db.MYI
102 180725 04:00:50 [01]        ...done
103 180725 04:00:50 [01] Copying ./mysql/db.MYD to /data/backup/2018-07-25_04-00-42/mysql/db.MYD
104 180725 04:00:50 [01]        ...done
105 180725 04:00:50 [01] Copying ./mysql/user.frm to /data/backup/2018-07-25_04-00-42/mysql/user.frm
106 180725 04:00:50 [01]        ...done
107 180725 04:00:50 [01] Copying ./mysql/user.MYI to /data/backup/2018-07-25_04-00-42/mysql/user.MYI
108 180725 04:00:50 [01]        ...done
109 180725 04:00:50 [01] Copying ./mysql/user.MYD to /data/backup/2018-07-25_04-00-42/mysql/user.MYD
110 
111 ... //A bundle of MyISAM tables(.MYI,.MYD,.frm) and innodb table structure(.frm) copied here,omitted.
112 
113 180725 04:00:51 [01] Copying ./zlm/db.opt to /data/backup/2018-07-25_04-00-42/zlm/db.opt
114 180725 04:00:51 [01]        ...done
115 180725 04:00:51 [01] Copying ./zlm/test_innodb.frm to /data/backup/2018-07-25_04-00-42/zlm/test_innodb.frm
116 180725 04:00:51 [01]        ...done
117 180725 04:00:51 [01] Copying ./zlm/test_myisam.frm to /data/backup/2018-07-25_04-00-42/zlm/test_myisam.frm
118 180725 04:00:51 [01]        ...done
119 180725 04:00:51 [01] Copying ./zlm/test_myisam.MYI to /data/backup/2018-07-25_04-00-42/zlm/test_myisam.MYI
120 180725 04:00:51 [01]        ...done
121 180725 04:00:51 [01] Copying ./zlm/test_myisam.MYD to /data/backup/2018-07-25_04-00-42/zlm/test_myisam.MYD
122 180725 04:00:51 [01]        ...done
123 180725 04:00:51 [01] Copying ./zlm/test_ddl.frm to /data/backup/2018-07-25_04-00-42/zlm/test_ddl.frm
124 180725 04:00:51 [01]        ...done
125 180725 04:00:51 [01] Copying ./zlm/test_ddl_no_pk.frm to /data/backup/2018-07-25_04-00-42/zlm/test_ddl_no_pk.frm
126 180725 04:00:51 [01]        ...done
127 180725 04:00:51 [01] Copying ./zlm/test_index_usage.frm to /data/backup/2018-07-25_04-00-42/zlm/test_index_usage.frm
128 180725 04:00:51 [01]        ...done
129 180725 04:00:51 [01] Copying ./zlm/test_charset.frm to /data/backup/2018-07-25_04-00-42/zlm/test_charset.frm
130 180725 04:00:51 [01]        ...done
131 180725 04:00:51 [01] Copying ./zlm/test_null.frm to /data/backup/2018-07-25_04-00-42/zlm/test_null.frm
132 180725 04:00:51 [01]        ...done
133 180725 04:00:51 [01] Copying ./zlm/test_convert.frm to /data/backup/2018-07-25_04-00-42/zlm/test_convert.frm
134 180725 04:00:51 [01]        ...done
135 180725 04:00:51 Finished backing up non-InnoDB tables and files
136 180725 04:00:51 [00] Writing /data/backup/2018-07-25_04-00-42/xtrabackup_binlog_info
137 180725 04:00:51 [00]        ...done
138 180725 04:00:51 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS... //Flushes redo logfiles whith writting them into binlog.
139 xtrabackup: The latest check point (for incremental): '10055645480' //Prints the last checkpoint.
140 xtrabackup: Stopping log copying thread.
141 .180725 04:00:51 >> log scanned up to (10055645489)
142 
143 180725 04:00:51 Executing UNLOCK TABLES
144 180725 04:00:51 All tables unlocked
145 180725 04:00:51 [00] Copying ib_buffer_pool to /data/backup/2018-07-25_04-00-42/ib_buffer_pool
146 180725 04:00:51 [00]        ...done
147 180725 04:00:51 Backup created in directory '/data/backup/2018-07-25_04-00-42/'
148 MySQL binlog position: filename 'mysql-bin.000027', position '190', GTID of the last change '1b7181ee-6eaf-11e8-998e-080027de0e0e:1-3730021'
149 180725 04:00:51 [00] Writing /data/backup/2018-07-25_04-00-42/backup-my.cnf
150 180725 04:00:51 [00]        ...done
151 180725 04:00:51 [00] Writing /data/backup/2018-07-25_04-00-42/xtrabackup_info 
152 180725 04:00:51 [00]        ...done
153 xtrabackup: Transaction log of lsn (10055645480) to (10055645489) was copied. //Prints the backuped lsn information.
154 180725 04:00:51 completed OK!

 

Check the outputfile of Xtrabackup.
 1 [root@zlm2 04:00:51 /data/backup]
 2 #cd /data/backup/
 3 
 4 [root@zlm2 04:03:53 /data/backup]
 5 #ls -l
 6 total 4
 7 drwxr-x--- 6 root root 4096 Jul 25 04:00 2018-07-25_04-00-42
 8 
 9 [root@zlm2 04:03:57 /data/backup]
10 #cd 2018-07-25_04-00-42/
11 
12 [root@zlm2 04:04:04 /data/backup/2018-07-25_04-00-42]
13 #ls -l
14 total 102456
15 -rw-r----- 1 root root       489 Jul 25 04:00 backup-my.cnf
16 -rw-r----- 1 root root      1078 Jul 25 04:00 ib_buffer_pool
17 -rw-r----- 1 root root 104857600 Jul 25 04:00 ibdata1
18 drwxr-x--- 2 root root      4096 Jul 25 04:00 mysql
19 drwxr-x--- 2 root root      8192 Jul 25 04:00 performance_schema
20 drwxr-x--- 2 root root      8192 Jul 25 04:00 sys
21 -rw-r----- 1 root root        68 Jul 25 04:00 xtrabackup_binlog_info
22 -rw-r----- 1 root root       121 Jul 25 04:00 xtrabackup_checkpoints
23 -rw-r----- 1 root root       570 Jul 25 04:00 xtrabackup_info
24 -rw-r----- 1 root root      2560 Jul 25 04:00 xtrabackup_logfile
25 drwxr-x--- 2 root root      4096 Jul 25 04:00 zlm
26 
27 [root@zlm2 04:04:07 /data/backup/2018-07-25_04-00-42]
28 #cat xtrabackup_binlog_info
29 mysql-bin.000027    190    1b7181ee-6eaf-11e8-998e-080027de0e0e:1-3730021
30 
31 [root@zlm2 04:04:22 /data/backup/2018-07-25_04-00-42]
32 #cat xtrabackup_checkpoints
33 backup_type = full-backuped
34 from_lsn = 0
35 to_lsn = 10055645480
36 last_lsn = 10055645489
37 compact = 0
38 recover_binlog_info = 0
39 
40 [root@zlm2 04:04:27 /data/backup/2018-07-25_04-00-42]
41 #cat xtrabackup_info
42 uuid = 8e8d59a6-8fae-11e8-87d6-080027de0e0e
43 name = 
44 tool_name = innobackupex
45 tool_command = --defaults-file-/data/mysql/mysql3306/my3306.cnf /data/backup
46 tool_version = 2.4.12
47 ibbackup_version = 2.4.12
48 server_version = 5.7.21-log
49 start_time = 2018-07-25 04:00:42
50 end_time = 2018-07-25 04:00:51
51 lock_time = 
              
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 當我們在 apache 中 進行訪問 www 文件夾之外的目錄的時候,我們可以使用軟鏈接的方式來進行協助訪問。 我在 html 文件夾 下麵創建 了 如下軟鏈接 link: 但是剛開始訪問的時候, apache 的目錄列表中不顯示 link 目錄項: 查看配置文件: 發現 符號鏈接 顯示選項已經打開 ...
  • 一直想看webrtc的源碼,苦於翻牆能力有限且整個編譯過程耗時巨大,故求助於互聯網。在互聯網尋找許久編譯好的Webrtc源碼,好多版本下載下來總是報各種錯誤,很是失落。 皇天不負有心人,終於尋得一版可用的WebRtc源碼。具體從哪個網站找的已經記不起來了,不過還是感謝分享者。 共用給大家: 鏈接: ...
  • 在內網中 暫時需要一臺 文件 伺服器,所以準備安裝一臺 http伺服器並開啟目錄訪問許可權。這次使用 apache 在 fedora 28 機器上: 因為 fedora 28 已經包含 httpd 軟體,使用 systemctl start httpd 就能進行啟動。 啟動時 預設開啟 目錄訪問許可權, ...
  • 1、firewalld的基本使用 啟動: systemctl start firewalld 查看狀態: systemctl status firewalld 停止: systemctl disable firewalld 禁用: systemctl stop firewalld 2.systemc ...
  • 常用命令(過濾、管道、重定向、ping 命令、netstat 命令、ps命令) ...
  • 首先, 你在一臺伺服器上面配置好NFS 伺服器:然後按照一下步驟: mounting the nfs on windows server 2008 r2: open Windows Server 的Dos window(not powershell),typing:servermanagercmd. ...
  • 一、安裝telnet 1、檢測telnet-server的rpm包是否安裝 [root@localhost ~]# rpm -qa telnet-server 若無輸入內容,則表示沒有安裝。出於安全考慮telnet-server.rpm是預設沒有安裝的,而telnet的客戶端是標配。即下麵的軟體是默 ...
  • Oracle左連接、右連接、全外連接以及(+)號用法 本文的源博主:http://www.cnblogs.com/hehaiyang/p/4745897.html 閱讀目錄 1、準備工作 2、左外連接(LEFT OUTER JOIN/ LEFT JOIN) 3、右外連接(RIGHT OUTER JO ...
一周排行
    -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.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...