Proxysql ha plam_2016_2_keynote
-
Upload
marco-tusa -
Category
Presentations & Public Speaking
-
view
163 -
download
19
Transcript of Proxysql ha plam_2016_2_keynote
![Page 1: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/1.jpg)
Percona Live Europe 2016Use ProxySQL to Improve Your
MySQL High Availability SolutionMarco Tusa Manager Consulting
Amsterdam, Netherlands | October 3 – 5, 2016
![Page 2: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/2.jpg)
2
● Marco “The Grinch” • Open source enthusiast
About me
![Page 3: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/3.jpg)
3
What is HA
![Page 4: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/4.jpg)
3
What is HA
![Page 5: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/5.jpg)
3
What is HA9 0. 0 0 0 % (36 days) MySQL Replication 9 9. 9 0 0 % (8 hours) Linux Heartbeat with DRBD 9 9. 9 0 0 % (8 hours) RHCS with Shared Storage (Active/Passive) 9 9. 9 9 0 % (52 minutes) MHA with at least 3 nodes 9 9. 9 9 0 % (52 minutes) Linux Heartbeat with DRBD and Replication 9 9. 9 9 0 % (52 minutes) Linux Heartbeat with Shared Storage and Replication 9 9 .9 9 5 % (26 minutes) Multi Master (galera - percona cluster) 3 node minimum 9 9. 9 9 9 % (5 minutes) MySQL Cluster
![Page 6: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/6.jpg)
4
What is HA
![Page 7: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/7.jpg)
5
What is HA
![Page 8: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/8.jpg)
6
Objectively What we have is:
![Page 9: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/9.jpg)
6
Objectively What we have is:
![Page 10: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/10.jpg)
6
Objectively What we have is:
![Page 11: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/11.jpg)
6
Objectively What we have is:
![Page 12: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/12.jpg)
6
Objectively What we have is:
MySQL Group Replication
![Page 13: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/13.jpg)
7
The telephone game
![Page 14: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/14.jpg)
8
All talking
![Page 15: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/15.jpg)
9
Black box:
![Page 16: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/16.jpg)
10
Use the Right Tool for the Job…
![Page 17: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/17.jpg)
11
What we need
![Page 18: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/18.jpg)
11
What we need
![Page 19: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/19.jpg)
11
What we need
![Page 20: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/20.jpg)
11
What we need
![Page 21: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/21.jpg)
12
ProxySQL
![Page 22: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/22.jpg)
13
ProxySQL
![Page 23: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/23.jpg)
14
Understand the basics
![Page 24: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/24.jpg)
14
Understand the basics
Write / Read (Master/Slave)
![Page 25: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/25.jpg)
14
Understand the basics
Write / Read (Master/Slave)
Multiple Writers
![Page 26: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/26.jpg)
14
Understand the basics
Write / Read (Master/Slave)
Multiple WritersSharding &
Geographic Distribution
![Page 27: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/27.jpg)
14
Understand the basics
Write / Read (Master/Slave)
Multiple WritersSharding &
Geographic Distribution
Mirroring
![Page 28: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/28.jpg)
14
Understand the basics
Write / Read (Master/Slave)
Multiple WritersSharding &
Geographic Distribution
Mirroring
Query re-write
![Page 29: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/29.jpg)
15
Understand the basics – how this is done?
![Page 30: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/30.jpg)
15
Servers group by function
Understand the basics – how this is done?
![Page 31: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/31.jpg)
15
Servers group by functionHost Groups
Understand the basics – how this is done?
![Page 32: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/32.jpg)
15
Servers group by functionHost Groups
Rules define what, where and how
Understand the basics – how this is done?
![Page 33: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/33.jpg)
15
Servers group by functionHost Groups
Rules define what, where and howQuery Rules
Understand the basics – how this is done?
![Page 34: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/34.jpg)
15
Servers group by functionHost Groups
Rules define what, where and howQuery Rules
Special Grouping for Replication
Understand the basics – how this is done?
![Page 35: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/35.jpg)
15
Servers group by functionHost Groups
Rules define what, where and howQuery Rules
Special Grouping for ReplicationReplication Host Group
Understand the basics – how this is done?
![Page 36: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/36.jpg)
16
HostGroup (HG) & Replication HG
Understand the basics
![Page 37: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/37.jpg)
16
HostGroup (HG) & Replication HG
Understand the basics
![Page 38: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/38.jpg)
17
Query rules
Understand the basics
![Page 39: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/39.jpg)
18
Scheduler
Understand the basics
![Page 40: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/40.jpg)
19
Basic scenario
![Page 41: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/41.jpg)
19
Basic scenario
HG: 10U: app_RW
HG: 11U: app_R
HG: 12U: ETL_R
![Page 42: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/42.jpg)
20
insert into mysql_users (username,password,active,default_hostgroup,default_schema) values ('app_RW','test',1,10,'test_schema');
insert into mysql_users (username,password,active,default_hostgroup,default_schema) values ('app_R','test',1,11,'test_schema');
insert into mysql_users (username,password,active,default_hostgroup,default_schema) values ('etl_R','test',1,12,’etl_schema'); LOAD MYSQL USERS TO RUNTIME;SAVE MYSQL USERS TO DISK;
Basic scenario - Users
![Page 43: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/43.jpg)
21
INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES ('192.168.1.5',10,3306,1000); INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight, max_replication_lag) VALUES ('192.168.1.6',11,3306,1000000,2); INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight, max_replication_lag) VALUES ('192.168.1.7',11,3306,1000000,2); INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight, max_replication_lag) VALUES ('192.168.1.5',11,3306,1,2); INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES ('192.168.1.8',12,3306,10); INSERT INTO mysql_replication_hostgroups VALUES (10,11); LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;
Basic scenario – Servers / HG
![Page 44: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/44.jpg)
22
insert into mysql_query_rules (username,destination_hostgroup,active,retries,match_digest,apply) values(’app_RW',10,1,3,'^SELECT.*FOR UPDATE',1); insert into mysql_query_rules (username,destination_hostgroup,active,retries,match_digest,apply) values(’app_RW',11,1,3,'^SELECT ',1); insert into mysql_query_rules (username,destination_hostgroup,active) values(’app_R',11,1); insert into mysql_query_rules (username,destination_hostgroup,active) values('etl_R',12,1);
LOAD MYSQL QUERY RULES TO RUNTIME;SAVE MYSQL QUERY RULES TO DISK;
Basic scenario – Query rules
![Page 45: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/45.jpg)
23
Basic scenario – with ProxySQL
![Page 46: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/46.jpg)
23
Basic scenario – with ProxySQL
Writes
![Page 47: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/47.jpg)
23
Basic scenario – with ProxySQL
Writes
Reads
![Page 48: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/48.jpg)
23
Basic scenario – with ProxySQL
Writes
ReadsReads
![Page 49: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/49.jpg)
23
Basic scenario – with ProxySQL
ReadsReads
![Page 50: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/50.jpg)
24
READ_ONLY = 0 WRITE HG READ_ONLY = 1 READ HG
ProxySQL – Replication HG
READ_ONLY=0 READ_ONLY=1 READ_ONLY=1
HG 11 HG 11HG 10 & HG 11
![Page 51: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/51.jpg)
24
READ_ONLY = 0 WRITE HG READ_ONLY = 1 READ HG
ProxySQL – Replication HG
READ_ONLY=0 READ_ONLY=1
HG 10 & HG:11 HG 11
READ_ONLY=0
HG 10 & HG 11
![Page 52: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/52.jpg)
24
READ_ONLY = 0 WRITE HG READ_ONLY = 1 READ HG
ProxySQL – Replication HG
READ_ONLY=0 READ_ONLY=1
HG 10 & HG:11 HG 11
READ_ONLY=0
HG 10 & HG 11
![Page 53: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/53.jpg)
25
ProxySQL + MHA (or any controller)
Writes
ReadsReads
![Page 54: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/54.jpg)
25
ProxySQL + MHA (or any controller)
Writes
ReadsReads
![Page 55: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/55.jpg)
25
ProxySQL + MHA (or any controller)
Writes
ReadsReads
![Page 56: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/56.jpg)
26
No movable part like:
ProxySQL + MHA (or any controller)
![Page 57: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/57.jpg)
26
No movable part like:VIP
ProxySQL + MHA (or any controller)
![Page 58: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/58.jpg)
26
No movable part like:VIP
DNS (Route 53 or similar)
ProxySQL + MHA (or any controller)
![Page 59: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/59.jpg)
26
No movable part like:VIP
DNS (Route 53 or similar)No Crazy scripts to manage other proxy (ie HAProxy)
ProxySQL + MHA (or any controller)
![Page 60: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/60.jpg)
26
No movable part like:VIP
DNS (Route 53 or similar)No Crazy scripts to manage other proxy (ie HAProxy)
Better distributed HA
ProxySQL + MHA (or any controller)
![Page 61: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/61.jpg)
27
What timing with MHA?
![Page 62: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/62.jpg)
27
MHA discovery time (ping x 3 times) -> ~9 sec
What timing with MHA?
![Page 63: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/63.jpg)
27
MHA discovery time (ping x 3 times) -> ~9 secMHA recovery (binlog) variable time
What timing with MHA?
![Page 64: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/64.jpg)
27
MHA discovery time (ping x 3 times) -> ~9 secMHA recovery (binlog) variable time
MHA Slave shift + Master READ-ONLY < 2 sec
What timing with MHA?
![Page 65: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/65.jpg)
27
MHA discovery time (ping x 3 times) -> ~9 secMHA recovery (binlog) variable time
MHA Slave shift + Master READ-ONLY < 2 sec
ProxySQL will react as soon as READ_ONLY=0
What timing with MHA?
![Page 66: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/66.jpg)
28
Nothing all defaults
master_ip_failover_script=master_ip_failover master_ip_online_change_script=master_ip_online_change
Test it:masterha_master_switch --master_state=alive --conf=/etc/mha.cnf --orig_master_is_new_slave --interactive=0 --running_updates_limit=0
What is needed with MHA?
![Page 67: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/67.jpg)
29
Given no VIP or centralize element.
Why better distributed HA?
![Page 68: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/68.jpg)
30
Integration with PXC\Galera
![Page 69: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/69.jpg)
31
Integration with PXC\Galera
![Page 70: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/70.jpg)
31
Integration with PXC\Galera
![Page 71: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/71.jpg)
31
Integration with PXC\Galera
![Page 72: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/72.jpg)
32
Integration with PXC\Galera
![Page 73: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/73.jpg)
32
Integration with PXC\Galera read_only wsrep_status wsrep_rejectqueries wsrep_donorrejectqueries wsrep_connected wsrep_desinccount wsrep_ready wsrep_provider wsrep_segment Number of nodes in by segment Retry loop
![Page 74: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/74.jpg)
32
Integration with PXC\Galera read_only wsrep_status wsrep_rejectqueries wsrep_donorrejectqueries wsrep_connected wsrep_desinccount wsrep_ready wsrep_provider wsrep_segment Number of nodes in by segment Retry loop
Online Offline_soft Offline_hard Shunned
![Page 75: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/75.jpg)
32
Integration with PXC\Galera read_only wsrep_status wsrep_rejectqueries wsrep_donorrejectqueries wsrep_connected wsrep_desinccount wsrep_ready wsrep_provider wsrep_segment Number of nodes in by segment Retry loop
Online Offline_soft Offline_hard Shunned
But we also have Hostgroups Replication HG
![Page 76: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/76.jpg)
33
Integration with PXC\Galera
![Page 77: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/77.jpg)
33
Integration with PXC\Galera
![Page 78: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/78.jpg)
33
Integration with PXC\Galera
![Page 79: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/79.jpg)
34
Integration with PXC\Galera
HG: 10
HG: 10
HG: 12HG: 11
HG: 11HG: 12
![Page 80: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/80.jpg)
35
Multiple writer vs Single writer
Integration with PXC\Galera
![Page 81: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/81.jpg)
35
Multiple writer vs Single writerMulti writer based on weight and Hostgroups
Integration with PXC\Galera
![Page 82: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/82.jpg)
35
Multiple writer vs Single writerMulti writer based on weight and Hostgroups
Need Replication HG and READ_ONLY
Integration with PXC\Galera
![Page 83: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/83.jpg)
35
Multiple writer vs Single writerMulti writer based on weight and Hostgroups
Need Replication HG and READ_ONLYFailover is done without the need of performing actions on the nodes
Integration with PXC\Galera
![Page 84: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/84.jpg)
35
Multiple writer vs Single writerMulti writer based on weight and Hostgroups
Need Replication HG and READ_ONLYFailover is done without the need of performing actions on the nodes
Failover is done modifying the READ_ONLY value
Integration with PXC\Galera
![Page 85: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/85.jpg)
35
Multiple writer vs Single writerMulti writer based on weight and Hostgroups
Need Replication HG and READ_ONLYFailover is done without the need of performing actions on the nodes
Failover is done modifying the READ_ONLY valueSingle WRITER node isolation not guarantee
Integration with PXC\Galera
![Page 86: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/86.jpg)
35
Multiple writer vs Single writerMulti writer based on weight and Hostgroups
Need Replication HG and READ_ONLYFailover is done without the need of performing actions on the nodes
Failover is done modifying the READ_ONLY valueSingle WRITER node isolation not guarantee
Single WRITER node isolation is guarantee
Integration with PXC\Galera
![Page 87: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/87.jpg)
36
insert into mysql_users (username,password,active,default_hostgroup,default_schema) values ('app_RW','test',1,10,'test_schema');
insert into mysql_users (username,password,active,default_hostgroup,default_schema) values ('app_R','test',1,11,'test_schema');
insert into mysql_users (username,password,active,default_hostgroup,default_schema) values (‘appDR_R','test',1,12,’etl_schema'); LOAD MYSQL USERS TO RUNTIME;SAVE MYSQL USERS TO DISK;
Integration with PXC\Galera - Users
![Page 88: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/88.jpg)
37
insert into mysql_query_rules (username,destination_hostgroup,active,retries,match_digest,apply) values(’app_RW',10,1,3,'^SELECT.*FOR UPDATE',1);
insert into mysql_query_rules (username,destination_hostgroup,active,retries,match_digest,apply) values(’app_RW',11,1,3,'^SELECT ',1);
insert into mysql_query_rules (username,destination_hostgroup,active) values(’app_R',11,1);
insert into mysql_query_rules (username,destination_hostgroup,active) values(‘appDR_R',12,1); LOAD MYSQL QUERY RULES TO RUNTIME;SAVE MYSQL QUERY RULES TO DISK;
Integration with PXC\Galera – QR
![Page 89: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/89.jpg)
38
INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight)
VALUES ('192.168.1.5',10,3306,1000000000); 192.168.1.6 … 10000; 192.168.1.7 … 10
INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES ('192.168.1.5',11,3306,1); 192.168.1.6 … 100000; 192.168.1.7 … 100000
INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES ('192.168.1.8',12,3306,100); 192.168.1.9 … 100; LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;
Integration with PXC\Galera – HG MW
![Page 90: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/90.jpg)
39
INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES
('192.168.1.5',10,3306,100);
INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES
('192.168.1.5',11,3306,1); INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES
('192.168.1.6',11,3306,100); INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES
('192.168.1.7',11,3306,100);
INSERT INTO mysql_servers (hostname,hostgroup_id,port,weight) VALUES ('192.168.1.8',12,3306,100); 192.168.1.9 … 100; INSERT INTO mysql_replication_hostgroups VALUES (10,11); LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;
Integration with PXC\Galera HG SW
![Page 91: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/91.jpg)
40
ProxySQL is configured Now what?
Integration with PXC
![Page 92: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/92.jpg)
40
ProxySQL is configured Now what?
Integration with PXC
![Page 93: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/93.jpg)
40
ProxySQL is configured Now what?
Example scripthttps://github.com/Tusamarco/proxy_sql_toolsFull guide: https://goo.gl/vcDFZx
Integration with PXC
![Page 94: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/94.jpg)
41
Set the script: INSERT INTO scheduler (id,active,interval_ms,filename,arg1) values (10,0,2000,"/var/lib/proxysql/galera_check.pl","-u=admin -p=admin -h=192.168.1.50 -H=500:W,501:R -P=3310 --execution_time=1 --retry_down=2 --retry_up=1 --main_segment=1 --debug=0 --log=/var/lib/proxysql/galeraLog"); LOAD SCHEDULER TO RUNTIME;SAVE SCHEDULER TO DISK; update scheduler set active=1 where id=10; LOAD SCHEDULER TO RUNTIME;
Integration with PXC
![Page 95: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/95.jpg)
42
+--------------+-------------+--------+------------+---------+ | hostgroup_id | hostname | status | weight | comment | +--------------+-------------+--------+------------+---------+ | 10 | 192.168.1.5 | ONLINE | 1000000000 | | | 10 | 192.168.1.6 | ONLINE | 10000 | | | 10 | 192.168.1.7 | ONLINE | 10 | | | 11 | 192.168.1.5 | ONLINE | 1 | | | 11 | 192.168.1.6 | ONLINE | 100000 | | | 11 | 192.168.1.7 | ONLINE | 100000 | | | 12 | 192.168.1.8 | ONLINE | 100 | | | 12 | 192.168.1.9 | ONLINE | 100 | | +--------------+-------------+--------+------------+---------+
Integration with PXC MW
![Page 96: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/96.jpg)
43
+--------------+-------------+--------+------------+---------+ | hostgroup_id | hostname | status | weight | comment | +--------------+-------------+--------+------------+---------+ | 10 | 192.168.1.5 |OFFLINE_SOFT | 1000000000 | 10_W_11_R_retry_up=0;10_W_11_R_retry_down=0; | 10 | 192.168.1.6 | ONLINE | 10000 | | | 10 | 192.168.1.7 | ONLINE | 10 | | | 11 | 192.168.1.5 | OFFLINE_SOFT | 1 | ... | | 11 | 192.168.1.6 | ONLINE | 100000 | | | 11 | 192.168.1.7 | ONLINE | 100000 | | | 12 | 192.168.1.8 | ONLINE | 100 | | | 12 | 192.168.1.9 | ONLINE | 100 | | +--------------+-------------+--------+------------+---------+
Integration with PXC MW
![Page 97: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/97.jpg)
44
+---------------------------------+-------+| Variable_name | Value |+---------------------------------+-------+| wsrep_sst_donor_rejects_queries | ON |+---------------------------------+-------+
Integration with PXC MW
![Page 98: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/98.jpg)
44
+---------------------------------+-------+| Variable_name | Value |+---------------------------------+-------+| wsrep_sst_donor_rejects_queries | ON |+---------------------------------+-------+
ProxySQL Think all is ok
Integration with PXC MW
![Page 99: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/99.jpg)
44
+---------------------------------+-------+| Variable_name | Value |+---------------------------------+-------+| wsrep_sst_donor_rejects_queries | ON |+---------------------------------+-------+
ProxySQL Think all is ok
Application writes will fail
Integration with PXC MW
![Page 100: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/100.jpg)
45
+--------------+-------------+--------+------------+---------+ | hostgroup_id | hostname | status | weight | comment | +--------------+-------------+--------+------------+---------+ | 10 | 192.168.1.6 | ONLINE | 10000 | | | 10 | 192.168.1.7 | ONLINE | 10 | | | 11 | 192.168.1.6 | ONLINE | 100000 | | | 11 | 192.168.1.7 | ONLINE | 100000 | | | 12 | 192.168.1.8 | ONLINE | 100 | | | 12 | 192.168.1.9 | ONLINE | 100 | | | 9010 | 192.168.1.5 | ONLINE | 1000000000 | | | 9011 | 192.168.1.5 | ONLINE | 1 | | +--------------+-------------+--------+------------+---------+
Integration with PXC MW
![Page 101: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/101.jpg)
46
WRITE Fail-over is automatically perform by ProxySQL
following the weight Until an active node exists the HG
Integration with PXC MW
![Page 102: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/102.jpg)
47
WRITE Fail-over will not happen
Until READ_ONLY variable is modified on a reader HG node.
WRITER if DONOR will never be OFFLINE_SOFT
Integration with PXC SW
![Page 103: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/103.jpg)
48
Integration with PXC\Galera SW manual
![Page 104: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/104.jpg)
48
Integration with PXC\Galera SW manual
![Page 105: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/105.jpg)
48
Integration with PXC\Galera SW manual
![Page 106: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/106.jpg)
49
Integration with PXC\Galera SW Auto
![Page 107: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/107.jpg)
49
Integration with PXC\Galera SW Auto
![Page 108: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/108.jpg)
49
Integration with PXC\Galera SW Auto
![Page 109: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/109.jpg)
50
Change state to: OFFLINE_SOFT = ~2 sec
HostGroup 9000 = ~2 sec
ProxySQL Shunned = ~1.2 sec (5 fails in 1sec)
Failover (auto) = ~3 sec
Integration with PXC - Timing
![Page 110: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/110.jpg)
51
Avoid SPOF
![Page 111: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/111.jpg)
51
Avoid SPOF
![Page 112: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/112.jpg)
51
Avoid SPOF
![Page 113: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/113.jpg)
52
Cost in time
![Page 114: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/114.jpg)
52
Cost in time
![Page 115: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/115.jpg)
53
Cost in time
![Page 116: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/116.jpg)
53
Cost in time
![Page 117: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/117.jpg)
54
So what.. 9 0. 0 0 0 % (36 days) MySQL Replication 9 9. 9 0 0 % (8 hours) Linux Heartbeat with DRBD 9 9. 9 0 0 % (8 hours) RHCS with Shared Storage (Active/Passive) 9 9. 9 9 0 % (52 minutes) MHA with at least 3 nodes 9 9. 9 9 0 % (52 minutes) Linux Heartbeat with DRBD and Replication 9 9. 9 9 0 % (52 minutes) Linux Heartbeat with Shared Storage and Replication 9 9 .9 9 5 % (26 minutes) Multi Master (galera - percona cluster) 3 node minimum 9 9. 9 9 9 % (5 minutes) MySQL Cluster
![Page 118: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/118.jpg)
55
Brief summary
![Page 119: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/119.jpg)
55
Improve service flexibility with r/w split;
Brief summary
![Page 120: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/120.jpg)
55
Improve service flexibility with r/w split;Allow simple way to manage access to specific servers by
usage (like DW-ETL);
Brief summary
![Page 121: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/121.jpg)
55
Improve service flexibility with r/w split;Allow simple way to manage access to specific servers by
usage (like DW-ETL);Implement sharding;
Brief summary
![Page 122: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/122.jpg)
55
Improve service flexibility with r/w split;Allow simple way to manage access to specific servers by
usage (like DW-ETL);Implement sharding;
Allow Query revrite/query fix/blocking without need to modify code;
Brief summary
![Page 123: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/123.jpg)
55
Improve service flexibility with r/w split;Allow simple way to manage access to specific servers by
usage (like DW-ETL);Implement sharding;
Allow Query revrite/query fix/blocking without need to modify code;
Improve failover time;
Brief summary
![Page 124: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/124.jpg)
55
Improve service flexibility with r/w split;Allow simple way to manage access to specific servers by
usage (like DW-ETL);Implement sharding;
Allow Query revrite/query fix/blocking without need to modify code;
Improve failover time;Reduce master downtime impact on reads;
Brief summary
![Page 125: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/125.jpg)
55
Improve service flexibility with r/w split;Allow simple way to manage access to specific servers by
usage (like DW-ETL);Implement sharding;
Allow Query revrite/query fix/blocking without need to modify code;
Improve failover time;Reduce master downtime impact on reads;
Not SPOF (as vip)
Brief summary
![Page 126: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/126.jpg)
56
![Page 127: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/127.jpg)
57
![Page 128: Proxysql ha plam_2016_2_keynote](https://reader031.fdocuments.in/reader031/viewer/2022020920/58ee18881a28ab40328b45e7/html5/thumbnails/128.jpg)
58
Contacts
To contact Me
To follow me
http://www.tusacentral.net/
http://www.percona.com/blog/
https://www.facebook.com/marco.tusa.94
@marcotusa
http://it.linkedin.com/in/marcotusa/
“Consulting = No mission refused!”