http://bit.ly/olindata-galera-migration
Puppet Master
Puppet Code
(.git repository)
web01.olindata.com mail01.olindata.comdb01.olindata.com
Puppet Agent Puppet AgentPuppet Agent
rm -rf /var/lib/mysql
http://bit.ly/olindata-galera-migration
Galera Node 1
(Writes + some reads)
Galera Node 2..6
(Read only traffic)
haProxy Active haProxy Passive
web application
servers
(MS Windows)
FOSS Puppet 3.7.5 +
R10K + mco
port 13306
port 13307
root@maurycity:~# pt-summary
# Percona Toolkit System Summary Report ######################
Uptime | 265 days, 21:57, 1 user, load average: 3.06, 3.20, 3.22
System | Dell Inc.; PowerEdge R320; vNot Specified (Rack Mount Chassis)
Platform | Linux
Release | Debian GNU/Linux 7.8 (wheezy) (wheezy)
Kernel | 3.2.0-4-amd64
# Processor ##################################################
Processors | physical = 1, cores = 6, virtual = 12, hyperthreading = yes
Speeds | 12x2199.748
Models | 12xIntel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz
Caches | 12x15360 KB
# Memory #####################################################
Total | 63.0G
Free | 15.2G
Used | physical=47.8G, swap allocated=1.9G, swap used=228.9M, virtual=48.1G
#wsrep_% variables
| wsrep_sst_method | xtrabackup-v2
| wsrep_slave_threads | 16
#gcache
gcache.size = 1024M;
#/etc/mysql/conf.d/wsrep.cnf
root@maurycity:~# cat /etc/mysql/conf.d/wsrep.cnf
[mysqld]
# (This must be substituted by wsrep_format)
binlog_format=ROW
# Query Cache is not supported with wsrep
query_cache_size=0
query_cache_type=0
wsrep_provider_options=gcache.size=1024M
# How many threads will process writesets from other nodes
wsrep_slave_threads=16
# change auto_increment_increment and auto_increment_offset automatically
wsrep_auto_increment_control=1
# notify external systems
wsrep_notify_cmd=/usr/local/galeranotify/galera_notify.sh
# State Snapshot Transfer method
wsrep_sst_method=xtrabackup-v2
# SST authentication string. This will be used to send SST to joining nodes.
# Depends on SST method. For mysqldump method it is root:<root password>
wsrep_sst_auth=sst_xtrabackup:likeimgonnashowthathere
[sst]
# Xbstream is highly recommended. Refer to http://www.percona.com/doc/percona-xtradb-
cluster/5.6/manual/xtrabackup_sst.html#tar-ag-xbstream
# for details and caveats of using tar v/s xbstream for SST.
streamfmt=xbstream
# If equal to:
# 1 it writes to mysql stderr
# path/to/file writes to that file. If this is a fifo, it needs to exist and be open on
reader end before itself,
# otherwise wsrep_sst_xtrabackup will block indefinitely.
progress=1
# Enabling it instruments key stages of backup/restore in SST.
time=1
mysql {giltedge} >s
--------------
Server version: 5.6.22-72.0-56 Percona
XtraDB Cluster (GPL), Release rel72.0,
Revision 978, WSREP version 25.8, wsrep_25.8.
r4150
Uptime: 140 days 19 hours 30 min 22 sec
Threads: 96 Questions: 2256269807340 Slow
queries: 80145 Opens: 127115258 Flush
tables: 1 Open tables: 2000 Queries per
second avg: 185453.611 x6 ≈ 1.100.000(!)
mysql {giltedge} >SELECT table_schema "Data Base Name",
-> sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
-> sum( data_free )/ 1024 / 1024 "Free Space in MB"
-> FROM information_schema.TABLES
-> GROUP BY table_schema ;
+--------------------+----------------------+------------------+
| Data Base Name | Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| information_schema | 0.00976563 | 0.00000000 |
| mysql | 3.77337646 | 4.18228531 |
| performance_schema | 0.00000000 | 0.00000000 |
| production | 240352.62500000 | 23461.00000000 |
| test | 113.87500000 | 35.00000000 |
[..]
+--------------------+----------------------+------------------+
http://bit.ly/olindata-galera-migration
# https://github.com/olindata/puppet-galera/blob/5b6fc8d0c79e7b19ec167a17e79fcfccdf459e6d/templates/clustercheck.erb#L130
# if state is not 2 or 4, return an error
if [ $wsrep_local_state -ne 4 ] && [ $wsrep_local_state -ne 2 ]; then
return_fail "State of wsrep_local_state is not 2 or 4, but '${wsrep_local_state}'";
fi
# is wsrep_connected set to ON?
if [ "$wsrep_connected" != "ON" ]; then
return_fail "State of wsrep_connected is not ON, but '${wsrep_connected}'"
fi
# is wsrep_cluster_status set to Primary?
if [ "$wsrep_cluster_status" != "Primary" ]; then
return_fail "State of wsrep_cluster_status is not Primary, but '${wsrep_cluster_status}'"
fi
# is wsrep_ready set to ON?
if [ "$wsrep_ready" != "ON" ]; then
return_fail "State of wsrep_ready is not ON, but '${wsrep_ready}'"
fi
# is wsrep_cluster_state_uuid equal to wsrep_local_state_uuid?
if [ "$wsrep_cluster_state_uuid" != "$wsrep_local_state_uuid" ]; then
return_fail "Value of wsrep_cluster_state_uuid ('${wsrep_cluster_state_uuid}') does not match wsrep_local_state_uuid
('${wsrep_local_state_uuid}')"
fi
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster

1 m+ qps on mysql galera cluster

  • 2.
  • 5.
    Puppet Master Puppet Code (.gitrepository) web01.olindata.com mail01.olindata.comdb01.olindata.com Puppet Agent Puppet AgentPuppet Agent
  • 10.
  • 11.
  • 12.
    Galera Node 1 (Writes+ some reads) Galera Node 2..6 (Read only traffic) haProxy Active haProxy Passive web application servers (MS Windows) FOSS Puppet 3.7.5 + R10K + mco port 13306 port 13307
  • 13.
    root@maurycity:~# pt-summary # PerconaToolkit System Summary Report ###################### Uptime | 265 days, 21:57, 1 user, load average: 3.06, 3.20, 3.22 System | Dell Inc.; PowerEdge R320; vNot Specified (Rack Mount Chassis) Platform | Linux Release | Debian GNU/Linux 7.8 (wheezy) (wheezy) Kernel | 3.2.0-4-amd64 # Processor ################################################## Processors | physical = 1, cores = 6, virtual = 12, hyperthreading = yes Speeds | 12x2199.748 Models | 12xIntel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz Caches | 12x15360 KB # Memory ##################################################### Total | 63.0G Free | 15.2G Used | physical=47.8G, swap allocated=1.9G, swap used=228.9M, virtual=48.1G
  • 14.
    #wsrep_% variables | wsrep_sst_method| xtrabackup-v2 | wsrep_slave_threads | 16 #gcache gcache.size = 1024M; #/etc/mysql/conf.d/wsrep.cnf root@maurycity:~# cat /etc/mysql/conf.d/wsrep.cnf [mysqld] # (This must be substituted by wsrep_format) binlog_format=ROW # Query Cache is not supported with wsrep query_cache_size=0 query_cache_type=0 wsrep_provider_options=gcache.size=1024M
  • 15.
    # How manythreads will process writesets from other nodes wsrep_slave_threads=16 # change auto_increment_increment and auto_increment_offset automatically wsrep_auto_increment_control=1 # notify external systems wsrep_notify_cmd=/usr/local/galeranotify/galera_notify.sh # State Snapshot Transfer method wsrep_sst_method=xtrabackup-v2 # SST authentication string. This will be used to send SST to joining nodes. # Depends on SST method. For mysqldump method it is root:<root password> wsrep_sst_auth=sst_xtrabackup:likeimgonnashowthathere
  • 16.
    [sst] # Xbstream ishighly recommended. Refer to http://www.percona.com/doc/percona-xtradb- cluster/5.6/manual/xtrabackup_sst.html#tar-ag-xbstream # for details and caveats of using tar v/s xbstream for SST. streamfmt=xbstream # If equal to: # 1 it writes to mysql stderr # path/to/file writes to that file. If this is a fifo, it needs to exist and be open on reader end before itself, # otherwise wsrep_sst_xtrabackup will block indefinitely. progress=1 # Enabling it instruments key stages of backup/restore in SST. time=1
  • 17.
    mysql {giltedge} >s -------------- Serverversion: 5.6.22-72.0-56 Percona XtraDB Cluster (GPL), Release rel72.0, Revision 978, WSREP version 25.8, wsrep_25.8. r4150 Uptime: 140 days 19 hours 30 min 22 sec Threads: 96 Questions: 2256269807340 Slow queries: 80145 Opens: 127115258 Flush tables: 1 Open tables: 2000 Queries per second avg: 185453.611 x6 ≈ 1.100.000(!)
  • 18.
    mysql {giltedge} >SELECTtable_schema "Data Base Name", -> sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", -> sum( data_free )/ 1024 / 1024 "Free Space in MB" -> FROM information_schema.TABLES -> GROUP BY table_schema ; +--------------------+----------------------+------------------+ | Data Base Name | Data Base Size in MB | Free Space in MB | +--------------------+----------------------+------------------+ | information_schema | 0.00976563 | 0.00000000 | | mysql | 3.77337646 | 4.18228531 | | performance_schema | 0.00000000 | 0.00000000 | | production | 240352.62500000 | 23461.00000000 | | test | 113.87500000 | 35.00000000 | [..] +--------------------+----------------------+------------------+
  • 19.
  • 21.
    # https://github.com/olindata/puppet-galera/blob/5b6fc8d0c79e7b19ec167a17e79fcfccdf459e6d/templates/clustercheck.erb#L130 # ifstate is not 2 or 4, return an error if [ $wsrep_local_state -ne 4 ] && [ $wsrep_local_state -ne 2 ]; then return_fail "State of wsrep_local_state is not 2 or 4, but '${wsrep_local_state}'"; fi # is wsrep_connected set to ON? if [ "$wsrep_connected" != "ON" ]; then return_fail "State of wsrep_connected is not ON, but '${wsrep_connected}'" fi # is wsrep_cluster_status set to Primary? if [ "$wsrep_cluster_status" != "Primary" ]; then return_fail "State of wsrep_cluster_status is not Primary, but '${wsrep_cluster_status}'" fi # is wsrep_ready set to ON? if [ "$wsrep_ready" != "ON" ]; then return_fail "State of wsrep_ready is not ON, but '${wsrep_ready}'" fi # is wsrep_cluster_state_uuid equal to wsrep_local_state_uuid? if [ "$wsrep_cluster_state_uuid" != "$wsrep_local_state_uuid" ]; then return_fail "Value of wsrep_cluster_state_uuid ('${wsrep_cluster_state_uuid}') does not match wsrep_local_state_uuid ('${wsrep_local_state_uuid}')" fi