Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Introduction to MariaDB MaxScale
1. Introduction to
MariaDB MaxScale™
Colin Charles
colin@mariadb.org / byte@bytebot.net
http://bytebot.net/blog/ | @bytebot on Twitter
MySQL Power Users Group, Seoul, South Korea
29 August 2015
2. whoami
• Work on MariaDB Server at MariaDB Corporation
(formerly SkySQL Ab)
• Merged with Monty Program Ab, makers of MariaDB
• Formerly MySQL AB (exit: Sun Microsystems)
• Past lives include Fedora Project (FESCO),
OpenOffice.org
• MySQL Community Contributor of the Year Award
winner 2014
3. whatis MaxScale
• MaxScale is an Intelligent Data Gateway
• aka a “Pluggable Router”
• Gateway to High availability, Scalability, Security,
Interoperability and Manageability beyond just
MariaDB and MySQL
4.
5. What it is
• Open Source, Pluggable
• High Throughput Load Balancer
• Simplifies complex replication topologies for either scalability
or availability
• Can perform logging at the proxy level
• Can act as a firewall or filter
• Connects diverse clients or database backends with multiple
protocols and the ability to have query transformations
6. State
• Route based on state
• Defined algorithms
• Component state
• Requested content
• Session state
8. Plugins
• Can you write C? You can write plugins easily
• Protocol support
• Database monitoring
• Query Transformation and Logging
• Load balancing and Routing
• Authentication
9. Security
• Secure against application level SQL injections
• MaxScale can match on and block queries with certain
patterns
• The patterns to block can be configured
• Patterns can include date/time, a WHERE clause, a
wildcard, regular expression, a column match, or a
type of query
• You can even have external authentication with MaxScale
10.
11. Routing
• MaxScale constantly monitors the state of the database
nodes - can react to monitoring based information or hints
from filters
• MaxScale always routes queries to in service database
nodes, even when nodes are being added or removed
from cluster
• Connection based: use a separate read and write service,
set router_options=master
• Readwrite split service: sends writes to single master and
reads across slaves
12. Query Transformation
• MaxScale query
transformation allows
legacy applications built
for earlier version of
database to continue to
work with new version of
database
13. Upgrading
• whatis tee
• tee(1) - pipe fitting
• The tee utility copies standard input to
standard output, making a copy in zero
or more files. The output is unbuffered.
• Tee filter to duplicate queries to current version in
production and new version in staging
• Can have QLA filter logs for query performance
14. MaxScale for HA (master/
slave failover)
• Automatic promotion of the slave when there is a
master failure
• Can call an external process like MHA
• Unlike MHA (but mysqlfailover), it can monitor
the topology to ensure “automatic fail-back”
• has concept of “node_joined”
15. Schema sharding
• MaxScale Schema Sharding Plugin, routes
queries based on the tenant schema referenced
in the query
• If a Schema Shard is moved, MaxScale
automatically discovers the schema shard
location
• Great for multi-tenant hosted environments
16. Binary Log Scaling
• Large number of slaves for read scalability
cause overload on master for serving binlogs
• Relay the binlog from master to slave + Master
only serves binlog to 1 or small number of
MaxScale servers
• Used today at booking.com
17. Galera Cluster
• Yesterday, people use HAProxy for load balancing
• HAProxy is not a Level 7 router; MaxScale is
• MaxScale is very common for scaling out Galera
and maintaining/managing Galera Cluster
topologies
• Works with Galera Cluster from MariaDB,
upstream or Percona XtraDB Cluster
18. Route queries that match a
“*from *users” to server3
One Service with - One listener port(readwritesplit) or two Service with a read and a write listener
port(readconnrouter)
Traffic separated by queries - Each service configured with NamedServerFilter with pattern match
on the queries to be separated to specific server
[NamedServerFilter]
type=filter
module=namedserverfilter
match= *from *users
options=ignorecase
server=server3
[MyService]
type=service
router=readwritesplit
servers=server1,server2,server3
user=myuser
passwd=mypasswd
filters=NamedServerFilter
20. Kafka plugin
• In production
• https://www.percona.com/blog/2015/06/08/maxscale-
a-new-tool-to-solve-your-mysql-scalability-problems/
• “I wrote a query logging filter module to send all the
queries to a Kafka cluster and we gave it a try. Kafka
is extremely well suited to record a large flow of
queries like that. In fact, at 30k qps, the 3 Kafka
nodes are barely moving with cpu under 5% of one
core.” - Yves Trudeau
21. Coming Soon
• Upgrade from MySQL 5.6/5.7 (with GTID) to
MariaDB 10
• Allowing for cross-version replication between
MariaDB & MySQL
• Full in-built fast automatic failover/failback without
MHA dependency
• Replication to external sources like Cassandra,
HBase, etc