Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Getting the most out of MariaDB MaxScale

1,069 views

Published on

MariaDB MaxScale is the world’s most advanced database proxy, and while the most common use case for it is load balancing and automatic failover, it can do much more. MariaDB Principal Solutions Engineer, Anders Karlsson, explores the variety of things you can do with MariaDB MaxScale. He looks at the database firewall, the LUA script module, the hints filter and other ways to take advantage of MariaDB MaxScale.

Published in: Software
  • Be the first to comment

Getting the most out of MariaDB MaxScale

  1. 1. Getting the most out of MariaDB MaxScale Anders Karlsson Principal Sales Engineer MariaDB Corporation
  2. 2. Agenda ● MariaDB MaxScale and MariaDB Platform Overview ● Multiple paths / listeners with MariaDB MaxScale ○ Demo ● Using hints with MariaDB MaxScale ○ Demo ● Data Masking using MariaDB MaxScale ○ Demo ● Query rerouting with MariaDB MaxScale ○ Demo ● Questions / Answers
  3. 3. MariaDB MaxScale Architecture
  4. 4. MariaDB Platform
  5. 5. MariaDB Platform
  6. 6. MariaDB Platform – MariaDB MaxScale
  7. 7. MariaDB MaxScale Overview PROTOCOL SUPPORT AUTHENTICATION DATABASE MONITORING LOAD BALANCING & ROUTING QUERY TRANSFORMATION & LOGGING Flexible, easy plugin API Generic Core MULTI-THREADED E-POLL BASED STATELESS SHARES THE THREAD POOL
  8. 8. MariaDB MaxScale – Read / Write split Insulates client applications from the master – slave failover and load balancing CLIENT SLAVE MASTER SLAVE Replication Cluster
  9. 9. MariaDB MaxScale – Galera Failover CLIENT Transparent Galera failover and load balancing MASTER MASTER MASTER Galera Cluster
  10. 10. MariaDB MaxScale – Query Processing Client Protocol Protocol Filter Filter Router Server State Monitor Parser updates monitors uses MariaDB Server Backend
  11. 11. MariaDB MaxScale Using Multiple listeners
  12. 12. MariaDB MaxScale – Multiple listeners Clients Protocol Protocol Router Server State Monitor MariaDB Server Backend Protocol Filter Router
  13. 13. MariaDB MaxScale – Demo setup ● A single MariaDB MaxScale instance, with two hosts ● Accessing a 3-node MariaDB Galera Cluster $ maxctrl list servers
  14. 14. MariaDB MaxScale – Demo setup ● MariaDB MaxScale has 2 services and 2 listeners $ maxctrl list services
  15. 15. MariaDB MaxScale – Demo setup overview 192.168.142.210 192.168.142.211 192.168.142.212 192.168.142.201 192.168.142.202
  16. 16. MariaDB MaxScale – Demo configuration Listener Router Log filter Listener Router 192.168.142.201 192.168.142.202
  17. 17. Demo!
  18. 18. Using hints with MariaDB MaxScale
  19. 19. MariaDB MaxScale - Hints overview ● Hints use the hints filter ● Hints are sent using SQL comments ● Hints allows you to force a particular query routing ● Routing can be to a specific server ● INSERT INTO t VALUES(1); -- maxscale route to server server1 ● Routing can be to a specific role ○ INSERT INTO t VALUES(1); -- maxscale route to master ● Routing can be to the server as the previous query ○ INSERT INTO t VALUES(1); -- maxscale route to last
  20. 20. MariaDB MaxScale – Hints configuration ● The hints filter requires no options at all ● Note that you may have several filters for one service ● The configuration w are using here has the log filter for one service and the hint filter for the other ● Note that the mysql command line tool will strip comments by default!
  21. 21. Demo!
  22. 22. MariaDB MaxScale – The masking filter ● The MariaDB MaxScale data masking filter allows masking of specified columns ● The masking is transparent to applications ● The masking has several options allowing partial values to be masked, certain users to be excluded etc. ● Masking can be specified on all columns with a given name or only in certain databases and/or tables ● Masking can not overridden by using functions
  23. 23. MariaDB MaxScale – Masking configuration ● The filter is configured as any other filter in maxscale.cnf ● The actual masking is configured in a separate file in JSON format
  24. 24. Demo!
  25. 25. Rerouting queries with MariaDB MaxScale
  26. 26. MariaDB MaxScale - Query rerouting ● Sometimes there is different data on different servers ○ A Data Warehouse servers ○ A reporting server ● Transparent rerouting of queries allows ○ Applications can access all data through the same MariaDB MaxScale server ○ Reporting data can be in a special server and can be moved around, without having to change applications
  27. 27. MariaDB MaxScale – Rerouting configuration Listener Filter Router 192.168.142.201 Reporting server 192.168.142.220
  28. 28. MariaDB MaxScale – Rerouting configuration ● We assume we add a new reporting server ● The reporting server replicates from the Galera Cluster ● The reporting server also has some unique statistics tables ● Queries to the txhistory table must always go to the Reporting server SELECT * FROM txhistory ORDER BY txtime LIMIT 100
  29. 29. Demo!
  30. 30. Conclusion ● MariaDB MaxScale is a database proxy included in MariaDB Platform ● MariaDB MaxScale has a very flexible architecture based on plugins ● The MariaDB MaxScale primary use case is as a load balancer and for failover with Replication Clusters and Galera, but many functions can be added ● MariaDB MaxScale handles multiple differently configured paths through the same MariaDB instance ● MariaDB MaxScale has filters and other plugins for Hints, Data Masking, Query Redirection and much more ● The current version of MariaDB MaxScale is 2.3
  31. 31. Questions and Answers
  32. 32. THANK YOU!

×