在 Percona Blog 上看到這篇 Optimizing Percona XtraDB Cluster for write hotspots 優化多重寫入 MySQL 的狀況,舉例來說,要計算 global counter 的時候,就會遇到很頻繁的寫入 (write hotspot),目前是不能同時寫入資料到同一個 record,會造成 performance 降低,所以大家開始導入 Percona XtraDB Cluster 來解決同時間寫入到同一個 record,大家都認為,搞了三台 Percona Server,可以將寫入的動作分散到其他兩台,就不會遇到 Lock 問題,但是實際上根本就不是這樣。
[Read More]在 Debian 安裝 Percona Xtradb Cluster 5.5.34 注意事項
最近幫公司安裝新的三台機器,全部上 Debian 7.5 Server 版本,統一安裝 Percona Xtradb Cluster 最新版本 5.5.37。設定完第一台 Node,並且透過底下指令 boot up 成第一台 PXC。
$ /etc/init.d/mysql bootstrap-pxc
後續第二台要啟動跟第一台進行 SST,寫到一半直接噴底下錯誤訊息
[Read More]WSREP_SST: [ERROR] Cleanup after exit with status:32 (20140702 10:57:28.004) WSREP_SST: [INFO] Removing the sst_in_progress file (20140702 10:57:28.006) 140702 10:57:28 [ERROR] WSREP: Process completed with error: wsrep_sst_xtrabackup –role ‘joiner’ –address ‘192.168.1.101’ –auth ‘xxxxx:xxxxxx’ –datadir ‘/var/lib/mysql/’ –defaults-file ‘/etc/mysql/my.cnf’ –parent ‘16042’: 32 (Broken pipe) 140702 10:57:28 [ERROR] WSREP: Failed to read uuid:seqno from joiner script. 140702 10:57:28 [ERROR] WSREP: SST failed: 32 (Broken pipe)
免費下載 Percona MySQL eBooks
玩 MySQL 的一定知道 Percona,這次 Percona MySQL 推出免費電子書,電子書內容是從 MySQLPerformanceBlog 裡面精心挑選文章收錄,文章內容也幾乎都是 MySQL 專家寫出來的,電子書內容包含了MySQL server, Percona Server, Percona XtraDB Cluster, MySQL performance, and MySQL troubleshooting,所有的電子書都是免費下載。
- How to find bugs in MySQL
- InnoDB Full Text Search in MySQL 5.6
- InnoDB Performance Optimization
- Percona XtraDB Cluster 5.6
- Percona XtraDB Cluster
更多主題可以直接參考 MySQL eBooks
OSDC 2014 Talk: Introduction to Percona XtraDB Cluster and HAProxy
2014.05.07 OSDC 影片檔出爐
很高興可以參加今年 2014 OSDC,投了一篇 Introduction to Percona XtraDB Cluster and HAProxy,主要介紹 Percona XtraDB Cluster 這套 open source 軟體搭配前端 HAProxy,底下是 Slides
[Read More]Percona Cloud Tools for MySQL 介紹及安裝
Percona 去年推出一套 Cloud Tools for MySQL,藉由這套雲端服務可以幫忙分析 MySQL 系統內全部 Slow Query,並且計算出時間,畫出統計圖,此套系統目前還在 Beta 版,並且有些限制,只能開 3 個 organizations,每個 organizations 只能有 5 agents,最後資料只會保留 8 天,超過就會清除。這套系統後端是由 GO Language 完成,前端則是由 AngularJS 串起來,上個月 Percona 還在 MySQL Performance Blog 徵求 GO 的開發者,可見 Percona 也看好此服務,大膽使用 Google 推的 GO Language。
[Read More]MySQL 5.6 UUID 複製資料到 Slave Server
在 MySQL Performance Blog 看到這篇 Beware of MySQL 5.6 server UUID when cloning slaves,裡面提到如果是要複製資料到 Slave 機器,大部分的使用者肯定是將 /var/lib/mysql 目錄整個 copy 到 Slave 機器上。如果是 MySQL 5.6 Server 目錄內會有 auto.cnf 設定檔,這是 MySQL 5.6 新的功能叫做 server_uuid,在啟動 MySQL 後,就會自動建立 auto.cnf 檔案,此檔案就像是 my.cnf 或 my.ini 設定檔一樣,只是內容只有支援 [auto] 並且只有支援 server_uuid 這 key 值,例如
Percona XtraDB Server 出現 read only issue
最近在整理 Percona XtraDB Server 將 Read Write 全部拆開,寫入部份只開一台 Node,讀取機器 Replica 則是越多越好,當然如果預計 write 都不會有任何 conflict 的話,那就不用拆開,read write 都可以在同一台即可,拆開的目的要解決 Innodb transaction locking 問題。今天遇到的是將機器讀寫都放在同一台,然後同時多台 Master 架構,結果跑在 CodeIgniter 上面出現底下錯誤訊息
[Read More]The MySQL server is running with the –read-only option so it cannot execute this statement
Sysbench 測試 Percona XtraDB Server 效能
今天拿 MySQL benchmark tool - Sysbench 來測試看看 Percona XtraDB Server + Haproxy 效能如何,實驗主機是執行在 CentOS 6.4 版本,記憶體 128 G,在 CentOS 本身用 Yum 安裝 Sysbench 時,內建的版本為 0.4.12,單機測試 MySQL 效能不會出現任何錯誤,但是只要是透過 Haproxy,並且有兩台以上的 Server,就會噴出底下錯誤訊息:
[Read More]ALERT: failed to execute mysql_stmt_execute(): Err1317 Query execution was interrupted
MySQL 用 MySQLDump 備份 InnoDB 注意事項
MySQL 資料庫時一定是使 mysqldump 指令,不管是 MyISAM 或 InnoDB 都一樣, 在處理 InnoDB 格式備份時使用 mysqldump -single-transaction,但是你會發現在大多的備份狀況都是 OK 的,只是有時候會發現有的資料表只有備份到 structure 而無備份到 Data? 在 MySQL Performance Blog 看到這篇講解 Best kept MySQLDump Secret,此問題出在 how MySQL’s Transactions work with DDL,ALTER TABLE 會建立一個 temporary table,並且將該資料表資料複製過去,接著刪除原有資料表,最後將 temporary table 命名為原來資料表。 底下是原作者提到的原因
How does data visibility works in this case ? DDLs are not transactional and as such the running transaction will not see the contents of old table once it is dropped, transaction also will see the new table which was created after transaction was started, including table created by ALTER TABLE statement. Transactions however apply to DATA which is stored in this table and so data which was inserted after start of transaction (by ALTER TABLE statement) will not be visible. In the end we will get new structure in the dump but no data. 最好的解法就是改用 mysqldump -lock-all-tables,但是備份的時候,資料庫是無法寫入,僅能讀取,也或者可以透過 Percona Xtrabackup 工具來備份 InnoDB。
[Read More]
Galera Cluster for MySQL Multi-master Replication
Galera Cluster for MySQL 方案。本篇會介紹在 Ubuntu 或 CentOS 6.x final 版本如何安裝 Galera 伺服器套件及設定。要架設 Galera Cluster Server,有兩種套件選擇,一個是 Percona XtraDB Cluster 另一個是 MariaDB Galera Cluster,這次作者會介紹後者的安裝。
Galera Cluster 介紹 為什麼要選擇 Galera Cluster Server,它有什麼優點及功能呢?MySQL/Galera 是一套可以同步多台 MySQL/InnoDB 機器的叢集系統,底下可以列出功能。
- 同步複製資料
- 可讀取和寫入叢集系統內任一節點
- 自動偵測節點錯誤,如果有節點當機,則叢集系統自動移除該節點
- 可任意擴充節點
- 採用 row level 方式來平行複製資料 從上面功能看來,我們可以平行任意擴充節點,動態增加伺服器到叢集系統,要做到上面功能,就是利用
Galera library 來做到同步資料處理,同步的詳細細節,可以參考 Galera library 連結。這邊就不再多描述了。
[Read More]

