Skip to content

Instantly share code, notes, and snippets.

@si294r
Last active October 5, 2017 12:25
Show Gist options
  • Select an option

  • Save si294r/4532e2fb995cebf880db9daa98346841 to your computer and use it in GitHub Desktop.

Select an option

Save si294r/4532e2fb995cebf880db9daa98346841 to your computer and use it in GitHub Desktop.
# MaxScale documentation on GitHub:
# https://github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Documentation-Contents.md

# Global parameters
#
# Complete list of configuration options:
# https://github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Getting-Started/Configuration-Guide.md

[maxscale]
threads=4

# Server definitions
#
# Set the address of the server to the network
# address of a MySQL server.
#

[server1]
type=server
address=10.0.4.13
port=3316
protocol=MySQLBackend

[server2]
type=server
address=10.0.4.13
port=3326
protocol=MySQLBackend
myweight=1

[server3]
type=server
address=10.0.4.13
port=3336
protocol=MySQLBackend
myweight=1

# Monitor for the servers
#
# This will keep MaxScale aware of the state of the servers.
# MySQL Monitor documentation:
# https://github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Monitors/MySQL-Monitor.md

[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server1, server2, server3
user=maxscale
passwd=password
monitor_interval=10000

# Service definitions
#
# Service Definition for a read-only service and
# a read/write splitting service.
#

# ReadConnRoute documentation:
# https://github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Routers/ReadConnRoute.md

[Read-Only Service]
type=service
router=readconnroute
servers=server1, server2, server3
user=maxscale
passwd=password
router_options=slave
enable_root_user=1

# ReadWriteSplit documentation:
# https://github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Routers/ReadWriteSplit.md

[Read-Write Service]
type=service
router=readwritesplit
servers=server1, server2, server3
user=maxscale
passwd=password
enable_root_user=1
weightby=myweight
filters=Hint
router_options=slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS
max_slave_connections=1 

[Hint]
type=filter
module=hintfilter

# This service enables the use of the MaxAdmin interface
# MaxScale administration guide:
# https://github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Reference/MaxAdmin.md

[MaxAdmin Service]
type=service
router=cli

# Listener definitions for the services
#
# These listeners represent the ports the
# services will listen on.
#

[Read-Only Listener]
type=listener
service=Read-Only Service
protocol=MySQLClient
port=4008

[Read-Write Listener]
type=listener
service=Read-Write Service
protocol=MySQLClient
port=4006

[MaxAdmin Listener]
type=listener
service=MaxAdmin Service
protocol=maxscaled
socket=default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment