Step 6: Test MariaDB MaxScale

Overview

This page details step 6 of the 6-step procedure "Deploy Xpand Topology".

This step tests MaxScale.

Interactive commands are detailed. Alternatively, the described operations can be performed using automation.

Check Global Configuration

Use maxctrl show maxscale command to view the global MaxScale configuration.

This action is performed on the MaxScale node:

$ maxctrl show maxscale
┌──────────────┬───────────────────────────────────────────────────────┐
│ Version      │ 2.5.29                                                │
├──────────────┼───────────────────────────────────────────────────────┤
│ Commit       │ 8a610d4dad58a710669ab137be91f3c9376c3e9a              │
├──────────────┼───────────────────────────────────────────────────────┤
│ Started At   │ Mon, 02 Aug 2021 22:40:59 GMT                         │
├──────────────┼───────────────────────────────────────────────────────┤
│ Activated At │ Mon, 02 Aug 2021 22:40:59 GMT                         │
├──────────────┼───────────────────────────────────────────────────────┤
│ Uptime       │ 107                                                   │
├──────────────┼───────────────────────────────────────────────────────┤
│ Parameters   │ {                                                     │
│              │     "admin_auth": true,                               │
│              │     "admin_enabled": true,                            │
│              │     "admin_gui": true,                                │
│              │     "admin_host": "0.0.0.0",                          │
│              │     "admin_log_auth_failures": true,                  │
│              │     "admin_pam_readonly_service": null,               │
│              │     "admin_pam_readwrite_service": null,              │
│              │     "admin_port": 8989,                               │
│              │     "admin_secure_gui": false,                        │
│              │     "admin_ssl_ca_cert": null,                        │
│              │     "admin_ssl_cert": null,                           │
│              │     "admin_ssl_key": null,                            │
│              │     "admin_ssl_version": "MAX",                       │
│              │     "auth_connect_timeout": 10000,                    │
│              │     "auth_read_timeout": 10000,                       │
│              │     "auth_write_timeout": 10000,                      │
│              │     "cachedir": "/var/cache/maxscale",                │
│              │     "connector_plugindir": "/usr/lib64/mysql/plugin", │
│              │     "datadir": "/var/lib/maxscale",                   │
│              │     "debug": null,                                    │
│              │     "dump_last_statements": "never",                  │
│              │     "execdir": "/usr/bin",                            │
│              │     "language": "/var/lib/maxscale",                  │
│              │     "libdir": "/usr/lib64/maxscale",                  │
│              │     "load_persisted_configs": true,                   │
│              │     "local_address": null,                            │
│              │     "log_debug": false,                               │
│              │     "log_info": false,                                │
│              │     "log_notice": true,                               │
│              │     "log_throttling": {                               │
│              │         "count": 0,                                   │
│              │         "suppress": 0,                                │
│              │         "window": 0                                   │
│              │     },                                                │
│              │     "log_warn_super_user": false,                     │
│              │     "log_warning": true,                              │
│              │     "logdir": "/var/log/maxscale",                    │
│              │     "max_auth_errors_until_block": 10,                │
│              │     "maxlog": true,                                   │
│              │     "module_configdir": "/etc/maxscale.modules.d",    │
│              │     "ms_timestamp": false,                            │
│              │     "passive": false,                                 │
│              │     "persistdir": "/var/lib/maxscale/maxscale.cnf.d", │
│              │     "piddir": "/var/run/maxscale",                    │
│              │     "query_classifier": "qc_sqlite",                  │
│              │     "query_classifier_args": null,                    │
│              │     "query_classifier_cache_size": 0,                 │
│              │     "query_retries": 1,                               │
│              │     "query_retry_timeout": 5000,                      │
│              │     "rebalance_period": 0,                            │
│              │     "rebalance_threshold": 20,                        │
│              │     "rebalance_window": 10,                           │
│              │     "retain_last_statements": 0,                      │
│              │     "session_trace": 0,                               │
│              │     "skip_permission_checks": false,                  │
│              │     "sql_mode": "default",                            │
│              │     "syslog": true,                                   │
│              │     "threads": 2,                                     │
│              │     "users_refresh_interval": 0,                      │
│              │     "users_refresh_time": 30000,                      │
│              │     "writeq_high_water": 16777216,                    │
│              │     "writeq_low_water": 8192                          │
│              │ }                                                     │
└──────────────┴───────────────────────────────────────────────────────┘

Output will align to the global MaxScale configuration in the new configuration file you created.

Check Server Configuration

Use the maxctrl show servers command to view the configured server objects.

This action is performed on the MaxScale node:

$ maxctrl show servers
┌─────────────────────┬───────────────────────────────────────────┐
│ Server              │ @@xpand_monitor:node-3                    │
├─────────────────────┼───────────────────────────────────────────┤
│ Address             │ 192.0.2.3                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Port                │ 3306                                      │
├─────────────────────┼───────────────────────────────────────────┤
│ State               │ Master, Running                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Version             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Last Event          │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Triggered At        │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Services            │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Monitors            │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Master ID           │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Node ID             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Slave Server IDs    │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Current Connections │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Total Connections   │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Max Connections     │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Statistics          │ {                                         │
│                     │     "active_operations": 0,               │
│                     │     "adaptive_avg_select_time": "0ns",    │
│                     │     "connection_pool_empty": 0,           │
│                     │     "connections": 0,                     │
│                     │     "max_connections": 0,                 │
│                     │     "max_pool_size": 0,                   │
│                     │     "persistent_connections": 0,          │
│                     │     "reused_connections": 0,              │
│                     │     "routed_packets": 0,                  │
│                     │     "total_connections": 0                │
│                     │ }                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Parameters          │ {                                         │
│                     │     "address": "192.0.2.3",               │
│                     │     "disk_space_threshold": null,         │
│                     │     "extra_port": 0,                      │
│                     │     "monitorpw": null,                    │
│                     │     "monitoruser": null,                  │
│                     │     "persistmaxtime": 0,                  │
│                     │     "persistpoolmax": 0,                  │
│                     │     "port": 3306,                         │
│                     │     "priority": 0,                        │
│                     │     "proxy_protocol": false,              │
│                     │     "rank": "primary",                    │
│                     │     "socket": null,                       │
│                     │     "ssl": false,                         │
│                     │     "ssl_ca_cert": null,                  │
│                     │     "ssl_cert": null,                     │
│                     │     "ssl_cert_verify_depth": 9,           │
│                     │     "ssl_cipher": null,                   │
│                     │     "ssl_key": null,                      │
│                     │     "ssl_verify_peer_certificate": false, │
│                     │     "ssl_verify_peer_host": false,        │
│                     │     "ssl_version": "MAX"                  │
│                     │ }                                         │
└─────────────────────┴───────────────────────────────────────────┘
┌─────────────────────┬───────────────────────────────────────────┐
│ Server              │ @@xpand_monitor:node-2                    │
├─────────────────────┼───────────────────────────────────────────┤
│ Address             │ 192.0.2.2                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Port                │ 3306                                      │
├─────────────────────┼───────────────────────────────────────────┤
│ State               │ Master, Running                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Version             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Last Event          │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Triggered At        │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Services            │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Monitors            │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Master ID           │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Node ID             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Slave Server IDs    │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Current Connections │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Total Connections   │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Max Connections     │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Statistics          │ {                                         │
│                     │     "active_operations": 0,               │
│                     │     "adaptive_avg_select_time": "0ns",    │
│                     │     "connection_pool_empty": 0,           │
│                     │     "connections": 0,                     │
│                     │     "max_connections": 0,                 │
│                     │     "max_pool_size": 0,                   │
│                     │     "persistent_connections": 0,          │
│                     │     "reused_connections": 0,              │
│                     │     "routed_packets": 0,                  │
│                     │     "total_connections": 0                │
│                     │ }                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Parameters          │ {                                         │
│                     │     "address": "192.0.2.2",               │
│                     │     "disk_space_threshold": null,         │
│                     │     "extra_port": 0,                      │
│                     │     "monitorpw": null,                    │
│                     │     "monitoruser": null,                  │
│                     │     "persistmaxtime": 0,                  │
│                     │     "persistpoolmax": 0,                  │
│                     │     "port": 3306,                         │
│                     │     "priority": 0,                        │
│                     │     "proxy_protocol": false,              │
│                     │     "rank": "primary",                    │
│                     │     "socket": null,                       │
│                     │     "ssl": false,                         │
│                     │     "ssl_ca_cert": null,                  │
│                     │     "ssl_cert": null,                     │
│                     │     "ssl_cert_verify_depth": 9,           │
│                     │     "ssl_cipher": null,                   │
│                     │     "ssl_key": null,                      │
│                     │     "ssl_verify_peer_certificate": false, │
│                     │     "ssl_verify_peer_host": false,        │
│                     │     "ssl_version": "MAX"                  │
│                     │ }                                         │
└─────────────────────┴───────────────────────────────────────────┘
┌─────────────────────┬───────────────────────────────────────────┐
│ Server              │ @@xpand_monitor:node-1                    │
├─────────────────────┼───────────────────────────────────────────┤
│ Address             │ 192.0.2.1                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Port                │ 3306                                      │
├─────────────────────┼───────────────────────────────────────────┤
│ State               │ Master, Running                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Version             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Last Event          │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Triggered At        │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Services            │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Monitors            │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Master ID           │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Node ID             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Slave Server IDs    │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Current Connections │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Total Connections   │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Max Connections     │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Statistics          │ {                                         │
│                     │     "active_operations": 0,               │
│                     │     "adaptive_avg_select_time": "0ns",    │
│                     │     "connection_pool_empty": 0,           │
│                     │     "connections": 0,                     │
│                     │     "max_connections": 0,                 │
│                     │     "max_pool_size": 0,                   │
│                     │     "persistent_connections": 0,          │
│                     │     "reused_connections": 0,              │
│                     │     "routed_packets": 0,                  │
│                     │     "total_connections": 0                │
│                     │ }                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Parameters          │ {                                         │
│                     │     "address": "192.0.2.1",               │
│                     │     "disk_space_threshold": null,         │
│                     │     "extra_port": 0,                      │
│                     │     "monitorpw": null,                    │
│                     │     "monitoruser": null,                  │
│                     │     "persistmaxtime": 0,                  │
│                     │     "persistpoolmax": 0,                  │
│                     │     "port": 3306,                         │
│                     │     "priority": 0,                        │
│                     │     "proxy_protocol": false,              │
│                     │     "rank": "primary",                    │
│                     │     "socket": null,                       │
│                     │     "ssl": false,                         │
│                     │     "ssl_ca_cert": null,                  │
│                     │     "ssl_cert": null,                     │
│                     │     "ssl_cert_verify_depth": 9,           │
│                     │     "ssl_cipher": null,                   │
│                     │     "ssl_key": null,                      │
│                     │     "ssl_verify_peer_certificate": false, │
│                     │     "ssl_verify_peer_host": false,        │
│                     │     "ssl_version": "MAX"                  │
│                     │ }                                         │
└─────────────────────┴───────────────────────────────────────────┘
┌─────────────────────┬───────────────────────────────────────────┐
│ Server              │ xpand3                                    │
├─────────────────────┼───────────────────────────────────────────┤
│ Address             │ 192.0.2.3                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Port                │ 3306                                      │
├─────────────────────┼───────────────────────────────────────────┤
│ State               │ Master, Running                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Version             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Last Event          │ master_up                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Triggered At        │ Mon, 02 Aug 2021 22:42:17 GMT             │
├─────────────────────┼───────────────────────────────────────────┤
│ Services            │ xpand_service                             │
├─────────────────────┼───────────────────────────────────────────┤
│ Monitors            │ xpand_monitor                             │
├─────────────────────┼───────────────────────────────────────────┤
│ Master ID           │ -1                                        │
├─────────────────────┼───────────────────────────────────────────┤
│ Node ID             │ -1                                        │
├─────────────────────┼───────────────────────────────────────────┤
│ Slave Server IDs    │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Current Connections │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Total Connections   │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Max Connections     │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Statistics          │ {                                         │
│                     │     "active_operations": 0,               │
│                     │     "adaptive_avg_select_time": "0ns",    │
│                     │     "connection_pool_empty": 0,           │
│                     │     "connections": 0,                     │
│                     │     "max_connections": 0,                 │
│                     │     "max_pool_size": 0,                   │
│                     │     "persistent_connections": 0,          │
│                     │     "reused_connections": 0,              │
│                     │     "routed_packets": 0,                  │
│                     │     "total_connections": 0                │
│                     │ }                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Parameters          │ {                                         │
│                     │     "address": "192.0.2.3",               │
│                     │     "disk_space_threshold": null,         │
│                     │     "extra_port": 0,                      │
│                     │     "monitorpw": null,                    │
│                     │     "monitoruser": null,                  │
│                     │     "persistmaxtime": 0,                  │
│                     │     "persistpoolmax": 0,                  │
│                     │     "port": 3306,                         │
│                     │     "priority": 0,                        │
│                     │     "proxy_protocol": false,              │
│                     │     "rank": "primary",                    │
│                     │     "socket": null,                       │
│                     │     "ssl": false,                         │
│                     │     "ssl_ca_cert": null,                  │
│                     │     "ssl_cert": null,                     │
│                     │     "ssl_cert_verify_depth": 9,           │
│                     │     "ssl_cipher": null,                   │
│                     │     "ssl_key": null,                      │
│                     │     "ssl_verify_peer_certificate": false, │
│                     │     "ssl_verify_peer_host": false,        │
│                     │     "ssl_version": "MAX"                  │
│                     │ }                                         │
└─────────────────────┴───────────────────────────────────────────┘
┌─────────────────────┬───────────────────────────────────────────┐
│ Server              │ xpand2                                    │
├─────────────────────┼───────────────────────────────────────────┤
│ Address             │ 192.0.2.2                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Port                │ 3306                                      │
├─────────────────────┼───────────────────────────────────────────┤
│ State               │ Master, Running                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Version             │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Last Event          │ master_up                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Triggered At        │ Mon, 02 Aug 2021 22:42:17 GMT             │
├─────────────────────┼───────────────────────────────────────────┤
│ Services            │ xpand_service                             │
├─────────────────────┼───────────────────────────────────────────┤
│ Monitors            │ xpand_monitor                             │
├─────────────────────┼───────────────────────────────────────────┤
│ Master ID           │ -1                                        │
├─────────────────────┼───────────────────────────────────────────┤
│ Node ID             │ -1                                        │
├─────────────────────┼───────────────────────────────────────────┤
│ Slave Server IDs    │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Current Connections │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Total Connections   │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Max Connections     │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Statistics          │ {                                         │
│                     │     "active_operations": 0,               │
│                     │     "adaptive_avg_select_time": "0ns",    │
│                     │     "connection_pool_empty": 0,           │
│                     │     "connections": 0,                     │
│                     │     "max_connections": 0,                 │
│                     │     "max_pool_size": 0,                   │
│                     │     "persistent_connections": 0,          │
│                     │     "reused_connections": 0,              │
│                     │     "routed_packets": 0,                  │
│                     │     "total_connections": 0                │
│                     │ }                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Parameters          │ {                                         │
│                     │     "address": "192.0.2.2",               │
│                     │     "disk_space_threshold": null,         │
│                     │     "extra_port": 0,                      │
│                     │     "monitorpw": null,                    │
│                     │     "monitoruser": null,                  │
│                     │     "persistmaxtime": 0,                  │
│                     │     "persistpoolmax": 0,                  │
│                     │     "port": 3306,                         │
│                     │     "priority": 0,                        │
│                     │     "proxy_protocol": false,              │
│                     │     "rank": "primary",                    │
│                     │     "socket": null,                       │
│                     │     "ssl": false,                         │
│                     │     "ssl_ca_cert": null,                  │
│                     │     "ssl_cert": null,                     │
│                     │     "ssl_cert_verify_depth": 9,           │
│                     │     "ssl_cipher": null,                   │
│                     │     "ssl_key": null,                      │
│                     │     "ssl_verify_peer_certificate": false, │
│                     │     "ssl_verify_peer_host": false,        │
│                     │     "ssl_version": "MAX"                  │
│                     │ }                                         │
└─────────────────────┴───────────────────────────────────────────┘
┌─────────────────────┬───────────────────────────────────────────┐
│ Server              │ xpand1                                    │
├─────────────────────┼───────────────────────────────────────────┤
│ Address             │ 192.0.2.1                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Port                │ 3306                                      │
├─────────────────────┼───────────────────────────────────────────┤
│ State               │ Master, Running                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Version             │ 5.0.45-Xpand-5.3.23                       │
├─────────────────────┼───────────────────────────────────────────┤
│ Last Event          │ master_up                                 │
├─────────────────────┼───────────────────────────────────────────┤
│ Triggered At        │ Mon, 02 Aug 2021 22:42:17 GMT             │
├─────────────────────┼───────────────────────────────────────────┤
│ Services            │ xpand_service                             │
├─────────────────────┼───────────────────────────────────────────┤
│ Monitors            │ xpand_monitor                             │
├─────────────────────┼───────────────────────────────────────────┤
│ Master ID           │ -1                                        │
├─────────────────────┼───────────────────────────────────────────┤
│ Node ID             │ -1                                        │
├─────────────────────┼───────────────────────────────────────────┤
│ Slave Server IDs    │                                           │
├─────────────────────┼───────────────────────────────────────────┤
│ Current Connections │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Total Connections   │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Max Connections     │ 0                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Statistics          │ {                                         │
│                     │     "active_operations": 0,               │
│                     │     "adaptive_avg_select_time": "0ns",    │
│                     │     "connection_pool_empty": 0,           │
│                     │     "connections": 0,                     │
│                     │     "max_connections": 0,                 │
│                     │     "max_pool_size": 0,                   │
│                     │     "persistent_connections": 0,          │
│                     │     "reused_connections": 0,              │
│                     │     "routed_packets": 0,                  │
│                     │     "total_connections": 0                │
│                     │ }                                         │
├─────────────────────┼───────────────────────────────────────────┤
│ Parameters          │ {                                         │
│                     │     "address": "192.0.2.1",               │
│                     │     "disk_space_threshold": null,         │
│                     │     "extra_port": 0,                      │
│                     │     "monitorpw": null,                    │
│                     │     "monitoruser": null,                  │
│                     │     "persistmaxtime": 0,                  │
│                     │     "persistpoolmax": 0,                  │
│                     │     "port": 3306,                         │
│                     │     "priority": 0,                        │
│                     │     "proxy_protocol": false,              │
│                     │     "rank": "primary",                    │
│                     │     "socket": null,                       │
│                     │     "ssl": false,                         │
│                     │     "ssl_ca_cert": null,                  │
│                     │     "ssl_cert": null,                     │
│                     │     "ssl_cert_verify_depth": 9,           │
│                     │     "ssl_cipher": null,                   │
│                     │     "ssl_key": null,                      │
│                     │     "ssl_verify_peer_certificate": false, │
│                     │     "ssl_verify_peer_host": false,        │
│                     │     "ssl_version": "MAX"                  │
│                     │ }                                         │
└─────────────────────┴───────────────────────────────────────────┘

Output will align to the server configuration you performed.

Check Monitor Configuration

Use the maxctrl show monitor command to display the Xpand monitor configuration.

This action is performed on the MaxScale node:

$ maxctrl show monitor xpand_monitor
┌─────────────────────┬────────────────────────────────────────┐
│ Monitor             │ xpand_monitor                          │
├─────────────────────┼────────────────────────────────────────┤
│ Module              │ xpandmon                               │
├─────────────────────┼────────────────────────────────────────┤
│ State               │ Running                                │
├─────────────────────┼────────────────────────────────────────┤
│ Servers             │ xpand1                                 │
│                     │ xpand2                                 │
│                     │ xpand3                                 │
├─────────────────────┼────────────────────────────────────────┤
│ Parameters          │ {                                      │
│                     │     "backend_connect_attempts": 1,     │
│                     │     "backend_connect_timeout": 3,      │
│                     │     "backend_read_timeout": 3,         │
│                     │     "backend_write_timeout": 3,        │
│                     │     "cluster_monitor_interval": 60000, │
│                     │     "disk_space_check_interval": 0,    │
│                     │     "disk_space_threshold": null,      │
│                     │     "dynamic_node_detection": true,    │
│                     │     "events": "all",                   │
│                     │     "health_check_port": 3581,         │
│                     │     "health_check_threshold": 2,       │
│                     │     "journal_max_age": 28800,          │
│                     │     "monitor_interval": 2000,          │
│                     │     "password": "*****",               │
│                     │     "script": null,                    │
│                     │     "script_timeout": 90,              │
│                     │     "user": "mxs"                      │
│                     │ }                                      │
├─────────────────────┼────────────────────────────────────────┤
│ Monitor Diagnostics │ {}                                     │
└─────────────────────┴────────────────────────────────────────┘

Output will align to the monitor configuration you performed.

Check Service Configuration

This action is performed on the MaxScale node:

$ maxctrl show service xpand_service
┌─────────────────────┬────────────────────────────────────────────┐
│ Service             │ xpand_service                              │
├─────────────────────┼────────────────────────────────────────────┤
│ Router              │ readwritesplit                             │
├─────────────────────┼────────────────────────────────────────────┤
│ State               │ Started                                    │
├─────────────────────┼────────────────────────────────────────────┤
│ Started At          │ Mon, 02 Aug 2021 22:40:59 GMT              │
├─────────────────────┼────────────────────────────────────────────┤
│ Current Connections │ 0                                          │
├─────────────────────┼────────────────────────────────────────────┤
│ Total Connections   │ 0                                          │
├─────────────────────┼────────────────────────────────────────────┤
│ Max Connections     │ 0                                          │
├─────────────────────┼────────────────────────────────────────────┤
│ Cluster             │                                            │
├─────────────────────┼────────────────────────────────────────────┤
│ Servers             │ xpand1                                     │
│                     │ xpand2                                     │
│                     │ xpand3                                     │
├─────────────────────┼────────────────────────────────────────────┤
│ Services            │                                            │
├─────────────────────┼────────────────────────────────────────────┤
│ Filters             │                                            │
├─────────────────────┼────────────────────────────────────────────┤
│ Parameters          │ {                                          │
│                     │     "auth_all_servers": false,             │
│                     │     "cluster": null,                       │
│                     │     "connection_keepalive": 300,           │
│                     │     "connection_timeout": 0,               │
│                     │     "enable_root_user": false,             │
│                     │     "localhost_match_wildcard_host": true, │
│                     │     "log_auth_warnings": true,             │
│                     │     "max_connections": 0,                  │
│                     │     "net_write_timeout": 0,                │
│                     │     "password": "*****",                   │
│                     │     "rank": "primary",                     │
│                     │     "retain_last_statements": -1,          │
│                     │     "router_options": null,                │
│                     │     "session_trace": false,                │
│                     │     "session_track_trx_state": false,      │
│                     │     "strip_db_esc": true,                  │
│                     │     "targets": null,                       │
│                     │     "user": "mxs",                         │
│                     │     "version_string": null                 │
│                     │ }                                          │
├─────────────────────┼────────────────────────────────────────────┤
│ Router Diagnostics  │ {                                          │
│                     │     "queries": 0,                          │
│                     │     "server_query_statistics": []          │
│                     │ }                                          │
└─────────────────────┴────────────────────────────────────────────┘

Output will align to the Read/Write Split Router configuration you performed.

Test Application Database User

Your application should have a dedicated database user account. The user account must be created in Xpand. The user account must be able to connect from both the MaxScale node and the application server.

This action is performed on any Xpand node:

  1. Connect to an Xpand:

    $ mysql --user=root --password
    
  2. Create the database user account for your MaxScale node:

    CREATE USER 'xpand_app_user'@'192.0.2.10'
    IDENTIFIED BY 'xpand_app_user_passwd';
    

    Replace 192.0.2.10 with the relevant IP address specification for your MaxScale node.

    Passwords should meet your organization's password policies.

  3. Grant the database user account for your MaxScale node the privileges required by your application:

    GRANT ALL ON test.*
    TO 'xpand_app_user'@'192.0.2.10';
    
    GRANT SELECT ON system.nodes
    TO 'xpand_app_user'@'192.0.2.10';
    
    GRANT SELECT ON system.sessions
    TO 'xpand_app_user'@'192.0.2.10';
    

    The privileges shown are designed to allow the tests in the subsequent sections to work. The user account for your production application may require different privileges.

  4. Create the database user account for your application server:

    CREATE USER 'xpand_app_user'@'192.0.2.20'
    IDENTIFIED BY 'xpand_app_user_passwd';
    

    Replace 192.0.2.20 with the relevant IP address specification for your application server.

    Passwords should meet your organization's password policies.

  5. Grant the database user account for your application server the privileges required for your application:

    GRANT ALL ON test.*
    TO 'xpand_app_user'@'192.0.2.20';
    
    GRANT SELECT ON system.nodes
    TO 'xpand_app_user'@'192.0.2.20';
    
    GRANT SELECT ON system.sessions
    TO 'xpand_app_user'@'192.0.2.20';
    

    The privileges shown are designed to allow the tests in the subsequent sections to work. The user account for your production application may require different privileges.

Test Application Connections

This action is performed on a client connected to the MaxScale node:

  1. Use the MariaDB Client to connect to the listener port on the MaxScale node:

    $ mariadb --host=192.0.2.10 \
          --user=xpand_app_user \
          --password
    

    The listener port (Configure a Listener) should be specified by the --port option. When the listener uses TCP port 3306, you do not need to specify the port to the client.

    The user account (Test Application Database User) should be specified by the --user option.

    MaxScale's Read/Write Split Router (Configure Read/Write split Router) will route the connection to one of the Xpand nodes (Configure Server Objects).

  2. Use the client connection to query the Xpand node's hostname:

    SELECT hostname
    FROM system.nodes
    WHERE nodeid IN(
       SELECT nodeid
       FROM system.sessions
       WHERE session_id=@@session_id
    );
    

    The output will show the hostname of one of the Xpand nodes.

Test Connection Load Balancing

This action is performed on a client connected to the MaxScale node:

  1. Open multiple terminals on the client.

  2. In each terminal, use the MariaDB Client to connect to the listener port on the MaxScale node:

    $ mariadb --host=192.0.2.10 \
       --user=xpand_app_user \
       --password
    

    The listener port (Configure a Listener) should be specified by the --port option. When the listener uses TCP port 3306, you do not need to specify the port to the client.

    The user account (Test Application Database User) should be specified by the --user option.

    MaxScale's Read/Write Split Router (Configure Read/Write Split Router) will route the connection to one of the Xpand nodes (Configure Server Objects).

  3. In each terminal, use the client connection to query the Xpand node's hostname:

    SELECT hostname
    FROM system.nodes
    WHERE nodeid IN(
       SELECT nodeid
       FROM system.sessions
       WHERE session_id=@@session_id
    );
    

    The output will show the hostname of one of the Xpand nodes.

  4. Confirm that MaxScale is load balancing connections by checking that different terminals output different hostnames.

Next Step

Navigation in the procedure "Deploy Xpand Topology":

  • This page was step 6 of 6.

  • This procedure is complete.