Upload
vanthuy
View
230
Download
0
Embed Size (px)
Citation preview
MySQL Router – Simple HAMarcos Albe, Percona Inc.
Percona Live Data Performance ConferenceSanta Clara – April 2016
www.percona.com
Agenda
● What● Why● The plugins● Configuration● How it works● The missing plugins● Performance
www.percona.com
What is MySQL Router?
● New addition to MySQL toolkit for HA● Simple layer 4 packet router
● i.e.: no packet inspection; just relay back and forth● A framework for plugins● Companion to existing HA solutions● Open Source; Developed by Oracle
www.percona.com
What is MySQL Router?
● New addition to MySQL toolkit for HA● Simple layer 4 packet router
● i.e.: no packet inspection; just relay back and forth● A framework for plugins● Companion to existing HA solutions● Open Source; Developed by Oracle
www.percona.com
What is MySQL Router?
● New addition to MySQL toolkit for HA● Simple layer 4 packet router
● i.e.: no packet inspection; just relay back and forth● A framework for plugins● Companion to existing HA solutions● Open Source; Developed by Oracle
www.percona.com
What is MySQL Router?
● New addition to MySQL toolkit for HA● Simple layer 4 packet router
● i.e.: no packet inspection; just relay back and forth● A framework for plugins● Companion to existing HA solutions● Open Source; Developed by Oracle
www.percona.com
What is MySQL Router?
● New addition to MySQL toolkit for HA● Simple layer 4 packet router
● i.e.: no packet inspection; just relay back and forth● A framework for plugins● Companion to existing HA solutions● Open Source; Developed by Oracle
www.percona.com
What is MySQL Router?
● New addition to MySQL toolkit for HA● Simple layer 4 packet router
● i.e.: no packet inspection; just relay back and forth● A framework for plugins● Companion to existing HA solutions● Developed by Oracle; Open Source
www.percona.com
Why another router?
● Official support (Percona will support it too)● Natively integrated with MySQL Fabric● Simplicity!● Potential foundation for other projects● Perhaps you don't like HA Proxy / NGINX
www.percona.com
Why another router?
● Official support (Percona will support it too)● Natively integrated with MySQL Fabric● Simplicity!● Potential foundation for other projects● Perhaps you don't like HA Proxy / NGINX
www.percona.com
Why another router?
● Official support (Percona will support it too)● Integrates with MySQL Fabric● Simplicity!● Potential foundation for other projects● Perhaps you don't like HA Proxy / NGINX
www.percona.com
Why another router?
● Official support (Percona will support it too)● Natively integrated with MySQL Fabric● Simplicity!● Potential foundation for other projects● Perhaps you don't like HA Proxy / NGINX
www.percona.com
Why another router?
● Official support + Percona will support it too● Natively integrated with MySQL Fabric● Simplicity!● Potential foundation for other projects● Perhaps you don't like HA Proxy / NGINX
www.percona.com
Why another router?
● Official support (Percona will support it too)● Natively integrated with MySQL Fabric● Simplicity!● Potential foundation for other projects● Perhaps you don't like HA Proxy / NGINX
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available● Round Robin
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available (read-write)● Round Robin (read-only)
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available (read-write)● Round Robin (read-only)
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available (read-write)● Round Robin (read-only)
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available (read-write)● Round Robin (read-only)
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available (read-write)● Round Robin (read-only)
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available (read-write)● Round Robin (read-only)
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The plugins
● Everything is a plugin● Based on MySQL Harness● routing
● First Available (read-write)● Round Robin (read-only)
● fabric_cache● logger● Many traffic-handling plugins can run in parallel
www.percona.com
The Plugins: MySQL Harness
● Permits creation of third party plugins● Dependency tracking ● Version handling ● Loading, starting, and stopping plugins● Library for reading configuration files● Platform agnostic file support● Robust logging facility
www.percona.com
Configuration - simple routing[DEFAULT]plugin_folder = /usr/local/lib/mysqlrouter/config_folder = /etc/mysql/router/logging_folder = /var/log/runtime_folder = /var/run/
[logger]level = INFO
[routing:HA_RW]bind_address = 127.0.0.1bind_port = 3306mode = read-writedestinations = 192.168.2.100:3306,192.168.2.102:3306wait_timeout = 60max_connections = 500[routing:HA_RO]bind_address = 127.0.0.1:3316mode = read-onlydestinations = 192.168.2.100:3306,192.168.2.102:3306,192.168.2.103:3306,192.168.2.110:3309
www.percona.com
Configuration – fabric[fabric_cache:my_HA_Fabric_cache]address = deity_of_sharding.example.comuser = fabric_adminpassword = s3krr3t_P455W0RD
[routing:my_HA_Fabric_group1_ro]bind_address = 127.0.0.1:3008destinations = fabric+cache://my_HA_Fabric_cache/group/some_groupname?allow_primary_reads=yesmode = read-only
[routing:my_HA_Fabric_group1_rw]bind_address = 127.0.0.1:3009destinations = fabric+cache://my_HA_Fabric_cache/group/some_groupnamemode = read-write
[routing:my_HA_Fabric_group2_rw]bind_address = 127.0.0.1:4008destinations = fabric+cache://my_HA_Fabric_cache/group/other_groupnamemode = read-wtite
www.percona.com
How it works: misc. notes
● Run on same box than the application● Can’t do SSL● Remember to check connection errors and retry
www.percona.com
The missing plugins● Mirror traffic to many servers (for testing)● Multiplexing many connections to one server● Weighted load balancing● Load aware balancing;
● With cloud expand/contract abilities (openstack)● Galera aware (geo-aware multi-master)● Traffic dump (a-la tcpdump)● Traffic replay (complex!)
www.percona.com
Performance considerations● Extra layer; MUST have cost
● Throughput may be reduced● Transaction latency can increase● Establishment connections can be slower
● Frugal code; generally low overhead (<~10%)● But finally it's workload dependant● Intended to be co-located with app servers
● Not as a hub in a single server