All pages
Powered by GitBook
1 of 11

MaxScale REST API

Manage MariaDB MaxScale programmatically using the REST API. This interface allows for the dynamic administration and monitoring of MaxScale resources like servers, services, and listeners.

MaxScale Admin User Resource

Admin User Resource

Admin users represent administrative users that are able to query and change MaxScale's configuration.

Resource Operations

Get network user

GET /v1/users/inet/:name

Get a single network user. The :name in the URI must be a valid network user name.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "account": "admin",
            "created": "Fri, 05 Jan 2024 07:23:54 GMT",
            "last_login": "Fri, 05 Jan 2024 07:24:11 GMT",
            "last_update": null,
            "name": "admin"
        },
        "id": "admin",
        "links": {
            "self": "http://localhost:8989/v1/users/inet/admin/"
        },
        "type": "inet"
    },
    "links": {
        "self": "http://localhost:8989/v1/users/inet/admin/"
    }
}

Get all network users

GET /v1/users/inet

Get all network users.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "account": "admin",
                "created": "Fri, 05 Jan 2024 07:23:54 GMT",
                "last_login": "Fri, 05 Jan 2024 07:24:11 GMT",
                "last_update": null,
                "name": "admin"
            },
            "id": "admin",
            "links": {
                "self": "http://localhost:8989/v1/users/inet/admin/"
            },
            "type": "inet"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/users/inet/"
    }
}

Get enabled UNIX account

GET /v1/users/unix/:name

Note: This endpoint has been deprecated and does nothing.

Get all enabled UNIX accounts

GET /v1/users/unix

Note: This endpoint has been deprecated and does nothing.

Get all users

GET /v1/users

Get all administrative users.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "account": "admin",
                "created": "Fri, 05 Jan 2024 07:23:54 GMT",
                "last_login": "Fri, 05 Jan 2024 07:24:11 GMT",
                "last_update": null,
                "name": "admin"
            },
            "id": "admin",
            "links": {
                "self": "http://localhost:8989/v1/users/inet/admin/"
            },
            "type": "inet"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/users/inet/"
    }
}

Create a network user

POST /v1/users/inet

Create a new network user. The request body must define at least the following fields.

  • data.id

  • The username

  • data.type

  • Type of the object, must be inet

  • data.attributes.password

  • The password for this user

  • data.attributes.account

  • Set to admin for administrative users and basic to read-only users

Only admin accounts can perform POST, PUT, DELETE and PATCH requests. If a basic account performs one of the aforementioned request, the REST API will respond with a 401 Unauthorized error.

Here is an example request body defining the network user my-user with the password my-password that is allowed to execute only read-only operations.

{
    "data": {
        "id": "my-user", // The user to create
        "type": "inet", // The type of the user
        "attributes": {
            "password": "my-password", // The password to use for the user
            "account": "basic" // The type of the account
        }
    }
}

Response

Status: 204 No Content

Enable a UNIX account

POST /v1/users/unix

This enables an existing UNIX account on the system for administrative operations. The request body must define at least the following fields.

  • data.id

  • The username

  • data.type

  • Type of the object, must be unix

  • data.attributes.account

  • Set to admin for administrative users and basic to read-only users

Here is an example request body enabling the UNIX account jdoe for read-only operations.

{
    "data": {
        "id": "jdoe", // Account name
        "type": "unix" // Account type
        "attributes": {
            "account": "basic" // Type of the user account in MaxScale
        }
    }
}

Response

Status: 204 No Content

Delete a network user

DELETE /v1/users/inet/:name

The :name part of the URI must be a valid user name.

Response

Status: 204 No Content

Disable a UNIX account

DELETE /v1/users/unix/:name

The :name part of the URI must be a valid user name.

Response

Status: 204 No Content

Update a network user

PATCH /v1/users/inet/:name

Update network user. Currently, only the password can be updated. This means that the request body must define the data.attributes.password field.

Here is an example request body that updates the password.

{
    "data": {
        "attributes": {
            "password": "new-password"
        }
    }
}

Response

Status: 204 No Content

This page is licensed: CC BY-SA / Gnu FDL

MaxScale Filter Resource

Filter Resource

A filter resource represents an instance of a filter inside MaxScale. Multiple services can use the same filter and a single service can use multiple filters.

Resource Operations

The :name in all of the URIs must be the name of a filter in MaxScale.

Get a filter

Get a single filter.

GET /v1/filters/:name

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "filter_diagnostics": null,
            "module": "qlafilter",
            "parameters": {
                "append": false,
                "duration_unit": "ms",
                "exclude": null,
                "filebase": "/tmp/qla.log",
                "flush": true,
                "log_data": "date,user,query",
                "log_type": "unified",
                "match": null,
                "module": "qlafilter",
                "newline_replacement": " ",
                "options": "",
                "separator": ",",
                "source": null,
                "source_exclude": null,
                "source_match": null,
                "use_canonical_form": false,
                "user": null,
                "user_exclude": null,
                "user_match": null
            },
            "source": {
                "file": "/etc/maxscale.cnf",
                "type": "static"
            }
        },
        "id": "QLA",
        "links": {
            "self": "http://localhost:8989/v1/filters/QLA/"
        },
        "relationships": {
            "services": {
                "data": [
                    {
                        "id": "Read-Connection-Router",
                        "type": "services"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/services/",
                    "self": "http://localhost:8989/v1/filters/QLA/relationships/services/"
                }
            }
        },
        "type": "filters"
    },
    "links": {
        "self": "http://localhost:8989/v1/filters/QLA/"
    }
}

Get all filters

Get all filters.

GET /v1/filters

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "filter_diagnostics": null,
                "module": "qlafilter",
                "parameters": {
                    "append": false,
                    "duration_unit": "ms",
                    "exclude": null,
                    "filebase": "/tmp/qla.log",
                    "flush": true,
                    "log_data": "date,user,query",
                    "log_type": "unified",
                    "match": null,
                    "module": "qlafilter",
                    "newline_replacement": " ",
                    "options": "",
                    "separator": ",",
                    "source": null,
                    "source_exclude": null,
                    "source_match": null,
                    "use_canonical_form": false,
                    "user": null,
                    "user_exclude": null,
                    "user_match": null
                },
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                }
            },
            "id": "QLA",
            "links": {
                "self": "http://localhost:8989/v1/filters/QLA/"
            },
            "relationships": {
                "services": {
                    "data": [
                        {
                            "id": "Read-Connection-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/filters/QLA/relationships/services/"
                    }
                }
            },
            "type": "filters"
        },
        {
            "attributes": {
                "module": "hintfilter",
                "parameters": {
                    "module": "hintfilter"
                },
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                }
            },
            "id": "Hint",
            "links": {
                "self": "http://localhost:8989/v1/filters/Hint/"
            },
            "relationships": {
                "services": {
                    "data": [
                        {
                            "id": "Read-Connection-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/filters/Hint/relationships/services/"
                    }
                }
            },
            "type": "filters"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/filters/"
    }
}

Create a filter

POST /v1/filters

Create a new filter. The posted object must define at least the following fields.

  • data.id

  • Name of the filter

  • data.type

  • Type of the object, must be filters

  • data.attributes.module

  • The filter module to use

All of the filter parameters should be defined at creation time in thedata.attributes.parameters object.

As the service to filter relationship is ordered (filters are applied in the order they are listed), filter to service relationships cannot be defined at creation time.

The following example defines a request body which creates a new filter.

{
    "data": {
        "id": "test-filter", // Name of the filter
        "type": "filters",
        "attributes": {
            "module": "qlafilter", // The filter uses the qlafilter module
            "parameters": { // Filter parameters
                "filebase": "/tmp/qla.log"
            }
        }
    }
}

Response

Filter is created:

Status: 204 No Content

Update a filter

PATCH /v1/filters/:name

Filter parameters can be updated at runtime if the module supports it. Refer to the individual module documentation for more details on whether it supports runtime configuration and which parameters can be updated.

The following example modifies a filter by changing the match parameter to.*users.*.

{
    "data": {
        "attributes": {
            "parameters": {
                "match": ".*users.*"
            }
        }
    }
}

Response

Filter is modified:

Status: 204 No Content

Destroy a filter

DELETE /v1/filters/:filter

The :filter in the URI must map to the name of the filter to be destroyed.

A filter can only be destroyed if no service uses it. This means that thedata.relationships object for the filter must be empty. Note that the service → filter relationship cannot be modified from the filters resource and must be done via the services resource.

This endpoint also supports the force=yes parameter that will unconditionally delete the filter by first removing it from all services that it uses.

Response

Filter is destroyed:

Status: 204 No Content

This page is licensed: CC BY-SA / Gnu FDL

MaxScale Listener Resource

Listener Resource

A listener resource represents a listener of a service in MaxScale. All listeners point to a service in MaxScale.

Resource Operations

Get a listener

GET /v1/listeners/:name

Get a single listener. The :name in the URI must be the name of a listener in MaxScale.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "parameters": {
                "MariaDBProtocol": {
                    "allow_replication": true
                },
                "address": "::",
                "authenticator": null,
                "authenticator_options": null,
                "connection_init_sql_file": null,
                "connection_metadata": [
                    "character_set_client=auto",
                    "character_set_connection=auto",
                    "character_set_results=auto",
                    "max_allowed_packet=auto",
                    "system_time_zone=auto",
                    "time_zone=auto",
                    "tx_isolation=auto",
                    "maxscale=auto"
                ],
                "port": 4006,
                "protocol": "MariaDBProtocol",
                "proxy_protocol_networks": null,
                "service": "RW-Split-Router",
                "socket": null,
                "sql_mode": "default",
                "ssl": false,
                "ssl_ca": null,
                "ssl_cert": null,
                "ssl_cert_verify_depth": 9,
                "ssl_cipher": null,
                "ssl_crl": null,
                "ssl_key": null,
                "ssl_verify_peer_certificate": false,
                "ssl_verify_peer_host": false,
                "ssl_version": "MAX",
                "type": "listener",
                "user_mapping_file": null
            },
            "source": {
                "file": "/etc/maxscale.cnf",
                "type": "static"
            },
            "state": "Running"
        },
        "id": "RW-Split-Listener",
        "relationships": {
            "services": {
                "data": [
                    {
                        "id": "RW-Split-Router",
                        "type": "services"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/services/",
                    "self": "http://localhost:8989/v1/listeners/RW-Split-Listener/relationships/services/"
                }
            }
        },
        "type": "listeners"
    },
    "links": {
        "self": "http://localhost:8989/v1/listeners/RW-Split-Listener/"
    }
}

Get all listeners

GET /v1/listeners

Get all listeners.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "parameters": {
                    "MariaDBProtocol": {
                        "allow_replication": true
                    },
                    "address": "::",
                    "authenticator": null,
                    "authenticator_options": null,
                    "connection_init_sql_file": null,
                    "connection_metadata": [
                        "character_set_client=auto",
                        "character_set_connection=auto",
                        "character_set_results=auto",
                        "max_allowed_packet=auto",
                        "system_time_zone=auto",
                        "time_zone=auto",
                        "tx_isolation=auto",
                        "maxscale=auto"
                    ],
                    "port": 4006,
                    "protocol": "MariaDBProtocol",
                    "proxy_protocol_networks": null,
                    "service": "RW-Split-Router",
                    "socket": null,
                    "sql_mode": "default",
                    "ssl": false,
                    "ssl_ca": null,
                    "ssl_cert": null,
                    "ssl_cert_verify_depth": 9,
                    "ssl_cipher": null,
                    "ssl_crl": null,
                    "ssl_key": null,
                    "ssl_verify_peer_certificate": false,
                    "ssl_verify_peer_host": false,
                    "ssl_version": "MAX",
                    "type": "listener",
                    "user_mapping_file": null
                },
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                },
                "state": "Running"
            },
            "id": "RW-Split-Listener",
            "relationships": {
                "services": {
                    "data": [
                        {
                            "id": "RW-Split-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/listeners/RW-Split-Listener/relationships/services/"
                    }
                }
            },
            "type": "listeners"
        },
        {
            "attributes": {
                "parameters": {
                    "MariaDBProtocol": {
                        "allow_replication": true
                    },
                    "address": "::",
                    "authenticator": null,
                    "authenticator_options": null,
                    "connection_init_sql_file": null,
                    "connection_metadata": [
                        "character_set_client=auto",
                        "character_set_connection=auto",
                        "character_set_results=auto",
                        "max_allowed_packet=auto",
                        "system_time_zone=auto",
                        "time_zone=auto",
                        "tx_isolation=auto",
                        "maxscale=auto"
                    ],
                    "port": 4008,
                    "protocol": "MariaDBProtocol",
                    "proxy_protocol_networks": null,
                    "service": "Read-Connection-Router",
                    "socket": null,
                    "sql_mode": "default",
                    "ssl": false,
                    "ssl_ca": null,
                    "ssl_cert": null,
                    "ssl_cert_verify_depth": 9,
                    "ssl_cipher": null,
                    "ssl_crl": null,
                    "ssl_key": null,
                    "ssl_verify_peer_certificate": false,
                    "ssl_verify_peer_host": false,
                    "ssl_version": "MAX",
                    "type": "listener",
                    "user_mapping_file": null
                },
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                },
                "state": "Running"
            },
            "id": "Read-Connection-Listener",
            "relationships": {
                "services": {
                    "data": [
                        {
                            "id": "Read-Connection-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/listeners/Read-Connection-Listener/relationships/services/"
                    }
                }
            },
            "type": "listeners"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/listeners/"
    }
}

Create a new listener

POST /v1/listeners

Creates a new listener. The request body must define the following fields.

  • data.id

  • Name of the listener

  • data.type

  • Type of the object, must be listeners

  • data.attributes.parameters.port OR data.attributes.parameters.socket

  • The TCP port or UNIX Domain Socket the listener listens on. Only one of the fields can be defined.

  • data.relationships.services.data

  • The service relationships data, must define a JSON object with an id value that defines the service to use and a type value set to services.

The following is the minimal required JSON object for defining a new listener.

{
    "data": {
        "id": "my-listener",
        "type": "listeners",
        "attributes": {
            "parameters": {
                "port": 3306
            }
        },
        "relationships": {
            "services": {
                "data": [
                    {"id": "RW-Split-Router", "type": "services"}
                ]
            }
        }
    }
}

Refer to the Configuration Guide for a full list of listener parameters.

Response

Listener is created:

Status: 204 No Content

Update a listener

PATCH /v1/listeners/:name

The request body must be a JSON object which represents a set of new definitions for the listener.

All parameters marked as modifiable at runtime can be modified. Currently, all TLS/SSL parameters and the connection_init_sql_file and sql_mode parameters can be modified at runtime.

Parameters that affect the network address or the port the listener listens on cannot be modified at runtime. To modify these parameters, recreate the listener.

Response

Listener is modified:

Status: 204 No Content

Destroy a listener

DELETE /v1/listeners/:name

The :name must be a valid listener name. When a listener is destroyed, the network port it listens on is available for reuse.

Response

Listener is destroyed:

Status: 204 No Content

Listener cannot be deleted:

Status: 400 Bad Request

Stop a listener

PUT /v1/listeners/:name/stop

Stops a started listener. When a listener is stopped, new connections are no longer accepted and are queued until the listener is started again.

Parameters

This endpoint supports the following parameters:

  • force=yes

  • Close all existing connections that were created through this listener.

Response

Listener is stopped:

Status: 204 No Content

Start a listener

PUT /v1/listeners/:name/start

Starts a stopped listener.

Response

Listener is started:

Status: 204 No Content

This page is licensed: CC BY-SA / Gnu FDL

MaxScale MaxScale Resource

MaxScale Resource

The MaxScale resource represents a MaxScale instance and it is the core on top of which the modules build upon.

Resource Operations

Get global information

GET /v1/maxscale

Retrieve global information about a MaxScale instance. This includes various file locations, configuration options and version information.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "activated_at": "Fri, 05 Jan 2024 07:23:54 GMT",
            "commit": "af392f1a43e72e5538e1956aa500d77aca4d4456",
            "config_sync": null,
            "parameters": {
                "admin_audit": false,
                "admin_audit_exclude_methods": [],
                "admin_audit_file": "/var/log/maxscale/admin_audit.csv",
                "admin_auth": true,
                "admin_enabled": true,
                "admin_gui": true,
                "admin_host": "127.0.0.1",
                "admin_jwt_algorithm": "auto",
                "admin_jwt_issuer": "maxscale",
                "admin_jwt_key": null,
                "admin_jwt_max_age": "86400000ms",
                "admin_log_auth_failures": true,
                "admin_oidc_url": null,
                "admin_pam_readonly_service": null,
                "admin_pam_readwrite_service": null,
                "admin_port": 8989,
                "admin_readonly_hosts": "*",
                "admin_readwrite_hosts": "*",
                "admin_secure_gui": false,
                "admin_ssl_ca": null,
                "admin_ssl_cert": null,
                "admin_ssl_key": null,
                "admin_ssl_version": "MAX",
                "admin_verify_url": null,
                "auth_connect_timeout": "10000ms",
                "auth_read_timeout": "10000ms",
                "auth_write_timeout": "10000ms",
                "auto_tune": [],
                "cachedir": "/var/cache/maxscale",
                "config_sync_cluster": null,
                "config_sync_db": "mysql",
                "config_sync_interval": "5000ms",
                "config_sync_password": null,
                "config_sync_timeout": "10000ms",
                "config_sync_user": null,
                "connector_plugindir": "/usr/lib64/maxscale/plugin",
                "datadir": "/var/lib/maxscale",
                "debug": null,
                "dump_last_statements": "never",
                "execdir": "/usr/bin",
                "key_manager": "none",
                "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": 10,
                    "suppress": 10000,
                    "window": 1000
                },
                "log_warn_super_user": false,
                "log_warning": true,
                "logdir": "/var/log/maxscale",
                "max_auth_errors_until_block": 10,
                "max_read_amount": 0,
                "maxlog": true,
                "module_configdir": "/etc/maxscale.modules.d",
                "ms_timestamp": false,
                "passive": false,
                "persist_runtime_changes": true,
                "persistdir": "/var/lib/maxscale/maxscale.cnf.d",
                "piddir": "/var/run/maxscale",
                "query_classifier_cache_size": 5003753472,
                "query_retries": 1,
                "query_retry_timeout": "5000ms",
                "rebalance_period": "0ms",
                "rebalance_threshold": 20,
                "rebalance_window": 10,
                "retain_last_statements": 0,
                "session_trace": 0,
                "session_trace_match": null,
                "skip_name_resolve": false,
                "sql_mode": "default",
                "syslog": false,
                "threads": 3,
                "threads_max": 256,
                "users_refresh_interval": "0ms",
                "users_refresh_time": "0ms",
                "writeq_high_water": 65536,
                "writeq_low_water": 1024
            },
            "process_datadir": "/var/lib/maxscale/data1",
            "started_at": "Fri, 05 Jan 2024 07:23:54 GMT",
            "system": {
                "machine": {
                    "cores_available": 8,
                    "cores_physical": 8,
                    "cores_virtual": 8.0,
                    "memory_available": 33358356480,
                    "memory_physical": 33358356480
                },
                "maxscale": {
                    "query_classifier_cache_size": 5003753472,
                    "threads": 3
                },
                "os": {
                    "machine": "x86_64",
                    "nodename": "monolith",
                    "release": "6.6.4-100.fc38.x86_64",
                    "sysname": "Linux",
                    "version": "#1 SMP PREEMPT_DYNAMIC Sun Dec  3 18:11:27 UTC 2023"
                }
            },
            "uptime": 12,
            "version": "24.02.0"
        },
        "id": "maxscale",
        "type": "maxscale"
    },
    "links": {
        "self": "http://localhost:8989/v1/maxscale/"
    }
}

Update MaxScale parameters

PATCH /v1/maxscale

Update MaxScale parameters. The request body must define updated values for thedata.attributes.parameters object. The parameters that can be modified are listed in the /v1/maxscale/modules/maxscale endpoint and have the modifiable value set to true.

Response

Parameters modified:

Status: 204 No Content

Invalid JSON body:

Status: 400 Bad Request

Get thread information

GET /v1/maxscale/threads/:id

Get the information and statistics of a particular thread. The :id in the URI must map to a valid thread number between 0 and the configured value of threads.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "stats": {
                "accepts": 0,
                "avg_event_queue_length": 1,
                "current_descriptors": 5,
                "errors": 0,
                "hangups": 0,
                "listening": true,
                "load": {
                    "last_hour": 0,
                    "last_minute": 0,
                    "last_second": 0
                },
                "max_event_queue_length": 1,
                "max_exec_time": 0,
                "max_queue_time": 0,
                "memory": {
                    "query_classifier": 0,
                    "sessions": 0,
                    "total": 0,
                    "zombies": 0
                },
                "query_classifier_cache": {
                    "evictions": 0,
                    "hits": 0,
                    "inserts": 0,
                    "misses": 0,
                    "size": 0
                },
                "reads": 20,
                "sessions": 0,
                "state": "Active",
                "total_descriptors": 5,
                "writes": 0,
                "zombies": 0
            }
        },
        "id": "0",
        "links": {
            "self": "http://localhost:8989/v1/threads/0/"
        },
        "type": "threads"
    },
    "links": {
        "self": "http://localhost:8989/v1/maxscale/threads/0/"
    }
}

Get information for all threads

GET /v1/maxscale/threads

Get the information for all threads. Returns a collection of threads resources.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "stats": {
                    "accepts": 0,
                    "avg_event_queue_length": 1,
                    "current_descriptors": 5,
                    "errors": 0,
                    "hangups": 0,
                    "listening": true,
                    "load": {
                        "last_hour": 0,
                        "last_minute": 0,
                        "last_second": 0
                    },
                    "max_event_queue_length": 1,
                    "max_exec_time": 0,
                    "max_queue_time": 0,
                    "memory": {
                        "query_classifier": 0,
                        "sessions": 0,
                        "total": 0,
                        "zombies": 0
                    },
                    "query_classifier_cache": {
                        "evictions": 0,
                        "hits": 0,
                        "inserts": 0,
                        "misses": 0,
                        "size": 0
                    },
                    "reads": 21,
                    "sessions": 0,
                    "state": "Active",
                    "total_descriptors": 5,
                    "writes": 0,
                    "zombies": 0
                }
            },
            "id": "0",
            "links": {
                "self": "http://localhost:8989/v1/threads/0/"
            },
            "type": "threads"
        },
        {
            "attributes": {
                "stats": {
                    "accepts": 1,
                    "avg_event_queue_length": 1,
                    "current_descriptors": 8,
                    "errors": 0,
                    "hangups": 0,
                    "listening": true,
                    "load": {
                        "last_hour": 0,
                        "last_minute": 0,
                        "last_second": 0
                    },
                    "max_event_queue_length": 2,
                    "max_exec_time": 1,
                    "max_queue_time": 0,
                    "memory": {
                        "query_classifier": 1481,
                        "sessions": 70221,
                        "total": 71702,
                        "zombies": 0
                    },
                    "query_classifier_cache": {
                        "evictions": 0,
                        "hits": 0,
                        "inserts": 3,
                        "misses": 4,
                        "size": 1481
                    },
                    "reads": 35,
                    "sessions": 1,
                    "state": "Active",
                    "total_descriptors": 8,
                    "writes": 15,
                    "zombies": 0
                }
            },
            "id": "1",
            "links": {
                "self": "http://localhost:8989/v1/threads/1/"
            },
            "type": "threads"
        },
        {
            "attributes": {
                "stats": {
                    "accepts": 0,
                    "avg_event_queue_length": 1,
                    "current_descriptors": 5,
                    "errors": 0,
                    "hangups": 0,
                    "listening": true,
                    "load": {
                        "last_hour": 0,
                        "last_minute": 0,
                        "last_second": 0
                    },
                    "max_event_queue_length": 1,
                    "max_exec_time": 0,
                    "max_queue_time": 0,
                    "memory": {
                        "query_classifier": 0,
                        "sessions": 0,
                        "total": 0,
                        "zombies": 0
                    },
                    "query_classifier_cache": {
                        "evictions": 0,
                        "hits": 0,
                        "inserts": 0,
                        "misses": 0,
                        "size": 0
                    },
                    "reads": 20,
                    "sessions": 0,
                    "state": "Active",
                    "total_descriptors": 5,
                    "writes": 0,
                    "zombies": 0
                }
            },
            "id": "2",
            "links": {
                "self": "http://localhost:8989/v1/threads/2/"
            },
            "type": "threads"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/maxscale/threads/"
    }
}

Get logging information

GET /v1/maxscale/logs

Get information about the current state of logging, enabled log files and the location where the log files are stored.

Note: The parameters in this endpoint are a subset of the parameters in the/v1/maxscale endpoint. Because of this, the parameters in this endpoint are deprecated as of MaxScale 6.0.

Note: In MaxScale 2.5 the log_throttling and ms_timestamp parameters were incorrectly named as throttling and highprecision. In MaxScale 6, the parameter names are now correct which means the parameters declared here aren't fully backwards compatible.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "log_file": "/var/log/maxscale/maxscale.log",
            "log_priorities": [
                "alert",
                "error",
                "warning",
                "notice"
            ],
            "parameters": {
                "log_debug": false,
                "log_info": false,
                "log_notice": true,
                "log_throttling": {
                    "count": 10,
                    "suppress": 10000,
                    "window": 1000
                },
                "log_warning": true,
                "maxlog": true,
                "ms_timestamp": false,
                "syslog": false
            }
        },
        "id": "logs",
        "type": "logs"
    },
    "links": {
        "self": "http://localhost:8989/v1/maxscale/logs/"
    }
}

Get log data

GET /v1/maxscale/logs/data

Get the contents of the MaxScale logs. This endpoint was added in MaxScale 6.

To navigate the log, use the prev link to move backwards to older log entries. The latest log entries can be read with the last link.

The entries are sorted in ascending order by the time they were logged. This means that with the default parameters, the latest logged event is the last element in the returned array.

Parameters

This endpoint supports the following parameters:

  • page[size]

  • Set number of rows of data to read. By default, 50 rows of data are read from the log.

  • page[cursor]

  • Set position from where the log data is retrieved. The default position to retrieve the log data is the end of the log. This value should not be modified by the user and the values returned in thelinks object should be used instead. This way the navigation will provide a consistent view of the log that does not overlap. Optionally, the id values in the returned data can be used as the values for this parameter to read data from a known point in the file.

  • priority

  • Include messages only from these log levels. The default is to include all messages. The value given should be a comma-separated list of log priorities. The priorities are alert, error, warning, notice, info anddebug. Note that the debug log level is only used in debug builds of MaxScale.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "log": [
                {
                    "id": "37",
                    "message": "MaxScale started with 3 worker threads.",
                    "priority": "notice",
                    "timestamp": "2024-01-05 07:23:54",
                    "unix_timestamp": 1704439434
                },
                {
                    "id": "38",
                    "message": "Read 8 user@host entries from 'server1' for service 'RW-Split-Router'.",
                    "priority": "notice",
                    "timestamp": "2024-01-05 07:23:55",
                    "unix_timestamp": 1704439435
                },
                {
                    "id": "39",
                    "message": "Read 8 user@host entries from 'server1' for service 'Read-Connection-Router'.",
                    "priority": "notice",
                    "timestamp": "2024-01-05 07:23:55",
                    "unix_timestamp": 1704439435
                }
            ],
            "log_source": "maxlog"
        },
        "id": "log_data",
        "type": "log_data"
    },
    "links": {
        "last": "http://localhost:8989/v1/maxscale/logs/data/?page%5Bsize%5D=3",
        "prev": "http://localhost:8989/v1/maxscale/logs/data/?page%5Bcursor%5D=34&page%5Bsize%5D=3",
        "self": "http://localhost:8989/v1/maxscale/logs/data/?page%5Bcursor%5D=40&page%5Bsize%5D=3"
    }
}

Get log entries

GET /v1/maxscale/logs/entries

Get the contents of the MaxScale logs as separate entries. This endpoint was added in MaxScale 24.02. This endpoint is nearly identical to the/v1/maxscale/logs/data endpoint except that this is a resource collection where each log line is a separate resource.

Parameters

This endpoint supports the same parameters as /maxscale/logs/data.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "log_source": "maxlog",
                "message": "MaxScale started with 3 worker threads.",
                "priority": "notice",
                "timestamp": "2024-01-05 07:23:54",
                "unix_timestamp": 1704439434
            },
            "id": "37",
            "type": "log_entry"
        },
        {
            "attributes": {
                "log_source": "maxlog",
                "message": "Read 8 user@host entries from 'server1' for service 'RW-Split-Router'.",
                "priority": "notice",
                "timestamp": "2024-01-05 07:23:55",
                "unix_timestamp": 1704439435
            },
            "id": "38",
            "type": "log_entry"
        },
        {
            "attributes": {
                "log_source": "maxlog",
                "message": "Read 8 user@host entries from 'server1' for service 'Read-Connection-Router'.",
                "priority": "notice",
                "timestamp": "2024-01-05 07:23:55",
                "unix_timestamp": 1704439435
            },
            "id": "39",
            "type": "log_entry"
        }
    ],
    "links": {
        "last": "http://localhost:8989/v1/maxscale/logs/entries/?page%5Bsize%5D=3",
        "prev": "http://localhost:8989/v1/maxscale/logs/entries/?page%5Bcursor%5D=34&page%5Bsize%5D=3",
        "self": "http://localhost:8989/v1/maxscale/logs/entries/?page%5Bcursor%5D=40&page%5Bsize%5D=3"
    },
    "meta": {
        "total": 3
    }
}

Stream log data

GET /v1/maxscale/logs/stream

Stream the contents of the MaxScale logs. This endpoint was added in MaxScale 6.

This endpoint opens a WebSocket connection and streams the contents of the log to it. Each WebSocket message will contain the JSON representation of the log message. The JSON is formatted in the same way as the values in the log array of the /v1/maxscale/logs/data endpoint:

{
    "id": "572",
    "message": "MaxScale started with 8 worker threads, each with a stack size of 8388608 bytes.",
    "priority": "notice",
    "timestamp": "2020-09-25 10:01:29"
}

Limitations

  • If the client writes any data to the open socket, it will be treated as an error and the stream is closed.

  • The WebSocket ping and close commands are not yet supported and will be treated as errors.

  • When maxlog is used as source of log data, any log messages logged after log rotation will not be sent if the file was moved or truncated. To fetch new events after log rotation, reopen the WebSocket connection.

Parameters

This endpoint supports the following parameters:

  • page[cursor]

  • Set position from where the log data is retrieved. The default position to retrieve the log data is the end of the log. To stream data from a known point, first read the data via the/v1/maxscale/logs/data endpoint and then use the id value of the newest log message (i.e. the first value in the log array) to start the stream.

  • priority

  • Include messages only from these log levels. The default is to include all messages. The value given should be a comma-separated list of log priorities. The priorities are alert, error, warning, notice, info anddebug. Note that the debug log level is only used in debug builds of MaxScale.

Response

Upgrade started:

Status: 101 Switching Protocols

Client didn't request a WebSocket upgrade:

Status: 426 Upgrade Required

Update logging parameters

Note: The modification of logging parameters via this endpoint has deprecated in MaxScale 6.0. The parameters should be modified with the/v1/maxscale endpoint instead.

Any PATCH requests done to this endpoint will be redirected to the/v1/maxscale endpoint. Due to the misspelling of the ms_timestamp andlog_throttling parameters, this is not fully backwards compatible.

PATCH /v1/maxscale/logs

Update logging parameters. The request body must define updated values for thedata.attributes.parameters object. All logging parameters can be altered at runtime.

Response

Parameters modified:

Status: 204 No Content

Invalid JSON body:

Status: 400 Bad Request

Flush and rotate log files

POST /v1/maxscale/logs/flush

Flushes any pending messages to disk and reopens the log files. The body of the message is ignored.

Response

Status: 204 No Content

Reload TLS certificates

POST /v1/maxscale/tls/reload

Reloads all TLS certificates for listeners and servers as well as the REST API itself. If the reloading fails, the old certificates will remain in use for the objects that failed to reload. This also causes the JWT signature keys to be reloaded if one of the asymmetric key algorithms is being used. If JWTs are being signed with a random symmetric keys, a new random key is created.

The reloading is not transactional: if a single listener or server fails to reload its certificates, the remaining ones are not reloaded. This means that a failed reload can partially reload certificates. The REST API certificates are only reloaded if all other certificate reloads were successful.

Response

Status: 204 No Content

Get a loaded module

GET /v1/maxscale/modules/:name

Retrieve information about a loaded module. The :name must be the name of a valid loaded module or either maxscale or servers.

The maxscale module will display the global configuration options (i.e. everything under the [maxscale] section) as a module.

The servers module displays the server object type and the configuration parameters it accepts as a module.

Any parameter with the modifiable value set to true can be modified at runtime using a PATCH command on the corresponding object endpoint.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "api": "router",
            "commands": [
                {
                    "attributes": {
                        "arg_max": 1,
                        "arg_min": 1,
                        "description": "Reset global GTID state in readwritesplit.",
                        "method": "POST",
                        "parameters": [
                            {
                                "description": "Readwritesplit service",
                                "required": true,
                                "type": "SERVICE"
                            }
                        ]
                    },
                    "id": "reset-gtid",
                    "links": {
                        "self": "http://localhost:8989/v1/modules/readwritesplit/reset-gtid/"
                    },
                    "type": "module_command"
                }
            ],
            "description": "A Read/Write splitting router for enhancement read scalability",
            "maturity": "GA",
            "module_type": "Router",
            "parameters": [
                {
                    "default_value": "none",
                    "description": "Causal reads mode",
                    "enum_values": [
                        "none",
                        "local",
                        "global",
                        "fast_global",
                        "fast",
                        "universal",
                        "fast_universal",
                        "false",
                        "off",
                        "0",
                        "true",
                        "on",
                        "1"
                    ],
                    "mandatory": false,
                    "modifiable": true,
                    "name": "causal_reads",
                    "type": "enum"
                },
                {
                    "default_value": "10000ms",
                    "description": "Timeout for the slave synchronization",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "causal_reads_timeout",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "default_value": false,
                    "description": "Retry failed writes outside of transactions",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "delayed_retry",
                    "type": "bool"
                },
                {
                    "default_value": "10000ms",
                    "description": "Timeout for delayed_retry",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "delayed_retry_timeout",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "default_value": false,
                    "description": "Create connections only when needed",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "lazy_connect",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Use master for reads",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "master_accept_reads",
                    "type": "bool"
                },
                {
                    "default_value": "fail_on_write",
                    "description": "Master failure mode behavior",
                    "enum_values": [
                        "fail_instantly",
                        "fail_on_write",
                        "error_on_write"
                    ],
                    "mandatory": false,
                    "modifiable": true,
                    "name": "master_failure_mode",
                    "type": "enum"
                },
                {
                    "default_value": true,
                    "description": "Reconnect to master",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "master_reconnection",
                    "type": "bool"
                },
                {
                    "default_value": "0ms",
                    "description": "Maximum replication lag",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "max_replication_lag",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "default_value": 255,
                    "description": "Maximum number of slave connections",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "max_slave_connections",
                    "type": "count"
                },
                {
                    "deprecated": true,
                    "description": "Alias for 'max_replication_lag'",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "max_slave_replication_lag",
                    "type": "duration"
                },
                {
                    "default_value": false,
                    "description": "Optimistically offload transactions to slaves",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "optimistic_trx",
                    "type": "bool"
                },
                {
                    "default_value": true,
                    "description": "Automatically retry failed reads outside of transactions",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "retry_failed_reads",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Reuse identical prepared statements inside the same connection",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "reuse_prepared_statements",
                    "type": "bool"
                },
                {
                    "default_value": 255,
                    "description": "Starting number of slave connections",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "slave_connections",
                    "type": "count"
                },
                {
                    "default_value": "least_current_operations",
                    "description": "Slave selection criteria",
                    "enum_values": [
                        "least_global_connections",
                        "least_router_connections",
                        "least_behind_master",
                        "least_current_operations",
                        "adaptive_routing",
                        "LEAST_GLOBAL_CONNECTIONS",
                        "LEAST_ROUTER_CONNECTIONS",
                        "LEAST_BEHIND_MASTER",
                        "LEAST_CURRENT_OPERATIONS",
                        "ADAPTIVE_ROUTING"
                    ],
                    "mandatory": false,
                    "modifiable": true,
                    "name": "slave_selection_criteria",
                    "type": "enum"
                },
                {
                    "default_value": false,
                    "description": "Lock connection to master after multi-statement query",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "strict_multi_stmt",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Lock connection to master after a stored procedure is executed",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "strict_sp_calls",
                    "type": "bool"
                },
                {
                    "default_value": true,
                    "description": "Prevent reconnections if temporary tables exist",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "strict_tmp_tables",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Retry failed transactions",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay",
                    "type": "bool"
                },
                {
                    "default_value": 5,
                    "description": "Maximum number of times to retry a transaction",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay_attempts",
                    "type": "count"
                },
                {
                    "default_value": "full",
                    "description": "Type of checksum to calculate for results",
                    "enum_values": [
                        "full",
                        "result_only",
                        "no_insert_id"
                    ],
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay_checksum",
                    "type": "enum"
                },
                {
                    "default_value": 1048576,
                    "description": "Maximum size of transaction to retry",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay_max_size",
                    "type": "size"
                },
                {
                    "default_value": false,
                    "description": "Retry transaction on deadlock",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay_retry_on_deadlock",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Retry transaction on checksum mismatch",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay_retry_on_mismatch",
                    "type": "bool"
                },
                {
                    "default_value": true,
                    "description": "Prevent replaying of about-to-commit transaction",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay_safe_commit",
                    "type": "bool"
                },
                {
                    "default_value": "30000ms",
                    "description": "Timeout for transaction replay",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "transaction_replay_timeout",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "default_value": "all",
                    "description": "Whether to route SQL variable modifications to all servers or only to the master",
                    "enum_values": [
                        "all",
                        "master"
                    ],
                    "mandatory": false,
                    "modifiable": true,
                    "name": "use_sql_variables_in",
                    "type": "enum"
                },
                {
                    "default_value": false,
                    "deprecated": true,
                    "description": "Retrieve users from all backend servers instead of only one",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "auth_all_servers",
                    "type": "bool"
                },
                {
                    "default_value": "300000ms",
                    "description": "How often idle connections are pinged",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "connection_keepalive",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "deprecated": true,
                    "description": "Alias for 'wait_timeout'",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "connection_timeout",
                    "type": "duration"
                },
                {
                    "default_value": false,
                    "description": "Disable session command history",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "disable_sescmd_history",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Allow the root user to connect to this service",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "enable_root_user",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Ping connections unconditionally",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "force_connection_keepalive",
                    "type": "bool"
                },
                {
                    "default_value": "-1ms",
                    "description": "Put connections into pool after session has been idle for this long",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "idle_session_pool_time",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "default_value": true,
                    "description": "Match localhost to wildcard host",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "localhost_match_wildcard_host",
                    "type": "bool"
                },
                {
                    "default_value": true,
                    "description": "Log a warning when client authentication fails",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "log_auth_warnings",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Log debug messages for this service (debug builds only)",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "log_debug",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Log info messages for this service",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "log_info",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Log notice messages for this service",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "log_notice",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "description": "Log warning messages for this service",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "log_warning",
                    "type": "bool"
                },
                {
                    "default_value": 0,
                    "description": "Maximum number of connections",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "max_connections",
                    "type": "count"
                },
                {
                    "default_value": 50,
                    "description": "Session command history size",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "max_sescmd_history",
                    "type": "count"
                },
                {
                    "default_value": "60000ms",
                    "description": "How long a session can wait for a connection to become available",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "multiplex_timeout",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "default_value": "0ms",
                    "description": "Network write timeout",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "net_write_timeout",
                    "type": "duration",
                    "unit": "ms"
                },
                {
                    "description": "Password for the user used to retrieve database users",
                    "mandatory": true,
                    "modifiable": true,
                    "name": "password",
                    "type": "password"
                },
                {
                    "default_value": true,
                    "description": "Prune old session command history if the limit is exceeded",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "prune_sescmd_history",
                    "type": "bool"
                },
                {
                    "default_value": "primary",
                    "description": "Service rank",
                    "enum_values": [
                        "primary",
                        "secondary"
                    ],
                    "mandatory": false,
                    "modifiable": true,
                    "name": "rank",
                    "type": "enum"
                },
                {
                    "default_value": -1,
                    "description": "Number of statements kept in memory",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "retain_last_statements",
                    "type": "int"
                },
                {
                    "default_value": false,
                    "description": "Enable session tracing for this service",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "session_trace",
                    "type": "bool"
                },
                {
                    "default_value": false,
                    "deprecated": true,
                    "description": "Track session state using server responses",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "session_track_trx_state",
                    "type": "bool"
                },
                {
                    "default_value": true,
                    "deprecated": true,
                    "description": "Strip escape characters from database names",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "strip_db_esc",
                    "type": "bool"
                },
                {
                    "description": "Username used to retrieve database users",
                    "mandatory": true,
                    "modifiable": true,
                    "name": "user",
                    "type": "string"
                },
                {
                    "description": "Load additional users from a file",
                    "mandatory": false,
                    "modifiable": false,
                    "name": "user_accounts_file",
                    "type": "path"
                },
                {
                    "default_value": "add_when_load_ok",
                    "description": "When and how the user accounts file is used",
                    "enum_values": [
                        "add_when_load_ok",
                        "file_only_always"
                    ],
                    "mandatory": false,
                    "modifiable": false,
                    "name": "user_accounts_file_usage",
                    "type": "enum"
                },
                {
                    "description": "Custom version string to use",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "version_string",
                    "type": "string"
                },
                {
                    "default_value": "0ms",
                    "description": "Connection idle timeout",
                    "mandatory": false,
                    "modifiable": true,
                    "name": "wait_timeout",
                    "type": "duration",
                    "unit": "ms"
                }
            ],
            "version": "V1.1.0"
        },
        "id": "readwritesplit",
        "links": {
            "self": "http://localhost:8989/v1/modules/readwritesplit/"
        },
        "type": "modules"
    },
    "links": {
        "self": "http://localhost:8989/v1/maxscale/modules/"
    }
}

Get all loaded modules

GET /v1/maxscale/modules

Retrieve information about all loaded modules.

This endpoint supports the load=all parameter. When defined, all modules located in the MaxScale module directory (libdir) will be loaded. This allows one to see the parameters of a module before the object is created.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "commands": [],
                "description": "maxscale",
                "maturity": "GA",
                "module_type": "maxscale",
                "parameters": [
                    {
                        "default_value": false,
                        "description": "Enable REST audit logging",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_audit",
                        "type": "bool"
                    },
                    {
                        "default_value": [],
                        "description": "List of HTTP methods to exclude from audit logging, e.g. \"GET\"",
                        "enum_values": [
                            "GET",
                            "PUT",
                            "POST",
                            "PATCH",
                            "DELETE",
                            "HEAD",
                            "CONNECT",
                            "OPTIONS",
                            "TRACE"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_audit_exclude_methods",
                        "type": "enum list"
                    },
                    {
                        "default_value": "/var/log/maxscale/admin_audit.csv",
                        "description": "Full path to admin audit file",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_audit_file",
                        "type": "string"
                    },
                    {
                        "default_value": true,
                        "description": "Admin interface authentication.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_auth",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Admin interface is enabled.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_enabled",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Enable admin GUI.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_gui",
                        "type": "bool"
                    },
                    {
                        "default_value": "127.0.0.1",
                        "description": "Admin interface host.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_host",
                        "type": "string"
                    },
                    {
                        "default_value": "auto",
                        "description": "JWT signature algorithm",
                        "enum_values": [
                            "auto",
                            "HS256",
                            "HS384",
                            "HS512",
                            "RS256",
                            "RS384",
                            "RS512",
                            "ES256",
                            "ES384",
                            "ES512",
                            "PS256",
                            "PS384",
                            "PS512",
                            "ED25519",
                            "ED448"
                        ],
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_jwt_algorithm",
                        "type": "enum"
                    },
                    {
                        "default_value": "maxscale",
                        "description": "The issuer claim for all JWTs generated by MaxScale.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_jwt_issuer",
                        "type": "string"
                    },
                    {
                        "description": "Encryption key ID for symmetric signature algorithms. If left empty, MaxScale will generate a random key that is used to sign the JWT.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_jwt_key",
                        "type": "string"
                    },
                    {
                        "default_value": "86400000ms",
                        "description": "Maximum age of the JWTs generated by MaxScale",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_jwt_max_age",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": true,
                        "description": "Log admin interface authentication failures.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_log_auth_failures",
                        "type": "bool"
                    },
                    {
                        "description": "Extra public certificates used to validate externally signed JWTs",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_oidc_url",
                        "type": "string"
                    },
                    {
                        "description": "PAM service for read-only users.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_pam_readonly_service",
                        "type": "string"
                    },
                    {
                        "description": "PAM service for read-write users.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_pam_readwrite_service",
                        "type": "string"
                    },
                    {
                        "default_value": 8989,
                        "description": "Admin interface port.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_port",
                        "type": "int"
                    },
                    {
                        "default_value": "*",
                        "description": "Allowed hosts for read-only rest-api users.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_readonly_hosts",
                        "type": "host pattern list"
                    },
                    {
                        "default_value": "*",
                        "description": "Allowed hosts for read-only rest-api users.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_readwrite_hosts",
                        "type": "host pattern list"
                    },
                    {
                        "default_value": true,
                        "description": "Only serve GUI over HTTPS.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_secure_gui",
                        "type": "bool"
                    },
                    {
                        "description": "Admin SSL CA cert",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_ssl_ca",
                        "type": "path"
                    },
                    {
                        "deprecated": true,
                        "description": "Alias for 'admin_ssl_ca'",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_ssl_ca_cert",
                        "type": "path"
                    },
                    {
                        "description": "Admin SSL cert",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_ssl_cert",
                        "type": "path"
                    },
                    {
                        "description": "Admin SSL key",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "admin_ssl_key",
                        "type": "path"
                    },
                    {
                        "default_value": "MAX",
                        "description": "Minimum required TLS protocol version for the REST API",
                        "enum_values": [
                            "MAX",
                            "TLSv10",
                            "TLSv11",
                            "TLSv12",
                            "TLSv13"
                        ],
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_ssl_version",
                        "type": "enum"
                    },
                    {
                        "description": "URL for third-party verification of client tokens",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "admin_verify_url",
                        "type": "string"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "Connection timeout for fetching user accounts.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "auth_connect_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "Read timeout for fetching user accounts (deprecated).",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "auth_read_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "Write timeout for fetching user accounts (deprecated).",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "auth_write_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": [],
                        "description": "Specifies whether a MaxScale parameter whose value depends on a specific global server variable, should automatically be updated to match the variable's current value.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "auto_tune",
                        "type": "stringlist"
                    },
                    {
                        "description": "Cluster used for configuration synchronization. If left empty (i.e. value is \"\"), synchronization is not done.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "config_sync_cluster",
                        "type": "string"
                    },
                    {
                        "default_value": "mysql",
                        "description": "Database where the 'maxscale_config' table is created.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "config_sync_db",
                        "type": "string"
                    },
                    {
                        "default_value": "5000ms",
                        "description": "How often to synchronize the configuration.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "config_sync_interval",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "Password for the user used for configuration synchronization.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "config_sync_password",
                        "type": "password"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "Timeout for the configuration synchronization operations.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "config_sync_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "User account used for configuration synchronization.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "config_sync_user",
                        "type": "string"
                    },
                    {
                        "description": "Debug options",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "debug",
                        "type": "string"
                    },
                    {
                        "default_value": "never",
                        "description": "In what circumstances should the last statements that a client sent be dumped.",
                        "enum_values": [
                            "on_close",
                            "on_error",
                            "never"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "dump_last_statements",
                        "type": "enum"
                    },
                    {
                        "default_value": "none",
                        "description": "Key manager type",
                        "enum_values": [
                            "none",
                            "file",
                            "kmip",
                            "vault"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "key_manager",
                        "type": "enum"
                    },
                    {
                        "default_value": true,
                        "description": "Specifies whether persisted configuration files should be loaded on startup.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "load_persisted_configs",
                        "type": "bool"
                    },
                    {
                        "description": "Local address to use when connecting.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "local_address",
                        "type": "string"
                    },
                    {
                        "default_value": false,
                        "description": "Specifies whether debug messages should be logged (meaningful only with debug builds).",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_debug",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Specifies whether info messages should be logged.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_info",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Specifies whether notice messages should be logged.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_notice",
                        "type": "bool"
                    },
                    {
                        "default_value": {
                            "count": 10,
                            "suppress": 10000,
                            "window": 1000
                        },
                        "description": "Limit the amount of identical log messages than can be logged during a certain time period.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_throttling",
                        "type": "throttling"
                    },
                    {
                        "default_value": false,
                        "description": "Log a warning when a user with super privilege logs in.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "log_warn_super_user",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Specifies whether warning messages should be logged.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_warning",
                        "type": "bool"
                    },
                    {
                        "default_value": 10,
                        "description": "The maximum number of authentication failures that are tolerated before a host is temporarily blocked.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_auth_errors_until_block",
                        "type": "int"
                    },
                    {
                        "default_value": 0,
                        "description": "Maximum amount of data read before return to epoll_wait.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "max_read_amount",
                        "type": "size"
                    },
                    {
                        "default_value": true,
                        "description": "Log to MaxScale's own log.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "maxlog",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Enable or disable high precision timestamps.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ms_timestamp",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "True if MaxScale is in passive mode.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "passive",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Persist configurations changes done at runtime.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "persist_runtime_changes",
                        "type": "bool"
                    },
                    {
                        "default_value": "qc_sqlite",
                        "deprecated": true,
                        "description": "The name of the query classifier to load.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "query_classifier",
                        "type": "string"
                    },
                    {
                        "deprecated": true,
                        "description": "Arguments for the query classifier.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "query_classifier_args",
                        "type": "string"
                    },
                    {
                        "default_value": 5003753472,
                        "description": "Maximum amount of memory used by query classifier cache.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "query_classifier_cache_size",
                        "type": "size"
                    },
                    {
                        "default_value": 1,
                        "description": "Number of times an interrupted query is retried.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "query_retries",
                        "type": "int"
                    },
                    {
                        "default_value": "5000ms",
                        "description": "The total timeout in seconds for any retried queries.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "query_retry_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "0ms",
                        "description": "How often should the load of the worker threads be checked and rebalancing be made.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "rebalance_period",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": 20,
                        "description": "If the difference in load between the thread with the maximum load and the thread with the minimum load is larger than the value of this parameter, then work will be moved from the former to the latter.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "rebalance_threshold",
                        "type": "int"
                    },
                    {
                        "default_value": 10,
                        "description": "The load of how many seconds should be taken into account when rebalancing.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "rebalance_window",
                        "type": "count"
                    },
                    {
                        "default_value": 0,
                        "description": "How many statements should be retained for each session for debugging purposes.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "retain_last_statements",
                        "type": "count"
                    },
                    {
                        "default_value": 0,
                        "description": "How many log entries are stored in the session specific trace log.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "session_trace",
                        "type": "count"
                    },
                    {
                        "description": "Regular expression that is matched against the contents of the session trace log and if it matches the contents are logged when the session stops.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "session_trace_match",
                        "type": "regex"
                    },
                    {
                        "default_value": false,
                        "description": "Do not resolve client IP addresses to hostnames during authentication",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "skip_name_resolve",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "deprecated": true,
                        "description": "Skip service and monitor permission checks.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "skip_permission_checks",
                        "type": "bool"
                    },
                    {
                        "default_value": "default",
                        "description": "The query classifier sql mode.",
                        "enum_values": [
                            "default",
                            "oracle"
                        ],
                        "mandatory": false,
                        "modifiable": false,
                        "name": "sql_mode",
                        "type": "enum"
                    },
                    {
                        "default_value": false,
                        "description": "Log to syslog.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "syslog",
                        "type": "bool"
                    },
                    {
                        "default_value": 8,
                        "description": "This parameter specifies how many threads will be used for handling the routing.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "threads",
                        "type": "count"
                    },
                    {
                        "default_value": 256,
                        "description": "This parameter specifies a hard maximum for the number of routing threads.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "threads_max",
                        "type": "count"
                    },
                    {
                        "default_value": "0ms",
                        "description": "How often the users will be refreshed.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "users_refresh_interval",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "30000ms",
                        "description": "How often the users can be refreshed.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "users_refresh_time",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": 65536,
                        "description": "High water mark of dcb write queue.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "writeq_high_water",
                        "type": "size"
                    },
                    {
                        "default_value": 1024,
                        "description": "Low water mark of dcb write queue.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "writeq_low_water",
                        "type": "size"
                    }
                ],
                "version": "24.02.0"
            },
            "id": "maxscale",
            "links": {
                "self": "http://localhost:8989/v1/modules/maxscale/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "commands": [],
                "description": "servers",
                "maturity": "GA",
                "module_type": "servers",
                "parameters": [
                    {
                        "description": "Server address",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "address",
                        "type": "string"
                    },
                    {
                        "description": "Server authenticator (deprecated)",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "authenticator",
                        "type": "string"
                    },
                    {
                        "description": "Server disk space threshold",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "disk_space_threshold",
                        "type": "disk_space_limits"
                    },
                    {
                        "default_value": 0,
                        "description": "Server extra port",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "extra_port",
                        "type": "count"
                    },
                    {
                        "default_value": 0,
                        "description": "Maximum routing connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_routing_connections",
                        "type": "count"
                    },
                    {
                        "description": "Monitor password",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "monitorpw",
                        "type": "password"
                    },
                    {
                        "description": "Monitor user",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "monitoruser",
                        "type": "string"
                    },
                    {
                        "default_value": "0ms",
                        "description": "Maximum time that a connection can be in the pool",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "persistmaxtime",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": 0,
                        "description": "Maximum size of the persistent connection pool",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "persistpoolmax",
                        "type": "count"
                    },
                    {
                        "default_value": 3306,
                        "description": "Server port",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "port",
                        "type": "count"
                    },
                    {
                        "default_value": 0,
                        "description": "Server priority",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "priority",
                        "type": "int"
                    },
                    {
                        "description": "Server private address (replication)",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "private_address",
                        "type": "string"
                    },
                    {
                        "description": "Server protocol (deprecated)",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "protocol",
                        "type": "string"
                    },
                    {
                        "default_value": false,
                        "description": "Enable proxy protocol",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "proxy_protocol",
                        "type": "bool"
                    },
                    {
                        "default_value": "primary",
                        "description": "Server rank",
                        "enum_values": [
                            "primary",
                            "secondary"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "rank",
                        "type": "enum"
                    },
                    {
                        "description": "Custom CHANGE MASTER TO options",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "replication_custom_options",
                        "type": "string"
                    },
                    {
                        "description": "Server UNIX socket",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "socket",
                        "type": "string"
                    },
                    {
                        "default_value": false,
                        "description": "Enable TLS for server",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl",
                        "type": "bool"
                    },
                    {
                        "description": "TLS certificate authority",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_ca",
                        "type": "path"
                    },
                    {
                        "deprecated": true,
                        "description": "Alias for 'ssl_ca'",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_ca_cert",
                        "type": "path"
                    },
                    {
                        "description": "TLS public certificate",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_cert",
                        "type": "path"
                    },
                    {
                        "default_value": 9,
                        "description": "TLS certificate verification depth",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_cert_verify_depth",
                        "type": "count"
                    },
                    {
                        "description": "TLS cipher list",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_cipher",
                        "type": "string"
                    },
                    {
                        "description": "TLS private key",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_key",
                        "type": "path"
                    },
                    {
                        "default_value": false,
                        "description": "Verify TLS peer certificate",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_verify_peer_certificate",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Verify TLS peer host",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_verify_peer_host",
                        "type": "bool"
                    },
                    {
                        "default_value": "MAX",
                        "description": "Minimum TLS protocol version",
                        "enum_values": [
                            "MAX",
                            "TLSv10",
                            "TLSv11",
                            "TLSv12",
                            "TLSv13"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_version",
                        "type": "enum"
                    },
                    {
                        "default_value": "server",
                        "description": "Object type",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "type",
                        "type": "string"
                    }
                ],
                "version": "24.02.0"
            },
            "id": "servers",
            "links": {
                "self": "http://localhost:8989/v1/modules/servers/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "filter",
                "commands": [],
                "description": "A hint parsing filter",
                "maturity": "Alpha",
                "module_type": "Filter",
                "parameters": [],
                "version": "V1.0.0"
            },
            "id": "hintfilter",
            "links": {
                "self": "http://localhost:8989/v1/modules/hintfilter/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "authenticator",
                "commands": [],
                "description": "Standard MySQL/MariaDB authentication (mysql_native_password)",
                "maturity": "GA",
                "module_type": "Authenticator",
                "parameters": null,
                "version": "V2.1.0"
            },
            "id": "MariaDBAuth",
            "links": {
                "self": "http://localhost:8989/v1/modules/MariaDBAuth/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "monitor",
                "commands": [
                    {
                        "attributes": {
                            "arg_max": 3,
                            "arg_min": 1,
                            "description": "Switch primary server with replica",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "New primary (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                },
                                {
                                    "description": "Current primary (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                }
                            ]
                        },
                        "id": "switchover",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/switchover/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 3,
                            "arg_min": 1,
                            "description": "Switch primary server with replica. Ignores most errors.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "New primary (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                },
                                {
                                    "description": "Current primary (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                }
                            ]
                        },
                        "id": "switchover-force",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/switchover-force/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 3,
                            "arg_min": 1,
                            "description": "Schedule primary switchover. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "New primary (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                },
                                {
                                    "description": "Current primary (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                }
                            ]
                        },
                        "id": "async-switchover",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-switchover/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Perform primary failover",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "failover",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/failover/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Schedule primary failover. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "async-failover",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-failover/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 2,
                            "description": "Rejoin server to a cluster",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Joining server",
                                    "required": true,
                                    "type": "SERVER"
                                }
                            ]
                        },
                        "id": "rejoin",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/rejoin/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 2,
                            "description": "Rejoin server to a cluster. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Joining server",
                                    "required": true,
                                    "type": "SERVER"
                                }
                            ]
                        },
                        "id": "async-rejoin",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-rejoin/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 1,
                            "description": "Delete replica connections, delete binary logs and set up replication (dangerous)",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Primary server (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                }
                            ]
                        },
                        "id": "reset-replication",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/reset-replication/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 1,
                            "description": "Delete replica connections, delete binary logs and set up replication (dangerous). Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Primary server (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                }
                            ]
                        },
                        "id": "async-reset-replication",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-reset-replication/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Release any held server locks for 1 minute.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "release-locks",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/release-locks/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Release any held server locks for 1 minute. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "async-release-locks",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-release-locks/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Fetch result of the last scheduled command.",
                            "method": "GET",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "fetch-cmd-result",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/fetch-cmd-result/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Cancel the last scheduled command.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "cancel-cmd",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/cancel-cmd/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 3,
                            "arg_min": 3,
                            "description": "Add a node to a ColumnStore cluster. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Hostname/IP of node to add to ColumnStore cluster",
                                    "required": true,
                                    "type": "STRING"
                                },
                                {
                                    "description": "Timeout",
                                    "required": true,
                                    "type": "STRING"
                                }
                            ]
                        },
                        "id": "async-cs-add-node",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-cs-add-node/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 3,
                            "arg_min": 3,
                            "description": "Remove a node from a ColumnStore cluster. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Hostname/IP of node to remove from ColumnStore cluster",
                                    "required": true,
                                    "type": "STRING"
                                },
                                {
                                    "description": "Timeout",
                                    "required": true,
                                    "type": "STRING"
                                }
                            ]
                        },
                        "id": "async-cs-remove-node",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-cs-remove-node/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Get ColumnStore cluster status.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "cs-get-status",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/cs-get-status/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Get ColumnStore cluster status. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                }
                            ]
                        },
                        "id": "async-cs-get-status",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-cs-get-status/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 2,
                            "description": "Start ColumnStore cluster. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Timeout",
                                    "required": true,
                                    "type": "STRING"
                                }
                            ]
                        },
                        "id": "async-cs-start-cluster",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-cs-start-cluster/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 2,
                            "description": "Stop ColumnStore cluster. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Timeout",
                                    "required": true,
                                    "type": "STRING"
                                }
                            ]
                        },
                        "id": "async-cs-stop-cluster",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-cs-stop-cluster/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 2,
                            "description": "Set ColumnStore cluster read-only. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Timeout",
                                    "required": true,
                                    "type": "STRING"
                                }
                            ]
                        },
                        "id": "async-cs-set-readonly",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-cs-set-readonly/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 2,
                            "arg_min": 2,
                            "description": "Set ColumnStore cluster readwrite. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Timeout",
                                    "required": true,
                                    "type": "STRING"
                                }
                            ]
                        },
                        "id": "async-cs-set-readwrite",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-cs-set-readwrite/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 4,
                            "arg_min": 2,
                            "description": "Rebuild a server with mariadb-backup. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Target server",
                                    "required": true,
                                    "type": "SERVER"
                                },
                                {
                                    "description": "Source server (optional)",
                                    "required": false,
                                    "type": "[SERVER]"
                                },
                                {
                                    "description": "Target data directory (optional)",
                                    "required": false,
                                    "type": "[STRING]"
                                }
                            ]
                        },
                        "id": "async-rebuild-server",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-rebuild-server/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 3,
                            "arg_min": 3,
                            "description": "Create a backup with mariadb-backup. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Source server",
                                    "required": true,
                                    "type": "SERVER"
                                },
                                {
                                    "description": "Backup name",
                                    "required": true,
                                    "type": "STRING"
                                }
                            ]
                        },
                        "id": "async-create-backup",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-create-backup/"
                        },
                        "type": "module_command"
                    },
                    {
                        "attributes": {
                            "arg_max": 4,
                            "arg_min": 3,
                            "description": "Restore a server from a backup. Does not wait for completion.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Monitor name",
                                    "required": true,
                                    "type": "MONITOR"
                                },
                                {
                                    "description": "Target server",
                                    "required": true,
                                    "type": "SERVER"
                                },
                                {
                                    "description": "Backup name",
                                    "required": true,
                                    "type": "STRING"
                                },
                                {
                                    "description": "Target data directory (optional)",
                                    "required": false,
                                    "type": "[STRING]"
                                }
                            ]
                        },
                        "id": "async-restore-from-backup",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/mariadbmon/async-restore-from-backup/"
                        },
                        "type": "module_command"
                    }
                ],
                "description": "A MariaDB Primary/Replica replication monitor",
                "maturity": "GA",
                "module_type": "Monitor",
                "parameters": [
                    {
                        "default_value": true,
                        "description": "Assume that hostnames are unique",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "assume_unique_hostnames",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Enable automatic server failover",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "auto_failover",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Enable automatic server rejoin",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "auto_rejoin",
                        "type": "bool"
                    },
                    {
                        "description": "Address of backup storage.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "backup_storage_address",
                        "type": "string"
                    },
                    {
                        "description": "Backup storage directory path.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "backup_storage_path",
                        "type": "string"
                    },
                    {
                        "default_value": "none",
                        "description": "Cooperative monitoring type",
                        "enum_values": [
                            "none",
                            "majority_of_running",
                            "majority_of_all"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "cooperative_monitoring_locks",
                        "type": "enum"
                    },
                    {
                        "description": "The API key used in communication with the ColumnStore admin daemon.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "cs_admin_api_key",
                        "type": "string"
                    },
                    {
                        "default_value": "/cmapi/0.4.0",
                        "description": "The base path to be used when accessing the ColumnStore administrative daemon. If, for instance, a daemon URL is https://localhost:8640/cmapi/0.4.0/node/start then the admin_base_path is \"/cmapi/0.4.0\".",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "cs_admin_base_path",
                        "type": "string"
                    },
                    {
                        "default_value": 8640,
                        "description": "Port of the ColumnStore administrative daemon.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "cs_admin_port",
                        "type": "count"
                    },
                    {
                        "description": "Path to SQL file that is executed during node demotion",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "demotion_sql_file",
                        "type": "path"
                    },
                    {
                        "default_value": false,
                        "description": "Enable read_only on all slave servers",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "enforce_read_only_slaves",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Enforce a simple topology",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "enforce_simple_topology",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Disable read_only on the current master server",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "enforce_writable_master",
                        "type": "bool"
                    },
                    {
                        "default_value": 5,
                        "description": "Number of failures to tolerate before failover occurs",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "failcount",
                        "type": "count"
                    },
                    {
                        "default_value": "90000ms",
                        "description": "Timeout for failover",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "failover_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": true,
                        "description": "Manage server-side events",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "handle_events",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Put the server into maintenance mode when it runs out of disk space",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "maintenance_on_low_disk_space",
                        "type": "bool"
                    },
                    {
                        "default_value": 1,
                        "description": "mariadb-backup thread count.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "mariadb-backup_parallel",
                        "type": "int"
                    },
                    {
                        "default_value": "1G",
                        "description": "mariadb-backup buffer pool size.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "mariadb-backup_use_memory",
                        "type": "string"
                    },
                    {
                        "default_value": "primary_monitor_master",
                        "description": "Conditions that the master servers must meet",
                        "enum_values": [
                            "none",
                            "connecting_slave",
                            "connected_slave",
                            "running_slave",
                            "primary_monitor_master"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "master_conditions",
                        "type": "enum_mask"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "Master failure timeout",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "master_failure_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "Path to SQL file that is executed during node promotion",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "promotion_sql_file",
                        "type": "path"
                    },
                    {
                        "default_value": 4444,
                        "description": "Listen port used for transferring server backup.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "rebuild_port",
                        "type": "count"
                    },
                    {
                        "description": "Custom CHANGE MASTER TO options",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "replication_custom_options",
                        "type": "string"
                    },
                    {
                        "default_value": false,
                        "description": "Enable SSL when configuring replication",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "replication_master_ssl",
                        "type": "bool"
                    },
                    {
                        "description": "Password for the user that is used for replication",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "replication_password",
                        "type": "password"
                    },
                    {
                        "description": "User used for replication",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "replication_user",
                        "type": "string"
                    },
                    {
                        "default_value": -1,
                        "description": "Replication lag limit at which the script is run",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "script_max_replication_lag",
                        "type": "int"
                    },
                    {
                        "description": "List of servers that are never promoted",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "servers_no_promotion",
                        "type": "serverlist"
                    },
                    {
                        "default_value": "",
                        "description": "Conditions that the slave servers must meet",
                        "enum_values": [
                            "linked_master",
                            "running_master",
                            "writable_master",
                            "primary_monitor_master",
                            "none"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "slave_conditions",
                        "type": "enum_mask"
                    },
                    {
                        "default_value": true,
                        "description": "Is SSH host key check enabled.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssh_check_host_key",
                        "type": "bool"
                    },
                    {
                        "description": "SSH keyfile. Used for running remote commands on servers.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "ssh_keyfile",
                        "type": "path"
                    },
                    {
                        "default_value": 22,
                        "description": "SSH port. Used for running remote commands on servers.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssh_port",
                        "type": "count"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "SSH connection and command timeout",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssh_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "SSH username. Used for running remote commands on servers.",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "ssh_user",
                        "type": "string"
                    },
                    {
                        "default_value": false,
                        "description": "Perform a switchover when a server runs out of disk space",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "switchover_on_low_disk_space",
                        "type": "bool"
                    },
                    {
                        "default_value": "90000ms",
                        "description": "Timeout for switchover",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "switchover_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": true,
                        "description": "Verify master failure",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "verify_master_failure",
                        "type": "bool"
                    },
                    {
                        "default_value": 1,
                        "description": "Number of connection attempts to make to a server",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "backend_connect_attempts",
                        "type": "count"
                    },
                    {
                        "default_value": "3000ms",
                        "description": "Connection timeout for monitor connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "backend_connect_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "3000ms",
                        "description": "Read timeout for monitor connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "backend_read_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "3000ms",
                        "description": "Write timeout for monitor connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "backend_write_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "0ms",
                        "description": "How often the disk space is checked",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "disk_space_check_interval",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "Disk space threshold",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "disk_space_threshold",
                        "type": "string"
                    },
                    {
                        "default_value": "all,master_down,master_up,slave_down,slave_up,server_down,server_up,synced_down,synced_up,donor_down,donor_up,lost_master,lost_slave,lost_synced,lost_donor,new_master,new_slave,new_synced,new_donor",
                        "description": "Events that cause the script to be called",
                        "enum_values": [
                            "all",
                            "master_down",
                            "master_up",
                            "slave_down",
                            "slave_up",
                            "server_down",
                            "server_up",
                            "synced_down",
                            "synced_up",
                            "donor_down",
                            "donor_up",
                            "lost_master",
                            "lost_slave",
                            "lost_synced",
                            "lost_donor",
                            "new_master",
                            "new_slave",
                            "new_synced",
                            "new_donor"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "events",
                        "type": "enum_mask"
                    },
                    {
                        "default_value": "28800000ms",
                        "description": "The time the on-disk cached server states are valid for",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "journal_max_age",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "2000ms",
                        "description": "How often the servers are monitored",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "monitor_interval",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "Password for the user used to monitor the servers",
                        "mandatory": true,
                        "modifiable": true,
                        "name": "password",
                        "type": "password"
                    },
                    {
                        "description": "Script to run whenever an event occurs",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "script",
                        "type": "string"
                    },
                    {
                        "default_value": "90000ms",
                        "description": "Timeout for the script",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "script_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "List of servers to use",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "servers",
                        "type": "serverlist"
                    },
                    {
                        "description": "Username used to monitor the servers",
                        "mandatory": true,
                        "modifiable": true,
                        "name": "user",
                        "type": "string"
                    }
                ],
                "version": "V1.5.0"
            },
            "id": "mariadbmon",
            "links": {
                "self": "http://localhost:8989/v1/modules/mariadbmon/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "protocol",
                "commands": [],
                "description": "The client to MaxScale MySQL protocol implementation",
                "maturity": "GA",
                "module_type": "Protocol",
                "parameters": [
                    {
                        "default_value": true,
                        "description": "Allow use of the replication protocol through this listener",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "allow_replication",
                        "type": "bool"
                    },
                    {
                        "default_value": "::",
                        "description": "Listener address",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "address",
                        "type": "string"
                    },
                    {
                        "description": "Listener authenticator",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "authenticator",
                        "type": "string"
                    },
                    {
                        "description": "Authenticator options",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "authenticator_options",
                        "type": "string"
                    },
                    {
                        "description": "Path to connection initialization SQL",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "connection_init_sql_file",
                        "type": "path"
                    },
                    {
                        "default_value": [
                            "character_set_client=auto",
                            "character_set_connection=auto",
                            "character_set_results=auto",
                            "max_allowed_packet=auto",
                            "system_time_zone=auto",
                            "time_zone=auto",
                            "tx_isolation=auto",
                            "maxscale=auto"
                        ],
                        "description": "Metadata that's sent to all connecting clients.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "connection_metadata",
                        "type": "stringlist"
                    },
                    {
                        "default_value": 0,
                        "description": "Listener port",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "port",
                        "type": "count"
                    },
                    {
                        "default_value": "MariaDBProtocol",
                        "description": "Listener protocol to use",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "protocol",
                        "type": "module"
                    },
                    {
                        "description": "Allowed (sub)networks for proxy protocol connections. Should be a comma-separated list of IPv4 or IPv6 addresses.",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "proxy_protocol_networks",
                        "type": "string"
                    },
                    {
                        "description": "Service to which the listener connects to",
                        "mandatory": true,
                        "modifiable": false,
                        "name": "service",
                        "type": "service"
                    },
                    {
                        "description": "Listener UNIX socket",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "socket",
                        "type": "string"
                    },
                    {
                        "default_value": "default",
                        "description": "SQL parsing mode",
                        "enum_values": [
                            "default",
                            "oracle"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "sql_mode",
                        "type": "enum"
                    },
                    {
                        "default_value": false,
                        "description": "Enable TLS for server",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl",
                        "type": "bool"
                    },
                    {
                        "description": "TLS certificate authority",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_ca",
                        "type": "path"
                    },
                    {
                        "deprecated": true,
                        "description": "Alias for 'ssl_ca'",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_ca_cert",
                        "type": "path"
                    },
                    {
                        "description": "TLS public certificate",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_cert",
                        "type": "path"
                    },
                    {
                        "default_value": 9,
                        "description": "TLS certificate verification depth",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_cert_verify_depth",
                        "type": "count"
                    },
                    {
                        "description": "TLS cipher list",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_cipher",
                        "type": "string"
                    },
                    {
                        "description": "TLS certificate revocation list",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_crl",
                        "type": "string"
                    },
                    {
                        "description": "TLS private key",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_key",
                        "type": "path"
                    },
                    {
                        "default_value": false,
                        "description": "Verify TLS peer certificate",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_verify_peer_certificate",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Verify TLS peer host",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_verify_peer_host",
                        "type": "bool"
                    },
                    {
                        "default_value": "MAX",
                        "description": "Minimum TLS protocol version",
                        "enum_values": [
                            "MAX",
                            "TLSv10",
                            "TLSv11",
                            "TLSv12",
                            "TLSv13"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "ssl_version",
                        "type": "enum"
                    },
                    {
                        "description": "Path to user and group mapping file",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "user_mapping_file",
                        "type": "path"
                    }
                ],
                "version": "V1.1.0"
            },
            "id": "MariaDBProtocol",
            "links": {
                "self": "http://localhost:8989/v1/modules/MariaDBProtocol/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "parser",
                "commands": [],
                "description": "MariaDB SQL parser using sqlite3.",
                "maturity": "GA",
                "module_type": "Parser",
                "parameters": null,
                "version": "V1.0.0"
            },
            "id": "pp_sqlite",
            "links": {
                "self": "http://localhost:8989/v1/modules/pp_sqlite/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "filter",
                "commands": [
                    {
                        "attributes": {
                            "arg_max": 3,
                            "arg_min": 1,
                            "description": "Show unified log file as a JSON array",
                            "method": "GET",
                            "parameters": [
                                {
                                    "description": "Filter to read logs from",
                                    "required": true,
                                    "type": "FILTER"
                                },
                                {
                                    "description": "Start reading from this line",
                                    "required": false,
                                    "type": "[STRING]"
                                },
                                {
                                    "description": "Stop reading at this line (exclusive)",
                                    "required": false,
                                    "type": "[STRING]"
                                }
                            ]
                        },
                        "id": "log",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/qlafilter/log/"
                        },
                        "type": "module_command"
                    }
                ],
                "description": "A simple query logging filter",
                "maturity": "GA",
                "module_type": "Filter",
                "parameters": [
                    {
                        "default_value": true,
                        "description": "Append new entries to log files instead of overwriting them",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "append",
                        "type": "bool"
                    },
                    {
                        "default_value": "ms",
                        "description": "Duration in milliseconds (ms) or microseconds (us)",
                        "enum_values": [
                            "ms",
                            "milliseconds",
                            "us",
                            "microseconds"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "duration_unit",
                        "type": "enum"
                    },
                    {
                        "description": "Exclude queries matching this pattern from the log",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "exclude",
                        "type": "regex"
                    },
                    {
                        "description": "The basename of the output file",
                        "mandatory": true,
                        "modifiable": true,
                        "name": "filebase",
                        "type": "string"
                    },
                    {
                        "default_value": false,
                        "description": "Flush log files after every write",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "flush",
                        "type": "bool"
                    },
                    {
                        "default_value": "date,user,query",
                        "description": "Type of data to log in the log files",
                        "enum_values": [
                            "service",
                            "session",
                            "date",
                            "user",
                            "query",
                            "reply_time",
                            "total_reply_time",
                            "default_db",
                            "num_rows",
                            "reply_size",
                            "transaction",
                            "transaction_time",
                            "num_warnings",
                            "error_msg",
                            "server",
                            "command"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_data",
                        "type": "enum_mask"
                    },
                    {
                        "default_value": "session",
                        "description": "The type of log file to use",
                        "enum_values": [
                            "session",
                            "unified",
                            "stdout"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_type",
                        "type": "enum_mask"
                    },
                    {
                        "description": "Only log queries matching this pattern",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "match",
                        "type": "regex"
                    },
                    {
                        "default_value": " ",
                        "description": "Value used to replace newlines",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "newline_replacement",
                        "type": "string"
                    },
                    {
                        "default_value": "",
                        "description": "Regular expression options",
                        "enum_values": [
                            "case",
                            "ignorecase",
                            "extended"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "options",
                        "type": "enum_mask"
                    },
                    {
                        "default_value": ",",
                        "description": "Defines the separator between elements of a log entry",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "separator",
                        "type": "string"
                    },
                    {
                        "description": "Log queries only from this network address",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "source",
                        "type": "string"
                    },
                    {
                        "description": "Exclude queries from hosts that match this pattern",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "source_exclude",
                        "type": "regex"
                    },
                    {
                        "description": "Log queries only from hosts that match this pattern",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "source_match",
                        "type": "regex"
                    },
                    {
                        "default_value": false,
                        "description": "Write queries in canonical form",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "use_canonical_form",
                        "type": "bool"
                    },
                    {
                        "description": "Log queries only from this user",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "user",
                        "type": "string"
                    },
                    {
                        "description": "Exclude queries from users that match this pattern",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "user_exclude",
                        "type": "regex"
                    },
                    {
                        "description": "Log queries only from users that match this pattern",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "user_match",
                        "type": "regex"
                    }
                ],
                "version": "V1.1.1"
            },
            "id": "qlafilter",
            "links": {
                "self": "http://localhost:8989/v1/modules/qlafilter/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "router",
                "commands": [],
                "description": "A connection based router to load balance based on connections",
                "maturity": "GA",
                "module_type": "Router",
                "parameters": [
                    {
                        "default_value": true,
                        "description": "Use master for reads",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "master_accept_reads",
                        "type": "bool"
                    },
                    {
                        "default_value": "0ms",
                        "description": "Maximum acceptable replication lag",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_replication_lag",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "running",
                        "description": "A comma separated list of server roles",
                        "enum_values": [
                            "master",
                            "slave",
                            "running",
                            "synced"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "router_options",
                        "type": "enum_mask"
                    },
                    {
                        "default_value": false,
                        "deprecated": true,
                        "description": "Retrieve users from all backend servers instead of only one",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "auth_all_servers",
                        "type": "bool"
                    },
                    {
                        "default_value": "300000ms",
                        "description": "How often idle connections are pinged",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "connection_keepalive",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "deprecated": true,
                        "description": "Alias for 'wait_timeout'",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "connection_timeout",
                        "type": "duration"
                    },
                    {
                        "default_value": false,
                        "description": "Disable session command history",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "disable_sescmd_history",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Allow the root user to connect to this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "enable_root_user",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Ping connections unconditionally",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "force_connection_keepalive",
                        "type": "bool"
                    },
                    {
                        "default_value": "-1ms",
                        "description": "Put connections into pool after session has been idle for this long",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "idle_session_pool_time",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": true,
                        "description": "Match localhost to wildcard host",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "localhost_match_wildcard_host",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Log a warning when client authentication fails",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_auth_warnings",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log debug messages for this service (debug builds only)",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_debug",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log info messages for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_info",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log notice messages for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_notice",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log warning messages for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_warning",
                        "type": "bool"
                    },
                    {
                        "default_value": 0,
                        "description": "Maximum number of connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_connections",
                        "type": "count"
                    },
                    {
                        "default_value": 50,
                        "description": "Session command history size",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_sescmd_history",
                        "type": "count"
                    },
                    {
                        "default_value": "60000ms",
                        "description": "How long a session can wait for a connection to become available",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "multiplex_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "0ms",
                        "description": "Network write timeout",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "net_write_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "Password for the user used to retrieve database users",
                        "mandatory": true,
                        "modifiable": true,
                        "name": "password",
                        "type": "password"
                    },
                    {
                        "default_value": true,
                        "description": "Prune old session command history if the limit is exceeded",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "prune_sescmd_history",
                        "type": "bool"
                    },
                    {
                        "default_value": "primary",
                        "description": "Service rank",
                        "enum_values": [
                            "primary",
                            "secondary"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "rank",
                        "type": "enum"
                    },
                    {
                        "default_value": -1,
                        "description": "Number of statements kept in memory",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "retain_last_statements",
                        "type": "int"
                    },
                    {
                        "default_value": false,
                        "description": "Enable session tracing for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "session_trace",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "deprecated": true,
                        "description": "Track session state using server responses",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "session_track_trx_state",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "deprecated": true,
                        "description": "Strip escape characters from database names",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "strip_db_esc",
                        "type": "bool"
                    },
                    {
                        "description": "Username used to retrieve database users",
                        "mandatory": true,
                        "modifiable": true,
                        "name": "user",
                        "type": "string"
                    },
                    {
                        "description": "Load additional users from a file",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "user_accounts_file",
                        "type": "path"
                    },
                    {
                        "default_value": "add_when_load_ok",
                        "description": "When and how the user accounts file is used",
                        "enum_values": [
                            "add_when_load_ok",
                            "file_only_always"
                        ],
                        "mandatory": false,
                        "modifiable": false,
                        "name": "user_accounts_file_usage",
                        "type": "enum"
                    },
                    {
                        "description": "Custom version string to use",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "version_string",
                        "type": "string"
                    },
                    {
                        "default_value": "0ms",
                        "description": "Connection idle timeout",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "wait_timeout",
                        "type": "duration",
                        "unit": "ms"
                    }
                ],
                "version": "V2.0.0"
            },
            "id": "readconnroute",
            "links": {
                "self": "http://localhost:8989/v1/modules/readconnroute/"
            },
            "type": "modules"
        },
        {
            "attributes": {
                "api": "router",
                "commands": [
                    {
                        "attributes": {
                            "arg_max": 1,
                            "arg_min": 1,
                            "description": "Reset global GTID state in readwritesplit.",
                            "method": "POST",
                            "parameters": [
                                {
                                    "description": "Readwritesplit service",
                                    "required": true,
                                    "type": "SERVICE"
                                }
                            ]
                        },
                        "id": "reset-gtid",
                        "links": {
                            "self": "http://localhost:8989/v1/modules/readwritesplit/reset-gtid/"
                        },
                        "type": "module_command"
                    }
                ],
                "description": "A Read/Write splitting router for enhancement read scalability",
                "maturity": "GA",
                "module_type": "Router",
                "parameters": [
                    {
                        "default_value": "none",
                        "description": "Causal reads mode",
                        "enum_values": [
                            "none",
                            "local",
                            "global",
                            "fast_global",
                            "fast",
                            "universal",
                            "fast_universal",
                            "false",
                            "off",
                            "0",
                            "true",
                            "on",
                            "1"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "causal_reads",
                        "type": "enum"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "Timeout for the slave synchronization",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "causal_reads_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": false,
                        "description": "Retry failed writes outside of transactions",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "delayed_retry",
                        "type": "bool"
                    },
                    {
                        "default_value": "10000ms",
                        "description": "Timeout for delayed_retry",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "delayed_retry_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": false,
                        "description": "Create connections only when needed",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "lazy_connect",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Use master for reads",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "master_accept_reads",
                        "type": "bool"
                    },
                    {
                        "default_value": "fail_on_write",
                        "description": "Master failure mode behavior",
                        "enum_values": [
                            "fail_instantly",
                            "fail_on_write",
                            "error_on_write"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "master_failure_mode",
                        "type": "enum"
                    },
                    {
                        "default_value": true,
                        "description": "Reconnect to master",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "master_reconnection",
                        "type": "bool"
                    },
                    {
                        "default_value": "0ms",
                        "description": "Maximum replication lag",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_replication_lag",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": 255,
                        "description": "Maximum number of slave connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_slave_connections",
                        "type": "count"
                    },
                    {
                        "deprecated": true,
                        "description": "Alias for 'max_replication_lag'",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_slave_replication_lag",
                        "type": "duration"
                    },
                    {
                        "default_value": false,
                        "description": "Optimistically offload transactions to slaves",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "optimistic_trx",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Automatically retry failed reads outside of transactions",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "retry_failed_reads",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Reuse identical prepared statements inside the same connection",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "reuse_prepared_statements",
                        "type": "bool"
                    },
                    {
                        "default_value": 255,
                        "description": "Starting number of slave connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "slave_connections",
                        "type": "count"
                    },
                    {
                        "default_value": "least_current_operations",
                        "description": "Slave selection criteria",
                        "enum_values": [
                            "least_global_connections",
                            "least_router_connections",
                            "least_behind_master",
                            "least_current_operations",
                            "adaptive_routing",
                            "LEAST_GLOBAL_CONNECTIONS",
                            "LEAST_ROUTER_CONNECTIONS",
                            "LEAST_BEHIND_MASTER",
                            "LEAST_CURRENT_OPERATIONS",
                            "ADAPTIVE_ROUTING"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "slave_selection_criteria",
                        "type": "enum"
                    },
                    {
                        "default_value": false,
                        "description": "Lock connection to master after multi-statement query",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "strict_multi_stmt",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Lock connection to master after a stored procedure is executed",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "strict_sp_calls",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Prevent reconnections if temporary tables exist",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "strict_tmp_tables",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Retry failed transactions",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay",
                        "type": "bool"
                    },
                    {
                        "default_value": 5,
                        "description": "Maximum number of times to retry a transaction",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay_attempts",
                        "type": "count"
                    },
                    {
                        "default_value": "full",
                        "description": "Type of checksum to calculate for results",
                        "enum_values": [
                            "full",
                            "result_only",
                            "no_insert_id"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay_checksum",
                        "type": "enum"
                    },
                    {
                        "default_value": 1048576,
                        "description": "Maximum size of transaction to retry",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay_max_size",
                        "type": "size"
                    },
                    {
                        "default_value": false,
                        "description": "Retry transaction on deadlock",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay_retry_on_deadlock",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Retry transaction on checksum mismatch",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay_retry_on_mismatch",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Prevent replaying of about-to-commit transaction",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay_safe_commit",
                        "type": "bool"
                    },
                    {
                        "default_value": "30000ms",
                        "description": "Timeout for transaction replay",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "transaction_replay_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "all",
                        "description": "Whether to route SQL variable modifications to all servers or only to the master",
                        "enum_values": [
                            "all",
                            "master"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "use_sql_variables_in",
                        "type": "enum"
                    },
                    {
                        "default_value": false,
                        "deprecated": true,
                        "description": "Retrieve users from all backend servers instead of only one",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "auth_all_servers",
                        "type": "bool"
                    },
                    {
                        "default_value": "300000ms",
                        "description": "How often idle connections are pinged",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "connection_keepalive",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "deprecated": true,
                        "description": "Alias for 'wait_timeout'",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "connection_timeout",
                        "type": "duration"
                    },
                    {
                        "default_value": false,
                        "description": "Disable session command history",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "disable_sescmd_history",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Allow the root user to connect to this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "enable_root_user",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Ping connections unconditionally",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "force_connection_keepalive",
                        "type": "bool"
                    },
                    {
                        "default_value": "-1ms",
                        "description": "Put connections into pool after session has been idle for this long",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "idle_session_pool_time",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": true,
                        "description": "Match localhost to wildcard host",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "localhost_match_wildcard_host",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "description": "Log a warning when client authentication fails",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_auth_warnings",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log debug messages for this service (debug builds only)",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_debug",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log info messages for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_info",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log notice messages for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_notice",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "description": "Log warning messages for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "log_warning",
                        "type": "bool"
                    },
                    {
                        "default_value": 0,
                        "description": "Maximum number of connections",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_connections",
                        "type": "count"
                    },
                    {
                        "default_value": 50,
                        "description": "Session command history size",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "max_sescmd_history",
                        "type": "count"
                    },
                    {
                        "default_value": "60000ms",
                        "description": "How long a session can wait for a connection to become available",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "multiplex_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "default_value": "0ms",
                        "description": "Network write timeout",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "net_write_timeout",
                        "type": "duration",
                        "unit": "ms"
                    },
                    {
                        "description": "Password for the user used to retrieve database users",
                        "mandatory": true,
                        "modifiable": true,
                        "name": "password",
                        "type": "password"
                    },
                    {
                        "default_value": true,
                        "description": "Prune old session command history if the limit is exceeded",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "prune_sescmd_history",
                        "type": "bool"
                    },
                    {
                        "default_value": "primary",
                        "description": "Service rank",
                        "enum_values": [
                            "primary",
                            "secondary"
                        ],
                        "mandatory": false,
                        "modifiable": true,
                        "name": "rank",
                        "type": "enum"
                    },
                    {
                        "default_value": -1,
                        "description": "Number of statements kept in memory",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "retain_last_statements",
                        "type": "int"
                    },
                    {
                        "default_value": false,
                        "description": "Enable session tracing for this service",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "session_trace",
                        "type": "bool"
                    },
                    {
                        "default_value": false,
                        "deprecated": true,
                        "description": "Track session state using server responses",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "session_track_trx_state",
                        "type": "bool"
                    },
                    {
                        "default_value": true,
                        "deprecated": true,
                        "description": "Strip escape characters from database names",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "strip_db_esc",
                        "type": "bool"
                    },
                    {
                        "description": "Username used to retrieve database users",
                        "mandatory": true,
                        "modifiable": true,
                        "name": "user",
                        "type": "string"
                    },
                    {
                        "description": "Load additional users from a file",
                        "mandatory": false,
                        "modifiable": false,
                        "name": "user_accounts_file",
                        "type": "path"
                    },
                    {
                        "default_value": "add_when_load_ok",
                        "description": "When and how the user accounts file is used",
                        "enum_values": [
                            "add_when_load_ok",
                            "file_only_always"
                        ],
                        "mandatory": false,
                        "modifiable": false,
                        "name": "user_accounts_file_usage",
                        "type": "enum"
                    },
                    {
                        "description": "Custom version string to use",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "version_string",
                        "type": "string"
                    },
                    {
                        "default_value": "0ms",
                        "description": "Connection idle timeout",
                        "mandatory": false,
                        "modifiable": true,
                        "name": "wait_timeout",
                        "type": "duration",
                        "unit": "ms"
                    }
                ],
                "version": "V1.1.0"
            },
            "id": "readwritesplit",
            "links": {
                "self": "http://localhost:8989/v1/modules/readwritesplit/"
            },
            "type": "modules"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/maxscale/modules/"
    }
}

Call a module command

For read-only commands:

GET /v1/maxscale/modules/:module/:command

For commands that can modify data:

POST /v1/maxscale/modules/:module/:command

Modules can expose commands that can be called via the REST API. The module resource lists all commands in the data.attributes.commands list. Each value is a command sub-resource identified by its id field and the HTTP method the command uses is defined by the attributes.method field.

The :module in the URI must be a valid name of a loaded module and :command must be a valid command identifier that is exposed by that module. All parameters to the module commands are passed as HTTP request parameters.

Here is an example POST requests to the mariadbmon module command reset-replication with two parameters, the name of the monitor instance and the server name:

POST /v1/maxscale/modules/mariadbmon/reset-replication?MariaDB-Monitor&server1

Response

Command with output:

Status: 200 OK

{
    "links": {
        "self": "http://localhost:8989/v1/maxscale/modules/mariadbmon/reset-replication"
    },
    "meta": [ // Output of module command (module dependent)
        {
            "name": "value"
        }
    ]
}

The contents of the meta field will contain the output of the module command. This output depends on the command that is being executed. It can contain any valid JSON value.

Command with no output:

Status: 204 No Content

Classify a statement

GET /v1/maxscale/query_classifier/classify?sql=<statement>

Classify provided statement and return the result.

Response

Status: 200 OK

GET /v1/maxscale/query_classifier/classify?sql=SELECT+1
{
    "data": {
        "attributes": {
            "canonical": "SELECT ?",
            "fields": [],
            "functions": [],
            "operation": "sql::OP_SELECT",
            "parse_result": "Parser::Result::PARSED",
            "type_mask": "sql::TYPE_READ"
        },
        "id": "classify",
        "type": "classify"
    },
    "links": {
        "self": "http://localhost:8989/v1/maxscale/query_classifier/classify/"
    }
}

This page is licensed: CC BY-SA / Gnu FDL

MaxScale Monitor Resource

Monitor Resource

A monitor resource represents a monitor inside MaxScale that monitors one or more servers.

Resource Operations

The :name in all of the URIs must be the name of a monitor in MaxScale.

Get a monitor

GET /v1/monitors/:name

Get a single monitor.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "module": "mariadbmon",
            "monitor_diagnostics": {
                "master": "server1",
                "master_gtid_domain_id": 0,
                "primary": null,
                "server_info": [
                    {
                        "gtid_binlog_pos": "0-3000-5",
                        "gtid_current_pos": "0-3000-5",
                        "lock_held": null,
                        "master_group": null,
                        "name": "server1",
                        "read_only": false,
                        "server_id": 3000,
                        "slave_connections": [],
                        "state_details": null
                    },
                    {
                        "gtid_binlog_pos": "0-3000-5",
                        "gtid_current_pos": "0-3000-5",
                        "lock_held": null,
                        "master_group": null,
                        "name": "server2",
                        "read_only": false,
                        "server_id": 3001,
                        "slave_connections": [
                            {
                                "connection_name": "",
                                "gtid_io_pos": "",
                                "last_io_error": "",
                                "last_sql_error": "",
                                "master_host": "127.0.0.1",
                                "master_port": 3000,
                                "master_server_id": 3000,
                                "master_server_name": "server1",
                                "seconds_behind_master": 0,
                                "slave_io_running": "Yes",
                                "slave_sql_running": "Yes",
                                "using_gtid": "No"
                            }
                        ],
                        "state_details": null
                    }
                ],
                "state": "Idle"
            },
            "parameters": {
                "assume_unique_hostnames": true,
                "auto_failover": false,
                "auto_rejoin": false,
                "backend_connect_attempts": 1,
                "backend_connect_timeout": "3000ms",
                "backend_read_timeout": "3000ms",
                "backend_write_timeout": "3000ms",
                "backup_storage_address": null,
                "backup_storage_path": null,
                "cooperative_monitoring_locks": "none",
                "cs_admin_api_key": null,
                "cs_admin_base_path": "/cmapi/0.4.0",
                "cs_admin_port": 8640,
                "demotion_sql_file": null,
                "disk_space_check_interval": "0ms",
                "disk_space_threshold": null,
                "enforce_read_only_slaves": false,
                "enforce_simple_topology": false,
                "enforce_writable_master": false,
                "events": "all,master_down,master_up,slave_down,slave_up,server_down,server_up,synced_down,synced_up,donor_down,donor_up,lost_master,lost_slave,lost_synced,lost_donor,new_master,new_slave,new_synced,new_donor",
                "failcount": 5,
                "failover_timeout": "90000ms",
                "handle_events": true,
                "journal_max_age": "28800000ms",
                "maintenance_on_low_disk_space": true,
                "mariadb-backup_parallel": 1,
                "mariadb-backup_use_memory": "1G",
                "master_conditions": "primary_monitor_master",
                "master_failure_timeout": "10000ms",
                "module": "mariadbmon",
                "monitor_interval": "1000ms",
                "password": "*****",
                "promotion_sql_file": null,
                "rebuild_port": 4444,
                "replication_custom_options": null,
                "replication_master_ssl": false,
                "replication_password": "*****",
                "replication_user": "maxuser",
                "script": null,
                "script_max_replication_lag": -1,
                "script_timeout": "90000ms",
                "servers_no_promotion": null,
                "slave_conditions": "",
                "ssh_check_host_key": true,
                "ssh_keyfile": null,
                "ssh_port": 22,
                "ssh_timeout": "10000ms",
                "ssh_user": null,
                "switchover_on_low_disk_space": false,
                "switchover_timeout": "90000ms",
                "type": "monitor",
                "user": "maxuser",
                "verify_master_failure": true
            },
            "source": {
                "file": "/etc/maxscale.cnf",
                "type": "static"
            },
            "state": "Running",
            "ticks": 12
        },
        "id": "MariaDB-Monitor",
        "links": {
            "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor/"
        },
        "relationships": {
            "servers": {
                "data": [
                    {
                        "id": "server1",
                        "type": "servers"
                    },
                    {
                        "id": "server2",
                        "type": "servers"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/servers/",
                    "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor/relationships/servers/"
                }
            },
            "services": {
                "data": [
                    {
                        "id": "RW-Split-Router",
                        "type": "services"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/services/",
                    "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor/relationships/services/"
                }
            }
        },
        "type": "monitors"
    },
    "links": {
        "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor/"
    }
}

Get all monitors

GET /v1/monitors

Get all monitors.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "module": "mariadbmon",
                "monitor_diagnostics": {
                    "master": "server1",
                    "master_gtid_domain_id": 0,
                    "primary": null,
                    "server_info": [
                        {
                            "gtid_binlog_pos": "0-3000-5",
                            "gtid_current_pos": "0-3000-5",
                            "lock_held": null,
                            "master_group": null,
                            "name": "server1",
                            "read_only": false,
                            "server_id": 3000,
                            "slave_connections": [],
                            "state_details": null
                        },
                        {
                            "gtid_binlog_pos": "0-3000-5",
                            "gtid_current_pos": "0-3000-5",
                            "lock_held": null,
                            "master_group": null,
                            "name": "server2",
                            "read_only": false,
                            "server_id": 3001,
                            "slave_connections": [
                                {
                                    "connection_name": "",
                                    "gtid_io_pos": "",
                                    "last_io_error": "",
                                    "last_sql_error": "",
                                    "master_host": "127.0.0.1",
                                    "master_port": 3000,
                                    "master_server_id": 3000,
                                    "master_server_name": "server1",
                                    "seconds_behind_master": 0,
                                    "slave_io_running": "Yes",
                                    "slave_sql_running": "Yes",
                                    "using_gtid": "No"
                                }
                            ],
                            "state_details": null
                        }
                    ],
                    "state": "Idle"
                },
                "parameters": {
                    "assume_unique_hostnames": true,
                    "auto_failover": false,
                    "auto_rejoin": false,
                    "backend_connect_attempts": 1,
                    "backend_connect_timeout": "3000ms",
                    "backend_read_timeout": "3000ms",
                    "backend_write_timeout": "3000ms",
                    "backup_storage_address": null,
                    "backup_storage_path": null,
                    "cooperative_monitoring_locks": "none",
                    "cs_admin_api_key": null,
                    "cs_admin_base_path": "/cmapi/0.4.0",
                    "cs_admin_port": 8640,
                    "demotion_sql_file": null,
                    "disk_space_check_interval": "0ms",
                    "disk_space_threshold": null,
                    "enforce_read_only_slaves": false,
                    "enforce_simple_topology": false,
                    "enforce_writable_master": false,
                    "events": "all,master_down,master_up,slave_down,slave_up,server_down,server_up,synced_down,synced_up,donor_down,donor_up,lost_master,lost_slave,lost_synced,lost_donor,new_master,new_slave,new_synced,new_donor",
                    "failcount": 5,
                    "failover_timeout": "90000ms",
                    "handle_events": true,
                    "journal_max_age": "28800000ms",
                    "maintenance_on_low_disk_space": true,
                    "mariadb-backup_parallel": 1,
                    "mariadb-backup_use_memory": "1G",
                    "master_conditions": "primary_monitor_master",
                    "master_failure_timeout": "10000ms",
                    "module": "mariadbmon",
                    "monitor_interval": "1000ms",
                    "password": "*****",
                    "promotion_sql_file": null,
                    "rebuild_port": 4444,
                    "replication_custom_options": null,
                    "replication_master_ssl": false,
                    "replication_password": "*****",
                    "replication_user": "maxuser",
                    "script": null,
                    "script_max_replication_lag": -1,
                    "script_timeout": "90000ms",
                    "servers_no_promotion": null,
                    "slave_conditions": "",
                    "ssh_check_host_key": true,
                    "ssh_keyfile": null,
                    "ssh_port": 22,
                    "ssh_timeout": "10000ms",
                    "ssh_user": null,
                    "switchover_on_low_disk_space": false,
                    "switchover_timeout": "90000ms",
                    "type": "monitor",
                    "user": "maxuser",
                    "verify_master_failure": true
                },
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                },
                "state": "Running",
                "ticks": 12
            },
            "id": "MariaDB-Monitor",
            "links": {
                "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor/"
            },
            "relationships": {
                "servers": {
                    "data": [
                        {
                            "id": "server1",
                            "type": "servers"
                        },
                        {
                            "id": "server2",
                            "type": "servers"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/servers/",
                        "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor/relationships/servers/"
                    }
                },
                "services": {
                    "data": [
                        {
                            "id": "RW-Split-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor/relationships/services/"
                    }
                }
            },
            "type": "monitors"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/monitors/"
    }
}

Create a monitor

POST /v1/monitors

Create a new monitor. The request body must define at least the following fields.

  • data.id

  • Name of the monitor

  • data.type

  • Type of the object, must be monitors

  • data.attributes.module

  • The monitor module to use

  • data.attributes.parameters.user

  • The user to use

  • data.attributes.parameters.password

  • The password to use

All monitor parameters can be defined at creation time.

The following example defines a request body which creates a new monitor and assigns two servers to be monitored by it. It also defines a custom value for the monitor_interval parameter.

{
    data: {
        "id": "test-monitor", // Name of the monitor
        "type": "monitors",
        "attributes": {
            "module": "mariadbmon", // The monitor uses the mariadbmon module
            "parameters": { // Monitor parameters
                "monitor_interval": 1000,
                "user": "maxuser,
                "password": "maxpwd"
            }
        },
        "relationships": { // List of server relationships that this monitor uses
            "servers": {
                "data": [ // This monitor uses two servers
                    {
                        "id": "server1",
                        "type": "servers"
                    },
                    {
                        "id": "server2",
                        "type": "servers"
                    }
                ]
            }
        }
    }
}

Response

Monitor is created:

Status: 204 No Content

Update a monitor

PATCH /v1/monitors/:name

The request body must be a valid JSON document representing the modified monitor.

Modifiable Fields

The following standard server parameter can be modified.

  • user

  • password

  • monitor_interval

  • backend_connect_timeout

  • backend_write_timeout

  • backend_read_timeout

  • backend_connect_attempts

In addition to these standard parameters, the monitor specific parameters can also be modified. Refer to the monitor module documentation for details on these parameters.

Response

Monitor is modified:

Status: 204 No Content

Invalid request body:

Status: 400 Bad Request

Update monitor relationships

PATCH /v1/monitors/:name/relationships/servers

The request body must be a JSON object that defines only the data field. The value of the data field must be an array of relationship objects that define the id and type fields of the relationship. This object will replace the existing relationships of the monitor.

The following is an example request and request body that defines a single server relationship for a monitor.

PATCH /v1/monitors/my-monitor/relationships/servers

{
    data: [
          { "id": "my-server", "type": "servers" }
    ]
}

All relationships for a monitor can be deleted by sending an empty array as thedata field value. The following example removes all servers from a monitor.

PATCH /v1/monitors/my-monitor/relationships/servers

{
    data: []
}

Response

Monitor relationships modified:

Status: 204 No Content

Invalid JSON body:

Status: 400 Bad Request

Destroy a monitor

DELETE /v1/monitors/:name

Destroy a created monitor. The monitor must not have relationships to any servers in order to be destroyed.

This endpoint also supports the force=yes parameter that will unconditionally delete the monitor by first unlinking it from all servers that it uses.

Response

Monitor is deleted:

Status: 204 No Content

Monitor could not be deleted:

Status: 400 Bad Request

Stop a monitor

PUT /v1/monitors/:name/stop

Stops a started monitor.

Response

Monitor is stopped:

Status: 204 No Content

Start a monitor

PUT /v1/monitors/:name/start

Starts a stopped monitor.

Response

Monitor is started:

Status: 204 No Content

This page is licensed: CC BY-SA / Gnu FDL

MaxScale REST API

REST API

This document describes the version 1 of the MaxScale REST API.

Note About Syntax

Although JSON does not define a syntax for comments, some of the JSON examples have C-style inline comments in them. These comments use // to mark the start of the comment and extend to the end of the current line.

Configuration

Read the REST API section of the configuration guide for more details on how to configure the REST API.

Authentication

The MaxScale REST API uses HTTP Basic Access authentication with the MaxScale administrative interface users. The default user is admin:mariadb.

It is highly recommended to enable HTTPS on the MaxScale REST API to make the communication between the client and MaxScale secure. Without it, the passwords can be intercepted from the network traffic. Refer to theConfiguration Guide for more details on how to enable HTTPS for the MaxScale REST API.

For more details on how administrative interface users are created and managed, refer to the MaxCtrl documentation as well as the documentation of the users resource.

JSON Web Tokens

MaxScale supports authentication viaJSON Web Tokens.

GET /v1/auth

The /v1/auth endpoint can be used to generate new tokens which are returned in the following form.

{
    "meta": {
        "token": "eyJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50IjoiYWRtaW4iLCJhdWQiOiJhZG1pbiIsImV4cCI6MTY4OTk1MDgwNCwiaWF0IjoxNjg5OTIyMDA0LCJpc3MiOiJtYXhzY2FsZSIsInN1YiI6ImFkbWluIn0.LRFeXaFAhYNBm7kLIosUpR2nOgd5H-gv3MpuLaCpPvk"
    }
}

Note that by default the /auth endpoint requires the connection to be encrypted (HTTPS) and attempts to use it without encryption will be treated as an error. To allow use of the /auth endpoint without encryption, useadmin_secure_gui=false.

If the token is used to authenticate users in a web browser, the token can be optionally stored in cookies. This can be enabled with the persist=yes parameter in the request:

GET /v1/auth?persist=yes

When the token is stored in the cookies, it will be stored in the token_sig cookie using the SameSite=Strict and HttpOnly cookie options. This means the JavaScript context of the browser will not have access to it. This is done to prevent CSRF attacks.

By default, the generated tokens are valid for 8 hours. The token validity period can be set with the max-age request parameter:

GET /v1/auth?max-age=28800

When max-age is combined with persist, the Max-Age cookie option is also set to the same value.

The maximum lifetime of the tokens is controlled by the admin_jwt_max_age parameter. If the configured value is less than 8 hours, the default token lifetime is also lowered to it. A request for a token with a lifetime longer than admin_jwt_max_age will be accepted but the token will have its lifetime set to admin_jwt_max_age.

To use the token for authentication, the generated token must be presented in the Authorization header with the Bearer authentication scheme. For example, the token above would be used in the following manner:

Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZG1pbiIsImV4cCI6MTU4MzI1NDE1MSwiaWF0IjoxNTgzMjI1MzUxLCJpc3MiOiJtYXhzY2FsZSJ9.B1BqhjjKaCWKe3gVXLszpOPfeu8cLiwSb4CMIJAoyqw

If MaxScale is restarted, all generated tokens are invalidated.

/auth Request Parameters

The /auth endpoint supports the following request parameters that must be given in the HTTP query string.

  • max-age

  • Sets the token maximum age in seconds. The default is max-age=28800. Only positive values between 1 and 2147483646 are accepted and if a non-positive or a non-integer value is found, the parameter is ignored.

  • persist

  • Store the generated token in cookies instead of returning it as the response body. This parameter expects only one value, yes, as its argument. Whenpersist=yes is set, the token is stored in the token_sig cookie and the response is 204 No Content instead of 200 OK. The token_sig cookie contains the JWT and is stored as a HttpOnly cookie which prevents access to from JavaScript. This is done to mitigate any attacks that might leak the token.

Resources

The MaxScale REST API provides the following resources. All resources conform to the JSON API specification.

  • maxscale

  • services

  • servers

  • listeners

  • filters

  • monitors

  • sessions

  • users

  • sql

In addition to the named resources, the REST API will respond with a HTTP 200 OK response to GET requests on the root resource (/) as well as the namespace root resource (/v1/). These can be used for HTTP health checks to determine whether MaxScale is running.

API Versioning

All of the current resources are in the /v1/ namespace of the MaxScale REST API. Further additions to the namespace can be added that do not break backwards compatibility of any existing resources. What this means in practice is that:

  • No resources or URLs will be removed

  • The API will be JSON API compliant

Note that this means that the contents of individual resources can change. New fields can be added, old ones can be removed and the meaning of existing fields can change. The aim is to be as backwards compatible as reasonably possible without sacrificing the clarity and functionality of the API.

Since MaxScale 2.4.0, the use of the version prefix /v1/ is optional: if the prefix is not used, the latest API version is used.

Resource Relationships

All resources return complete JSON objects. The returned objects can have arelationships field that represents any relations the object has to other objects. This closely resembles the JSON API definition of links.

In the relationships objects, all resources have a self link that points to the resource itself. This allows easy access to the objects pointed by the relationships as the reply URL is included in the response itself.

To create a relationship between two objects, define it in the initial POST request. To modify the relationships of existing objects, perform a PATCH request with the new definition of the relevant relationship. To completely remove all relationships from an object, the data field of the corresponding relationship object must be set to an empty array.

The following lists the resources and the types of links each resource can have in addition to the self link. Examples of these relationships can be seen in the resource documentation.

  • services - Service resource

  • servers List of servers used by the service

  • services List of services used by the service

  • filters List of filters used by the service NOTE: This is an ordered relationship where the order of the filters defines the order in which they process queries.

  • listeners List of listeners used by the service

  • monitors - Monitor resource

  • servers List of servers used by the monitor

  • filters - Filter resource

  • services List of services that use this filter NOTE: This is a one-way relationship that can only be modified from theservices resource.

  • servers - Server resource

  • services List of services that use this server

  • monitors List of monitors that use this server

  • listeners - Listener resource

  • services The service that the listener points to

Common Request Parameters

All parameters that use boolean values use the same rules that are used for theboolean values in the MaxScale configuration. For example, both pretty=off and pretty=false disable the pretty option.

All the resources that return JSON content also support the following parameters. Parameters are given in the HTTP query string:https://localhost:8989/v1/servers?pretty=true&fields[servers]=state.

  • pretty

  • Pretty-print output. If this parameter is set to true then the returned objects are formatted in a more human readable format. If the parameter is set to false then the returned objects are formatted in a compact format. All resources support this parameter. The default value for this parameter is true.

  • fields[TYPE]=field1,field2...

  • Return a Sparse Fieldset This parameter controls which fields are returned in the REST API response. The TYPE value in the fields parameter must be the resource type that is being retrieved (i.e. the servers in /v1/servers and/v1/server/server1). The value of the parameter must be a comma-separated list of JSON Pointers that mark which fields of the object to return. Only fields in objects in the attributes and relationships objects are inspected. This means that if the path marked by the JSON Pointer contains an array in it, it will not advance past this array. For example, to return only the server state output from the /servers endpoint, the fields[servers]=state parameter can be used. This would return only the data.attributes.state part of the resource. To return the nested value data.attributes.statistics.connections, the corresponding parameter would be fields[servers]=statistics/connections.

  • filter=json_ptr=expr

  • Filter the output of the result This parameter controls which rows are returned in a REST API response that returns an array in the data member (i.e. a request to a resource collection). Requests to individual resources are not filtered. The argument to the filter parameter must be a key-value pair with a validJSON Pointer as the key and either a valid JSON type as the value or afilter-expression. The comparison is done for each individual object in the data array of the result. If given only a JSON value, the stored value is compared for equality. If an expression is used, the expression is evaluated and only rows that match are returned. For example, if the object stored in data[0] has a value pointed by the given JSON pointer and that value compares equal to the given JSON value, the array row is kept in the result. Examples for filtering expression can be found here. A practical use for this parameter is to return only sessions for a particular service. For example, to return sessions for theRW-Split-Router service, thefilter=/relationships/services/data/0/id="RW-Split-Router" parameter can be used. Note the double quotes around the "RW-Split-Router", they are required to correctly convert strings into JSON values.

  • filter[json_path]=expr

  • Filter based on a JSONPath and a filtering expression. Similar to the filter parameter that takes a JSON Pointer, this version of the filter controls which rows are returned in a REST API response for a resource collection. Requests to individual resources are never filtered. The value inside the brackets must be a validJSONPath expression that MaxScale supports. The currently supported syntax is:

    • dot notation: $.store.book

    • bracket notation: $['store']['book']

    • array values: $.store.book[0]

    • multiple array values: $.store.book[0,1,2]

    • array wildcards: $.store.book[*].price

    • object wildcards: $.store.bicycle.*

    • optional root object: store.book

The root object being optional is an extension to the JSONPath specification that MaxScale implements. The expr value must be afilter-expression. Similarly to the other filter parameter, the comparison is done for each individual object in the data array of the result. If the JSONPath expression returns multiple objects, the comparison is done for each element and if any of them matches, the object is considered to match. In other words, wildcard JSONPath expressions are ORed together. If multiple filter[json_path]=expr parameters are found in the request, all returned values must match all of them. In other words, the filter parameters are all combined into an AND expression. For example, the following filter will only return all values whose id field is "srv1 and the attributes.parameters.port field is 3306:filter[id]=eq("srv1")&filter[attributes.parameters.port]=eq(3306)

  • page[size]

  • The number of elements that are returned for resource collections. By default all elements in the resource collection are returned. The value must be a valid positive integer, otherwise the parameter is ignored. If pagination is used, the links object will have pagination links to the next page if more elements are available.

  • page[number]

  • How many pages of results to skip. The first page of results starts from 0 and each page has no more than page[size] elements. If defined,page[size] must also be defined, otherwise this parameter is ignored. This should be considered pseudo-pagination as the results are not guaranteed to be consistent between requests.

  • sync

  • Control configuration synchronization. If this parameter is set to false then the configuration synchronization is disabled for this request. This can be used to perform configuration changes when MaxScale is unable to reach the cluster used to synchronize the configuration. The modifications to the local configuration will be overwritten when the next modification to the cluster's configuration is done which means this should only be used to perform temporary fixes.

Filter Expressions

MaxScale 24.02 added support for expressions in the filter request parameter. Each resource in a resource collection that evaluates to a true value will be kept in the returned result. All rows that evaluate to false are removed.

Equality and inequality is defined for all JSON types but ordering is defined only for numbers and strings. The logical operators allow one or more sub-expressions.

The following table lists the supported operations in the filter expressions. In it, the stored value is marked as S and the literal JSON value in the expression as V. For the logical operators, the sub-expression is marked asexpr.

Expression
Logic
Types

eq(json)

S == V

All JSON types

ne(json)

S != V

All JSON types

lt(json)

S < V

Numbers and strings

le(json)

S <= V

Numbers and strings

ge(json)

S >= V

Numbers and strings

gt(json)

S > V

Numbers and strings

and(expr...)

expr && expr

Expressions

or(expr...)

expr || expr

Expressions

not(expr...)

!expr

Expressions

Filter Expression Examples

Ranges of values can be defined using an and() expression with the range limits defined with the ordering operators ge() and le(). To filter the sessions in MaxScale to ones that have an ID between 50 and 100, the following filtering expression can be used.

filter=id=and(ge(50),le(100))

Limiting the result to only the given values can be done with an or() expression that uses eq() expressions to select the rows to return. To only return sessions with IDs 1, 5, 10 the following filtering expression can be used.

filter=id=or(eq(1),eq(5),eq(10))

Similarly, excluding certain rows from the result can be done by simply replacing or() with not(). This expression would exclude sessions with the IDs 1, 5 and 10 from the result.

filter=id=not(eq(1),eq(5),eq(10))

HTTP Headers

Request Headers

REST makes use of the HTTP protocols in its aim to provide a natural way to understand the workings of an API. The following request headers are understood by this API.

Authorization

Credentials for authentication. This header should consist of a HTTP Basic Access authentication type payload which is the base64 encoded value of the username and password joined by a colon e.g. Base64("maxuser:maxpwd").

Content-Type

All PUT and POST requests must use the Content-Type: application/json media type and the request body must be a complete and valid JSON representation of a resource. All PATCH requests must use the Content-Type: application/json media type and the request body must be a JSON document containing a partial definition of the modified resource.

Host

The address and port of the server.

If-Match

The request is performed only if the provided ETag value matches the one on the server. This field should be used with PATCH requests to prevent concurrent updates to the same resource.

The value of this header must be a value from the ETag header retrieved from the same resource at an earlier point in time.

If-Modified-Since

If the content has not changed the server responds with a 304 status code. If the content has changed the server responds with a 200 status code and the requested resource.

The value of this header must be a date value in the"HTTP-date" format.

If-None-Match

If the content has not changed the server responds with a 304 status code. If the content has changed the server responds with a 200 status code and the requested resource.

The value of this header must be a value from the ETag header retrieved from the same resource at an earlier point in time.

If-Unmodified-Since

The request is performed only if the requested resource has not been modified since the provided date.

The value of this header must be a date value in the"HTTP-date" format.

X-HTTP-Method-Override

Some clients only support GET and PUT requests. By providing the string value of the intended method in the X-HTTP-Method-Override header, a client can, for example, perform a POST, PATCH or DELETE request with the PUT method (e.g. X-HTTP-Method-Override: PATCH).

If this header is defined in the request, the current method of the request is replaced with the one in the header. The HTTP method must be in uppercase and it must be one of the methods that the requested resource supports.

Response Headers

Allow

All resources return the Allow header with the supported HTTP methods. For example the resource /services will always return the Accept: GET, PATCH, PUT header.

Accept-Patch

All PATCH capable resources return the Accept-Patch: application/json-patch header.

Date

Returns the RFC 1123 standard form date when the reply was sent. The date is in English and it uses the server's local timezone.

ETag

An identifier for a specific version of a resource. The value of this header changes whenever a resource is modified via the REST API. It will not change if an internal MaxScale event (e.g. server changing state or statistics being updated) causes a change.

When the client sends the If-Match or If-None-Match header, the provided value should be the value of the ETag header of an earlier GET.

Last-Modified

The date when the resource was last modified in "HTTP-date" format.

Location

If an out of date resource location is requested, a HTTP return code of 3XX with the Location header is returned. The value of the header contains the new location of the requested resource as a relative URI.

WWW-Authenticate

The requested authentication method. For example, WWW-Authenticate: Basic would require basic HTTP authentication.

Mxs-Warning

This header is used for sending generic warnings to clients about actions that were successful and valid but could cause problems in the future. Currently these are used to indicate when a configuration change was made to a static object and an overriding configuration is created or when a static object is being deleted at runtime.

The content of the header is the human-readable warning that should be displayed to a user.

Response Codes

Every HTTP response starts with a line with a return code which indicates the outcome of the request. The API uses some of the standard HTTP values:

2xx Success

  • 200 OK

  • Successful HTTP requests, response has a body.

  • 201 Created

  • A new resource was created.

  • 202 Accepted

  • The request has been accepted for processing, but the processing has not been completed.

  • 204 No Content

  • Successful HTTP requests, response has no body.

3xx Redirection

This class of status code indicates the client must take additional action to complete the request.

  • 301 Moved Permanently

  • This and all future requests should be directed to the given URI.

  • 302 Found

  • The response to the request can be found under another URI using the same method as in the original request.

  • 303 See Other

  • The response to the request can be found under another URI using a GET method.

  • 304 Not Modified

  • Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.

  • 307 Temporary Redirect

  • The request should be repeated with another URI but future requests should use the original URI.

  • 308 Permanent Redirect

  • The request and all future requests should be repeated using another URI.

4xx Client Error

The 4xx class of status code is when the client seems to have erred. Except when responding to a HEAD request, the body of the response MAY contains a JSON representation of the error.

{
    "error": {
        "detail" : "The new `/servers/` resource is missing the `port` parameter"
    }
}

The error field contains a short error description and the description field contains a more detailed version of the error message.

  • 400 Bad Request

  • The server cannot or will not process the request due to client error.

  • 401 Unauthorized

  • Authentication is required. The response includes a WWW-Authenticate header.

  • 403 Forbidden

  • The request was a valid request, but the client does not have the necessary permissions for the resource.

  • 404 Not Found

  • The requested resource could not be found.

  • 405 Method Not Allowed

  • A request method is not supported for the requested resource.

  • 406 Not Acceptable

  • The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.

  • 409 Conflict

  • Indicates that the request could not be processed because of conflict in the request, such as an edit conflict be tween multiple simultaneous updates.

  • 411 Length Required

  • The request did not specify the length of its content, which is required by the requested resource.

  • 412 Precondition Failed

  • The server does not meet one of the preconditions that the requester put on the request.

  • 413 Payload Too Large

  • The request is larger than the server is willing or able to process.

  • 414 URI Too Long

  • The URI provided was too long for the server to process.

  • 415 Unsupported Media Type

  • The request entity has a media type which the server or resource does not support.

  • 422 Unprocessable Entity

  • The request was well-formed but was unable to be followed due to semantic errors.

  • 423 Locked

  • The resource that is being accessed is locked.

  • 428 Precondition Required

  • The origin server requires the request to be conditional. This error code is returned when none of the Modified-Since or Match type headers are used.

  • 431 Request Header Fields Too Large

  • The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large.

5xx Server Error

The server failed to fulfill an apparently valid request.

  • 500 Internal Server Error

  • A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.

  • 501 Not Implemented

  • The server either does not recognize the request method, or it lacks the ability to fulfill the request.

  • 502 Bad Gateway

  • The server was acting as a gateway or proxy and received an invalid response from the upstream server.

  • 503 Service Unavailable

  • The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.

  • 504 Gateway Timeout

  • The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.

  • 505 HTTP Version Not Supported

  • The server does not support the HTTP protocol version used in the request.

  • 506 Variant Also Negotiates

  • Transparent content negotiation for the request results in a circular reference.

  • 507 Insufficient Storage

  • The server is unable to store the representation needed to complete the request.

  • 508 Loop Detected

  • The server detected an infinite loop while processing the request (sent in lieu of 208 Already Reported).

  • 510 Not Extended

  • Further extensions to the request are required for the server to fulfil it.

Response Headers Reserved for Future Use

The following response headers are not currently in use. Future versions of the API could return them.

  • 206 Partial Content

  • The server is delivering only part of the resource (byte serving) due to a range header sent by the client.

  • 300 Multiple Choices

  • Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).

  • 407 Proxy Authentication Required

  • The client must first authenticate itself with the proxy.

  • 408 Request Timeout

  • The server timed out waiting for the request. According to HTTP specifications: "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time."

  • 410 Gone

  • Indicates that the resource requested is no longer available and will not be available again.

  • 416 Range Not Satisfiable

  • The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.

  • 417 Expectation Failed

  • The server cannot meet the requirements of the Expect request-header field.

  • 421 Misdirected Request

  • The request was directed at a server that is not able to produce a response.

  • 424 Failed Dependency

  • The request failed due to failure of a previous request.

  • 426 Upgrade Required

  • The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.

  • 429 Too Many Requests

  • The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.

This page is licensed: CC BY-SA / Gnu FDL

MaxScale Server Resource

Server Resource

A server resource represents a backend database server.

Resource Operations

The :name in all of the URIs must be the name of a server in MaxScale.

Get a server

GET /v1/servers/:name

Get a single server.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "gtid_binlog_pos": "0-3000-8",
            "gtid_current_pos": "0-3000-8",
            "last_event": "master_up",
            "lock_held": null,
            "master_group": null,
            "master_id": -1,
            "name": "server1",
            "node_id": 3000,
            "parameters": {
                "address": "127.0.0.1",
                "disk_space_threshold": null,
                "extra_port": 0,
                "max_routing_connections": 0,
                "monitorpw": null,
                "monitoruser": null,
                "persistmaxtime": "0ms",
                "persistpoolmax": 0,
                "port": 3000,
                "priority": 0,
                "private_address": null,
                "proxy_protocol": false,
                "rank": "primary",
                "replication_custom_options": null,
                "socket": null,
                "ssl": false,
                "ssl_ca": 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"
            },
            "read_only": false,
            "replication_lag": 0,
            "server_id": 3000,
            "slave_connections": [],
            "source": {
                "file": "/etc/maxscale.cnf",
                "type": "static"
            },
            "state": "Master, Running",
            "state_details": null,
            "statistics": {
                "active_operations": 0,
                "adaptive_avg_select_time": "0ns",
                "connection_pool_empty": 0,
                "connections": 1,
                "failed_auths": 0,
                "max_connections": 1,
                "max_pool_size": 0,
                "persistent_connections": 0,
                "response_time_distribution": {
                    "read": {
                        "distribution": [
                            {
                                "count": 0,
                                "time": "0.000001",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "0.000010",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "0.000100",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "0.001000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "0.010000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "0.100000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "1.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "10.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "100.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "1000.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "10000.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "100000.000000",
                                "total": 0.0
                            }
                        ],
                        "operation": "read",
                        "range_base": 10
                    },
                    "write": {
                        "distribution": [
                            {
                                "count": 0,
                                "time": "0.000001",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "0.000010",
                                "total": 0.0
                            },
                            {
                                "count": 1,
                                "time": "0.000100",
                                "total": 9.0147000000000003e-5
                            },
                            {
                                "count": 3,
                                "time": "0.001000",
                                "total": 0.00131908
                            },
                            {
                                "count": 0,
                                "time": "0.010000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "0.100000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "1.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "10.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "100.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "1000.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "10000.000000",
                                "total": 0.0
                            },
                            {
                                "count": 0,
                                "time": "100000.000000",
                                "total": 0.0
                            }
                        ],
                        "operation": "write",
                        "range_base": 10
                    }
                },
                "reused_connections": 0,
                "routed_packets": 4,
                "total_connections": 1
            },
            "triggered_at": "Fri, 05 Jan 2024 07:23:54 GMT",
            "uptime": 2372,
            "version_string": "10.6.15-MariaDB-1:10.6.15+maria~ubu2004-log"
        },
        "id": "server1",
        "links": {
            "self": "http://localhost:8989/v1/servers/server1/"
        },
        "relationships": {
            "monitors": {
                "data": [
                    {
                        "id": "MariaDB-Monitor",
                        "type": "monitors"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/monitors/",
                    "self": "http://localhost:8989/v1/servers/server1/relationships/monitors/"
                }
            },
            "services": {
                "data": [
                    {
                        "id": "RW-Split-Router",
                        "type": "services"
                    },
                    {
                        "id": "Read-Connection-Router",
                        "type": "services"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/services/",
                    "self": "http://localhost:8989/v1/servers/server1/relationships/services/"
                }
            }
        },
        "type": "servers"
    },
    "links": {
        "self": "http://localhost:8989/v1/servers/server1/"
    }
}

Get all servers

GET /v1/servers

Response

Response contains a resource collection with all servers.

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "gtid_binlog_pos": "0-3000-8",
                "gtid_current_pos": "0-3000-8",
                "last_event": "master_up",
                "lock_held": null,
                "master_group": null,
                "master_id": -1,
                "name": "server1",
                "node_id": 3000,
                "parameters": {
                    "address": "127.0.0.1",
                    "disk_space_threshold": null,
                    "extra_port": 0,
                    "max_routing_connections": 0,
                    "monitorpw": null,
                    "monitoruser": null,
                    "persistmaxtime": "0ms",
                    "persistpoolmax": 0,
                    "port": 3000,
                    "priority": 0,
                    "private_address": null,
                    "proxy_protocol": false,
                    "rank": "primary",
                    "replication_custom_options": null,
                    "socket": null,
                    "ssl": false,
                    "ssl_ca": 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"
                },
                "read_only": false,
                "replication_lag": 0,
                "server_id": 3000,
                "slave_connections": [],
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                },
                "state": "Master, Running",
                "state_details": null,
                "statistics": {
                    "active_operations": 0,
                    "adaptive_avg_select_time": "0ns",
                    "connection_pool_empty": 0,
                    "connections": 1,
                    "failed_auths": 0,
                    "max_connections": 1,
                    "max_pool_size": 0,
                    "persistent_connections": 0,
                    "response_time_distribution": {
                        "read": {
                            "distribution": [
                                {
                                    "count": 0,
                                    "time": "0.000001",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.000010",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.000100",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.001000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.010000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.100000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100000.000000",
                                    "total": 0.0
                                }
                            ],
                            "operation": "read",
                            "range_base": 10
                        },
                        "write": {
                            "distribution": [
                                {
                                    "count": 0,
                                    "time": "0.000001",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.000010",
                                    "total": 0.0
                                },
                                {
                                    "count": 1,
                                    "time": "0.000100",
                                    "total": 9.0147000000000003e-5
                                },
                                {
                                    "count": 3,
                                    "time": "0.001000",
                                    "total": 0.00131908
                                },
                                {
                                    "count": 0,
                                    "time": "0.010000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.100000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100000.000000",
                                    "total": 0.0
                                }
                            ],
                            "operation": "write",
                            "range_base": 10
                        }
                    },
                    "reused_connections": 0,
                    "routed_packets": 4,
                    "total_connections": 1
                },
                "triggered_at": "Fri, 05 Jan 2024 07:23:54 GMT",
                "uptime": 2372,
                "version_string": "10.6.15-MariaDB-1:10.6.15+maria~ubu2004-log"
            },
            "id": "server1",
            "links": {
                "self": "http://localhost:8989/v1/servers/server1/"
            },
            "relationships": {
                "monitors": {
                    "data": [
                        {
                            "id": "MariaDB-Monitor",
                            "type": "monitors"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/monitors/",
                        "self": "http://localhost:8989/v1/servers/server1/relationships/monitors/"
                    }
                },
                "services": {
                    "data": [
                        {
                            "id": "RW-Split-Router",
                            "type": "services"
                        },
                        {
                            "id": "Read-Connection-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/servers/server1/relationships/services/"
                    }
                }
            },
            "type": "servers"
        },
        {
            "attributes": {
                "gtid_binlog_pos": "0-3001-12",
                "gtid_current_pos": "0-3001-12",
                "last_event": "lost_slave",
                "lock_held": null,
                "master_group": null,
                "master_id": 3000,
                "name": "server2",
                "node_id": 3001,
                "parameters": {
                    "address": "127.0.0.1",
                    "disk_space_threshold": null,
                    "extra_port": 0,
                    "max_routing_connections": 0,
                    "monitorpw": null,
                    "monitoruser": null,
                    "persistmaxtime": "0ms",
                    "persistpoolmax": 0,
                    "port": 3001,
                    "priority": 0,
                    "private_address": null,
                    "proxy_protocol": false,
                    "rank": "primary",
                    "replication_custom_options": null,
                    "socket": null,
                    "ssl": false,
                    "ssl_ca": 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"
                },
                "read_only": false,
                "replication_lag": -1,
                "server_id": 3001,
                "slave_connections": [
                    {
                        "connection_name": "",
                        "gtid_io_pos": "",
                        "last_io_error": "",
                        "last_sql_error": "",
                        "master_host": "127.0.0.1",
                        "master_port": 3000,
                        "master_server_id": 3000,
                        "seconds_behind_master": null,
                        "slave_io_running": "No",
                        "slave_sql_running": "No",
                        "using_gtid": "No"
                    }
                ],
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                },
                "state": "Running",
                "state_details": null,
                "statistics": {
                    "active_operations": 0,
                    "adaptive_avg_select_time": "0ns",
                    "connection_pool_empty": 0,
                    "connections": 0,
                    "failed_auths": 0,
                    "max_connections": 1,
                    "max_pool_size": 0,
                    "persistent_connections": 0,
                    "response_time_distribution": {
                        "read": {
                            "distribution": [
                                {
                                    "count": 0,
                                    "time": "0.000001",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.000010",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.000100",
                                    "total": 0.0
                                },
                                {
                                    "count": 1,
                                    "time": "0.001000",
                                    "total": 0.00037632399999999998
                                },
                                {
                                    "count": 0,
                                    "time": "0.010000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.100000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100000.000000",
                                    "total": 0.0
                                }
                            ],
                            "operation": "read",
                            "range_base": 10
                        },
                        "write": {
                            "distribution": [
                                {
                                    "count": 0,
                                    "time": "0.000001",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.000010",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.000100",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.001000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.010000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "0.100000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "1000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "10000.000000",
                                    "total": 0.0
                                },
                                {
                                    "count": 0,
                                    "time": "100000.000000",
                                    "total": 0.0
                                }
                            ],
                            "operation": "write",
                            "range_base": 10
                        }
                    },
                    "reused_connections": 0,
                    "routed_packets": 1,
                    "total_connections": 1
                },
                "triggered_at": "Fri, 05 Jan 2024 07:24:07 GMT",
                "uptime": 2372,
                "version_string": "10.6.15-MariaDB-1:10.6.15+maria~ubu2004-log"
            },
            "id": "server2",
            "links": {
                "self": "http://localhost:8989/v1/servers/server2/"
            },
            "relationships": {
                "monitors": {
                    "data": [
                        {
                            "id": "MariaDB-Monitor",
                            "type": "monitors"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/monitors/",
                        "self": "http://localhost:8989/v1/servers/server2/relationships/monitors/"
                    }
                },
                "services": {
                    "data": [
                        {
                            "id": "RW-Split-Router",
                            "type": "services"
                        },
                        {
                            "id": "Read-Connection-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/servers/server2/relationships/services/"
                    }
                }
            },
            "type": "servers"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/servers/"
    }
}

Create a server

POST /v1/servers

Create a new server by defining the resource. The posted object must define at least the following fields.

  • data.id

  • Name of the server

  • data.type

  • Type of the object, must be servers

  • data.attributes.parameters.address OR data.attributes.parameters.socket

  • The address orsocket to use. Only one of the fields can be defined.

  • data.attributes.parameters.port

  • The port to use. Needs to be defined if the address field is defined.

The following is the minimal required JSON object for defining a new server.

{
    "data": {
        "id": "server3",
        "type": "servers",
        "attributes": {
            "parameters": {
                "address": "127.0.0.1",
                "port": 3003
            }
        }
    }
}

The relationships of a server can also be defined at creation time. This allows new servers to be created and immediately taken into use.

{
    "data": {
        "id": "server4",
        "type": "servers",
        "attributes": {
            "parameters": {
                "address": "127.0.0.1",
                "port": 3002
            }
        },
        "relationships": {
            "services": {
                "data": [
                    {
                        "id": "RW-Split-Router",
                        "type": "services"
                    },
                    {
                        "id": "Read-Connection-Router",
                        "type": "services"
                    }
                ]
            },
            "monitors": {
                "data": [
                    {
                        "id": "MySQL-Monitor",
                        "type": "monitors"
                    }
                ]
            }
        }
    }
}

Refer to the Configuration Guide for a full list of server parameters.

Response

Server created:

Status: 204 No Content

Invalid JSON body:

Status: 400 Bad Request

Update a server

PATCH /v1/servers/:name

The request body must be a valid JSON document representing the modified server.

Modifiable Fields

In addition to the serverparameters, the services and monitors fields of the relationships object can be modified. Removal, addition and modification of the links will change which service and monitors use this server.

For example, removing the first value in the services list in therelationships object from the following JSON document will remove theserver1 from the service RW-Split-Router.

Removing a service from a server is analogous to removing the server from the service. Both unlink the two objects from each other.

Request for PATCH /v1/servers/server1 that modifies the address of the server:

{
    "data": {
        "attributes": {
            "parameters": {
                "address": "192.168.0.123"
            }
        }
    }
}

Request for PATCH /v1/servers/server1 that modifies the server relationships:

{
    "data": {
        "relationships": {
            "services": {
                "data": [
                    { "id": "Read-Connection-Router", "type": "services" }
                ]
            },
            "monitors": {
                "data": [
                    { "id": "MySQL-Monitor", "type": "monitors" }
                ]
            }
        }
    }
}

If parts of the resource are not defined (e.g. the attributes field in the above example), those parts of the resource are not modified. All parts that are defined are interpreted as the new definition of those part of the resource. In the above example, the relationships of the resource are completely redefined.

Response

Server modified:

Status: 204 No Content

Invalid JSON body:

Status: 400 Bad Request

Update server relationships

PATCH /v1/servers/:name/relationships/:type

The :type in the URI must be either services, for service relationships, or monitors, for monitor relationships.

The request body must be a JSON object that defines only the data field. The value of the data field must be an array of relationship objects that define the id and type fields of the relationship. This object will replace the existing relationships of the particular type from the server.

The following is an example request and request body that defines a single service relationship for a server.

PATCH /v1/servers/my-db-server/relationships/services

{
    data: [
          { "id": "my-rwsplit-service", "type": "services" }
    ]
}

All relationships for a server can be deleted by sending an empty array as thedata field value. The following example removes the server from all services.

PATCH /v1/servers/my-db-server/relationships/services

{
    data: []
}

Response

Server relationships modified:

Status: 204 No Content

Invalid JSON body:

Status: 400 Bad Request

Destroy a server

DELETE /v1/servers/:name

A server can only be deleted if it is not used by any services or monitors.

This endpoint also supports the force=yes parameter that will unconditionally delete the server by first unlinking it from all services and monitors that use it.

Response

Server is destroyed:

Status: 204 No Content

Server is in use:

Status: 400 Bad Request

Set server state

PUT /v1/servers/:name/set

This endpoint requires that the state parameter is passed with the request. The value of state must be one of the following values.

Value
State Description

master

Server is a Master

slave

Server is a Slave

maintenance

Server is put into maintenance

running

Server is up and running

synced

Server is a Galera node

drain

Server is drained of connections

For example, to set the server db-server-1 into maintenance mode, a request to the following URL must be made:

PUT /v1/servers/db-server-1/set?state=maintenance

This endpoint also supports the force=yes parameter that will cause all connections to the server to be closed if state=maintenance is also set. By default setting a server into maintenance mode will cause connections to be closed only after the next request is sent.

The following example forcefully closes all connections to server db-server-1 and sets it into maintenance mode:

PUT /v1/servers/db-server-1/set?state=maintenance&force=yes

Response

Server state modified:

Status: 204 No Content

Missing or invalid parameter:

Status: 400 Bad Request

Clear server state

PUT /v1/servers/:name/clear

This endpoint requires that the state parameter is passed with the request. The value of state must be one of the values defined in theset endpoint documentation.

Response

Server state modified:

Status: 204 No Content

Missing or invalid parameter:

Status: 400 Bad Request

This page is licensed: CC BY-SA / Gnu FDL

MaxScale Service Resource

Service Resource

A service resource represents a service inside MaxScale. A service is a collection of network listeners, filters, a router and a set of backend servers.

Resource Operations

The :name in all of the URIs must be the name of a service in MaxScale.

Get a service

GET /v1/services/:name

Get a single service.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "connections": 0,
            "listeners": [
                {
                    "attributes": {
                        "parameters": {
                            "MariaDBProtocol": {
                                "allow_replication": true
                            },
                            "address": "::",
                            "authenticator": null,
                            "authenticator_options": null,
                            "connection_init_sql_file": null,
                            "connection_metadata": [
                                "character_set_client=auto",
                                "character_set_connection=auto",
                                "character_set_results=auto",
                                "max_allowed_packet=auto",
                                "system_time_zone=auto",
                                "time_zone=auto",
                                "tx_isolation=auto",
                                "maxscale=auto"
                            ],
                            "port": 4008,
                            "protocol": "MariaDBProtocol",
                            "proxy_protocol_networks": null,
                            "service": "Read-Connection-Router",
                            "socket": null,
                            "sql_mode": "default",
                            "ssl": false,
                            "ssl_ca": null,
                            "ssl_cert": null,
                            "ssl_cert_verify_depth": 9,
                            "ssl_cipher": null,
                            "ssl_crl": null,
                            "ssl_key": null,
                            "ssl_verify_peer_certificate": false,
                            "ssl_verify_peer_host": false,
                            "ssl_version": "MAX",
                            "type": "listener",
                            "user_mapping_file": null
                        },
                        "source": {
                            "file": "/etc/maxscale.cnf",
                            "type": "static"
                        },
                        "state": "Running"
                    },
                    "id": "Read-Connection-Listener",
                    "relationships": {
                        "services": {
                            "data": [
                                {
                                    "id": "Read-Connection-Router",
                                    "type": "services"
                                }
                            ],
                            "links": {
                                "related": "http://localhost:8989/v1/services/",
                                "self": "http://localhost:8989/v1/listeners/Read-Connection-Listener/relationships/services/"
                            }
                        }
                    },
                    "type": "listeners"
                }
            ],
            "parameters": {
                "auth_all_servers": false,
                "connection_keepalive": "300000ms",
                "disable_sescmd_history": false,
                "enable_root_user": false,
                "force_connection_keepalive": false,
                "idle_session_pool_time": "-1ms",
                "localhost_match_wildcard_host": true,
                "log_auth_warnings": true,
                "log_debug": false,
                "log_info": false,
                "log_notice": false,
                "log_warning": false,
                "master_accept_reads": true,
                "max_connections": 0,
                "max_replication_lag": "0ms",
                "max_sescmd_history": 50,
                "multiplex_timeout": "60000ms",
                "net_write_timeout": "0ms",
                "password": "*****",
                "prune_sescmd_history": true,
                "rank": "primary",
                "retain_last_statements": -1,
                "router": "readconnroute",
                "router_options": "master",
                "session_trace": false,
                "strip_db_esc": true,
                "type": "service",
                "user": "maxuser",
                "user_accounts_file": null,
                "user_accounts_file_usage": "add_when_load_ok",
                "version_string": null,
                "wait_timeout": "0ms"
            },
            "router": "readconnroute",
            "router_diagnostics": {
                "queries": 0,
                "server_query_statistics": []
            },
            "source": {
                "file": "/etc/maxscale.cnf",
                "type": "static"
            },
            "started": "Fri, 05 Jan 2024 07:23:54 GMT",
            "state": "Started",
            "statistics": {
                "active_operations": 0,
                "avg_sescmd_history_length": 0.0,
                "avg_session_lifetime": 0.0,
                "connections": 0,
                "failed_auths": 0,
                "max_connections": 0,
                "max_sescmd_history_length": 0,
                "max_session_lifetime": 0,
                "routed_packets": 0,
                "total_connections": 0
            },
            "total_connections": 0,
            "users": [
                {
                    "default_role": "",
                    "global_priv": false,
                    "host": "localhost",
                    "plugin": "mysql_native_password",
                    "proxy_priv": false,
                    "ssl": false,
                    "super_priv": false,
                    "user": "mariadb.sys"
                },
                {
                    "default_role": "",
                    "global_priv": true,
                    "host": "127.0.0.1",
                    "plugin": "mysql_native_password",
                    "proxy_priv": false,
                    "ssl": false,
                    "super_priv": true,
                    "user": "maxuser"
                },
                {
                    "default_role": "",
                    "global_priv": true,
                    "host": "%",
                    "plugin": "mysql_native_password",
                    "proxy_priv": false,
                    "ssl": false,
                    "super_priv": true,
                    "user": "maxuser"
                },
                {
                    "default_role": "",
                    "global_priv": true,
                    "host": "localhost",
                    "plugin": "mysql_native_password",
                    "proxy_priv": false,
                    "ssl": false,
                    "super_priv": true,
                    "user": "root"
                },
                {
                    "default_role": "",
                    "global_priv": true,
                    "host": "%",
                    "plugin": "mysql_native_password",
                    "proxy_priv": false,
                    "ssl": false,
                    "super_priv": true,
                    "user": "root"
                }
            ],
            "users_last_update": "Fri, 05 Jan 2024 07:23:55 GMT"
        },
        "id": "Read-Connection-Router",
        "links": {
            "self": "http://localhost:8989/v1/services/Read-Connection-Router/"
        },
        "relationships": {
            "filters": {
                "data": [
                    {
                        "id": "QLA",
                        "type": "filters"
                    },
                    {
                        "id": "Hint",
                        "type": "filters"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/filters/",
                    "self": "http://localhost:8989/v1/services/Read-Connection-Router/relationships/filters/"
                }
            },
            "listeners": {
                "data": [
                    {
                        "id": "Read-Connection-Listener",
                        "type": "listeners"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/listeners/",
                    "self": "http://localhost:8989/v1/services/Read-Connection-Router/relationships/listeners/"
                }
            },
            "servers": {
                "data": [
                    {
                        "id": "server1",
                        "type": "servers"
                    },
                    {
                        "id": "server2",
                        "type": "servers"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/servers/",
                    "self": "http://localhost:8989/v1/services/Read-Connection-Router/relationships/servers/"
                }
            }
        },
        "type": "services"
    },
    "links": {
        "self": "http://localhost:8989/v1/services/Read-Connection-Router/"
    }
}

Get all services

GET /v1/services

Get all services.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "connections": 1,
                "listeners": [
                    {
                        "attributes": {
                            "parameters": {
                                "MariaDBProtocol": {
                                    "allow_replication": true
                                },
                                "address": "::",
                                "authenticator": null,
                                "authenticator_options": null,
                                "connection_init_sql_file": null,
                                "connection_metadata": [
                                    "character_set_client=auto",
                                    "character_set_connection=auto",
                                    "character_set_results=auto",
                                    "max_allowed_packet=auto",
                                    "system_time_zone=auto",
                                    "time_zone=auto",
                                    "tx_isolation=auto",
                                    "maxscale=auto"
                                ],
                                "port": 4006,
                                "protocol": "MariaDBProtocol",
                                "proxy_protocol_networks": null,
                                "service": "RW-Split-Router",
                                "socket": null,
                                "sql_mode": "default",
                                "ssl": false,
                                "ssl_ca": null,
                                "ssl_cert": null,
                                "ssl_cert_verify_depth": 9,
                                "ssl_cipher": null,
                                "ssl_crl": null,
                                "ssl_key": null,
                                "ssl_verify_peer_certificate": false,
                                "ssl_verify_peer_host": false,
                                "ssl_version": "MAX",
                                "type": "listener",
                                "user_mapping_file": null
                            },
                            "source": {
                                "file": "/etc/maxscale.cnf",
                                "type": "static"
                            },
                            "state": "Running"
                        },
                        "id": "RW-Split-Listener",
                        "relationships": {
                            "services": {
                                "data": [
                                    {
                                        "id": "RW-Split-Router",
                                        "type": "services"
                                    }
                                ],
                                "links": {
                                    "related": "http://localhost:8989/v1/services/",
                                    "self": "http://localhost:8989/v1/listeners/RW-Split-Listener/relationships/services/"
                                }
                            }
                        },
                        "type": "listeners"
                    }
                ],
                "parameters": {
                    "auth_all_servers": false,
                    "causal_reads": "none",
                    "causal_reads_timeout": "10000ms",
                    "connection_keepalive": "300000ms",
                    "delayed_retry": false,
                    "delayed_retry_timeout": "10000ms",
                    "disable_sescmd_history": false,
                    "enable_root_user": false,
                    "force_connection_keepalive": false,
                    "idle_session_pool_time": "-1ms",
                    "lazy_connect": false,
                    "localhost_match_wildcard_host": true,
                    "log_auth_warnings": true,
                    "log_debug": false,
                    "log_info": false,
                    "log_notice": false,
                    "log_warning": false,
                    "master_accept_reads": false,
                    "master_failure_mode": "fail_on_write",
                    "master_reconnection": true,
                    "max_connections": 0,
                    "max_replication_lag": "0ms",
                    "max_sescmd_history": 50,
                    "max_slave_connections": 255,
                    "multiplex_timeout": "60000ms",
                    "net_write_timeout": "0ms",
                    "optimistic_trx": false,
                    "password": "*****",
                    "prune_sescmd_history": true,
                    "rank": "primary",
                    "retain_last_statements": -1,
                    "retry_failed_reads": true,
                    "reuse_prepared_statements": false,
                    "router": "readwritesplit",
                    "session_trace": false,
                    "slave_connections": 255,
                    "slave_selection_criteria": "least_current_operations",
                    "strict_multi_stmt": false,
                    "strict_sp_calls": false,
                    "strict_tmp_tables": true,
                    "strip_db_esc": true,
                    "transaction_replay": false,
                    "transaction_replay_attempts": 5,
                    "transaction_replay_checksum": "full",
                    "transaction_replay_max_size": 1048576,
                    "transaction_replay_retry_on_deadlock": false,
                    "transaction_replay_retry_on_mismatch": false,
                    "transaction_replay_safe_commit": true,
                    "transaction_replay_timeout": "30000ms",
                    "type": "service",
                    "use_sql_variables_in": "all",
                    "user": "maxuser",
                    "user_accounts_file": null,
                    "user_accounts_file_usage": "add_when_load_ok",
                    "version_string": null,
                    "wait_timeout": "0ms"
                },
                "router": "readwritesplit",
                "router_diagnostics": {
                    "queries": 4,
                    "replayed_transactions": 0,
                    "ro_transactions": 1,
                    "route_all": 1,
                    "route_master": 3,
                    "route_slave": 0,
                    "rw_transactions": 0,
                    "server_query_statistics": [
                        {
                            "avg_selects_per_session": 0,
                            "avg_sess_duration": "0ns",
                            "id": "server1",
                            "read": 1,
                            "total": 4,
                            "write": 3
                        },
                        {
                            "avg_selects_per_session": 0,
                            "avg_sess_duration": "0ns",
                            "id": "server2",
                            "read": 1,
                            "total": 1,
                            "write": 0
                        }
                    ],
                    "trx_max_size_exceeded": 0
                },
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                },
                "started": "Fri, 05 Jan 2024 07:23:54 GMT",
                "state": "Started",
                "statistics": {
                    "active_operations": 0,
                    "avg_sescmd_history_length": 0.0,
                    "avg_session_lifetime": 0.0,
                    "connections": 1,
                    "failed_auths": 0,
                    "max_connections": 1,
                    "max_sescmd_history_length": 0,
                    "max_session_lifetime": 0,
                    "routed_packets": 4,
                    "total_connections": 1
                },
                "total_connections": 1,
                "users": [
                    {
                        "default_role": "",
                        "global_priv": false,
                        "host": "localhost",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": false,
                        "user": "mariadb.sys"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "127.0.0.1",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "maxuser"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "%",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "maxuser"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "localhost",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "root"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "%",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "root"
                    }
                ],
                "users_last_update": "Fri, 05 Jan 2024 07:23:55 GMT"
            },
            "id": "RW-Split-Router",
            "links": {
                "self": "http://localhost:8989/v1/services/RW-Split-Router/"
            },
            "relationships": {
                "listeners": {
                    "data": [
                        {
                            "id": "RW-Split-Listener",
                            "type": "listeners"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/listeners/",
                        "self": "http://localhost:8989/v1/services/RW-Split-Router/relationships/listeners/"
                    }
                },
                "monitors": {
                    "data": [
                        {
                            "id": "MariaDB-Monitor",
                            "type": "monitors"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/monitors/",
                        "self": "http://localhost:8989/v1/services/RW-Split-Router/relationships/monitors/"
                    }
                }
            },
            "type": "services"
        },
        {
            "attributes": {
                "connections": 0,
                "listeners": [
                    {
                        "attributes": {
                            "parameters": {
                                "MariaDBProtocol": {
                                    "allow_replication": true
                                },
                                "address": "::",
                                "authenticator": null,
                                "authenticator_options": null,
                                "connection_init_sql_file": null,
                                "connection_metadata": [
                                    "character_set_client=auto",
                                    "character_set_connection=auto",
                                    "character_set_results=auto",
                                    "max_allowed_packet=auto",
                                    "system_time_zone=auto",
                                    "time_zone=auto",
                                    "tx_isolation=auto",
                                    "maxscale=auto"
                                ],
                                "port": 4008,
                                "protocol": "MariaDBProtocol",
                                "proxy_protocol_networks": null,
                                "service": "Read-Connection-Router",
                                "socket": null,
                                "sql_mode": "default",
                                "ssl": false,
                                "ssl_ca": null,
                                "ssl_cert": null,
                                "ssl_cert_verify_depth": 9,
                                "ssl_cipher": null,
                                "ssl_crl": null,
                                "ssl_key": null,
                                "ssl_verify_peer_certificate": false,
                                "ssl_verify_peer_host": false,
                                "ssl_version": "MAX",
                                "type": "listener",
                                "user_mapping_file": null
                            },
                            "source": {
                                "file": "/etc/maxscale.cnf",
                                "type": "static"
                            },
                            "state": "Running"
                        },
                        "id": "Read-Connection-Listener",
                        "relationships": {
                            "services": {
                                "data": [
                                    {
                                        "id": "Read-Connection-Router",
                                        "type": "services"
                                    }
                                ],
                                "links": {
                                    "related": "http://localhost:8989/v1/services/",
                                    "self": "http://localhost:8989/v1/listeners/Read-Connection-Listener/relationships/services/"
                                }
                            }
                        },
                        "type": "listeners"
                    }
                ],
                "parameters": {
                    "auth_all_servers": false,
                    "connection_keepalive": "300000ms",
                    "disable_sescmd_history": false,
                    "enable_root_user": false,
                    "force_connection_keepalive": false,
                    "idle_session_pool_time": "-1ms",
                    "localhost_match_wildcard_host": true,
                    "log_auth_warnings": true,
                    "log_debug": false,
                    "log_info": false,
                    "log_notice": false,
                    "log_warning": false,
                    "master_accept_reads": true,
                    "max_connections": 0,
                    "max_replication_lag": "0ms",
                    "max_sescmd_history": 50,
                    "multiplex_timeout": "60000ms",
                    "net_write_timeout": "0ms",
                    "password": "*****",
                    "prune_sescmd_history": true,
                    "rank": "primary",
                    "retain_last_statements": -1,
                    "router": "readconnroute",
                    "router_options": "master",
                    "session_trace": false,
                    "strip_db_esc": true,
                    "type": "service",
                    "user": "maxuser",
                    "user_accounts_file": null,
                    "user_accounts_file_usage": "add_when_load_ok",
                    "version_string": null,
                    "wait_timeout": "0ms"
                },
                "router": "readconnroute",
                "router_diagnostics": {
                    "queries": 0,
                    "server_query_statistics": []
                },
                "source": {
                    "file": "/etc/maxscale.cnf",
                    "type": "static"
                },
                "started": "Fri, 05 Jan 2024 07:23:54 GMT",
                "state": "Started",
                "statistics": {
                    "active_operations": 0,
                    "avg_sescmd_history_length": 0.0,
                    "avg_session_lifetime": 0.0,
                    "connections": 0,
                    "failed_auths": 0,
                    "max_connections": 0,
                    "max_sescmd_history_length": 0,
                    "max_session_lifetime": 0,
                    "routed_packets": 0,
                    "total_connections": 0
                },
                "total_connections": 0,
                "users": [
                    {
                        "default_role": "",
                        "global_priv": false,
                        "host": "localhost",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": false,
                        "user": "mariadb.sys"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "127.0.0.1",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "maxuser"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "%",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "maxuser"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "localhost",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "root"
                    },
                    {
                        "default_role": "",
                        "global_priv": true,
                        "host": "%",
                        "plugin": "mysql_native_password",
                        "proxy_priv": false,
                        "ssl": false,
                        "super_priv": true,
                        "user": "root"
                    }
                ],
                "users_last_update": "Fri, 05 Jan 2024 07:23:55 GMT"
            },
            "id": "Read-Connection-Router",
            "links": {
                "self": "http://localhost:8989/v1/services/Read-Connection-Router/"
            },
            "relationships": {
                "filters": {
                    "data": [
                        {
                            "id": "QLA",
                            "type": "filters"
                        },
                        {
                            "id": "Hint",
                            "type": "filters"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/filters/",
                        "self": "http://localhost:8989/v1/services/Read-Connection-Router/relationships/filters/"
                    }
                },
                "listeners": {
                    "data": [
                        {
                            "id": "Read-Connection-Listener",
                            "type": "listeners"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/listeners/",
                        "self": "http://localhost:8989/v1/services/Read-Connection-Router/relationships/listeners/"
                    }
                },
                "servers": {
                    "data": [
                        {
                            "id": "server1",
                            "type": "servers"
                        },
                        {
                            "id": "server2",
                            "type": "servers"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/servers/",
                        "self": "http://localhost:8989/v1/services/Read-Connection-Router/relationships/servers/"
                    }
                }
            },
            "type": "services"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/services/"
    }
}

Create a service

POST /v1/services

Create a new service by defining the resource. The posted object must define at least the following fields.

  • data.id

  • Name of the service

  • data.type

  • Type of the object, must be services

  • data.attributes.router

  • The router module to use

  • data.attributes.parameters.user

  • The user to use

  • data.attributes.parameters.password

  • The password to use

The data.attributes.parameters object is used to define router and service parameters. All configuration parameters that can be defined in the configuration file can also be added to the parameters object. The exceptions to this are the type, router, servers and filters parameters which must not be defined.

As with other REST API resources, the data.relationships field defines the relationships of the service to other resources. Services can have two types of relationships: servers and filters relationships.

If the request body defines a valid relationships object, the service is linked to those resources. For servers, this is equivalent to adding the list of server names into theservers parameter. For filters, this is equivalent to adding the filters in thedata.relationships.filters.data array to thefilters parameter in the order they appear. For other services, this is equivalent to adding the list of server names into thetargets parameter.

The following example defines a new service with both a server and a filter relationship.

{
    "data": {
        "id": "my-service",
        "type": "services",
        "attributes": {
            "router": "readwritesplit",
            "parameters": {
                "user": "maxuser",
                "password": "maxpwd"
            }
        },
        "relationships": {
            "filters": {
                "data": [
                    {
                        "id": "QLA",
                        "type": "filters"
                    }
                ]
            },
            "servers": {
                "data": [
                    {
                        "id": "server1",
                        "type": "servers"
                    }
                ]
            }
        }
    }
}

Response

Service is created:

Status: 204 No Content

Destroy a service

DELETE /v1/services/:name

A service can only be destroyed if the service uses no servers or filters and all the listeners pointing to the service have been destroyed. This means that the data.relationships must be an empty object and data.attributes.listeners must be an empty array in order for the service to qualify for destruction.

If there are open client connections that use the service when it is destroyed, they are allowed to gracefully close before the service is destroyed. This means that the destruction of a service can be acknowledged via the REST API before the destruction process has fully completed.

To find out whether a service is still in use after it has been destroyed, thesessions resource should be used. If a session for the service is still open, it has not yet been destroyed.

This endpoint also supports the force=yes parameter that will unconditionally delete the service by first unlinking it from all servers and filters that it uses.

Response

Service is destroyed:

Status: 204 No Content

Update a service

PATCH /v1/services/:name

The request body must be a JSON object which represents a set of new definitions for the service.

All standard service parameters can be modified. Refer to theservice documentation on the details of these parameters.

In addition to the standard service parameters, router parameters can be updated at runtime if the router module supports it. Refer to the individual router documentation for more details on whether the router supports it and which parameters can be updated at runtime.

The following example modifies a service by changing the user parameter to admin.

{
    "data": {
        "attributes": {
            "parameters": {
                "user": "admin"
            }
        }
    }
}

Response

Service is modified:

Status: 204 No Content

Update service relationships

PATCH /v1/services/:name/relationships/:type

The :type in the URI must be either servers, services or filters, depending on which relationship is being modified.

The request body must be a JSON object that defines only the data field. The value of the data field must be an array of relationship objects that define the id and type fields of the relationship. This object will replace the existing relationships of this type for the service.

Note: The order of the values in the filters relationship will define the order the filters are set up in. The order in which the filters appear in the array will be the order in which the filters are applied to each query. Refer to the filters parameter for more details.

The following is an example request and request body that defines a single server relationship for a service that is equivalent to a servers=my-server parameter.

PATCH /v1/services/my-rw-service/relationships/servers

{
    data: [
          { "id": "my-server", "type": "servers" }
    ]
}

All relationships for a service can be deleted by sending an empty array as thedata field value. The following example removes all servers from a service.

PATCH /v1/services/my-rw-service/relationships/servers

{
    data: []
}

Response

Service relationships modified:

Status: 204 No Content

Invalid JSON body:

Status: 400 Bad Request

Stop a service

PUT /v1/services/:name/stop

Stops a started service.

Parameters

This endpoint supports the following parameters:

  • force=yes

  • Close all existing connections that were created through this listener.

Response

Service is stopped:

Status: 204 No Content

Start a service

PUT /v1/services/:name/start

Starts a stopped service.

Response

Service is started:

Status: 204 No Content

Reload users of a service

POST /v1/services/:name/reload

Reloads the list of database users used for authentication.

Response

Users are reloaded:

Status: 204 No Content

Get service listeners

GET /v1/services/:name/listeners

This endpoint is deprecated, use thethis listeners endpoint instead.

Get a single service listener

GET /v1/services/:name/listeners/:listener

This endpoint is deprecated, use the this listeners endpoint instead.

Create a new listener

POST /v1/services/:name/listeners

This endpoint is deprecated, use thethis listeners endpoint instead.

Destroy a listener

DELETE /v1/services/:service/listeners/:name

This endpoint is deprecated, use thethis listeners endpoint instead.

This page is licensed: CC BY-SA / Gnu FDL

MaxScale Session Resource

Session Resource

A session is an abstraction of a client connection, any number of related backend connections, a router module session and possibly filter module sessions. Each session is created on a service and each service can have multiple sessions.

Resource Operations

Get a session

GET /v1/sessions/:id

Get a single session. :id must be a valid session ID. The session ID is the same that is exposed to the client as the connection ID.

This endpoint also supports the rdns=true parameter, which instructs MaxScale to perform reverse DNS on the client IP address. As this requires communicating with an external server, the operation may be expensive.

Response

Status: 200 OK

{
    "data": {
        "attributes": {
            "client": {
                "cipher": "",
                "connection_attributes": {
                    "_client_name": "libmariadb",
                    "_client_version": "3.3.4",
                    "_os": "Linux",
                    "_pid": "502300",
                    "_platform": "x86_64",
                    "_server_host": "127.0.0.1"
                },
                "sescmd_history_len": 1,
                "sescmd_history_stored_metadata": 0,
                "sescmd_history_stored_responses": 1
            },
            "connected": "Fri, 05 Jan 2024 07:24:06 GMT",
            "connections": [
                {
                    "cipher": "",
                    "connection_id": 129,
                    "server": "server1"
                }
            ],
            "idle": 5.2000000000000002,
            "io_activity": 16,
            "log": [],
            "memory": {
                "connection_buffers": {
                    "backends": {
                        "server1": {
                            "misc": 662,
                            "readq": 0,
                            "total": 662,
                            "writeq": 0
                        }
                    },
                    "client": {
                        "misc": 654,
                        "readq": 65536,
                        "total": 66190,
                        "writeq": 0
                    },
                    "total": 66852
                },
                "exec_metadata": 0,
                "last_queries": 0,
                "sescmd_history": 485,
                "total": 67337,
                "variables": 0
            },
            "parameters": {
                "log_debug": false,
                "log_error": false,
                "log_info": false,
                "log_notice": false,
                "log_warning": false
            },
            "port": 40664,
            "queries": [],
            "remote": "127.0.0.1",
            "seconds_alive": 5.209291554,
            "state": "Session started",
            "thread": 2,
            "user": "maxuser"
        },
        "id": "1",
        "links": {
            "self": "http://localhost:8989/v1/sessions/1/"
        },
        "relationships": {
            "services": {
                "data": [
                    {
                        "id": "RW-Split-Router",
                        "type": "services"
                    }
                ],
                "links": {
                    "related": "http://localhost:8989/v1/services/",
                    "self": "http://localhost:8989/v1/sessions/1/relationships/services/"
                }
            }
        },
        "type": "sessions"
    },
    "links": {
        "self": "http://localhost:8989/v1/sessions/1/"
    }
}

Get all sessions

GET /v1/sessions

Get all sessions.

Response

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "client": {
                    "cipher": "",
                    "connection_attributes": {
                        "_client_name": "libmariadb",
                        "_client_version": "3.3.4",
                        "_os": "Linux",
                        "_pid": "502300",
                        "_platform": "x86_64",
                        "_server_host": "127.0.0.1"
                    },
                    "sescmd_history_len": 1,
                    "sescmd_history_stored_metadata": 0,
                    "sescmd_history_stored_responses": 1
                },
                "connected": "Fri, 05 Jan 2024 07:24:06 GMT",
                "connections": [
                    {
                        "cipher": "",
                        "connection_id": 129,
                        "server": "server1"
                    }
                ],
                "idle": 5.2000000000000002,
                "io_activity": 16,
                "log": [],
                "memory": {
                    "connection_buffers": {
                        "backends": {
                            "server1": {
                                "misc": 662,
                                "readq": 0,
                                "total": 662,
                                "writeq": 0
                            }
                        },
                        "client": {
                            "misc": 654,
                            "readq": 65536,
                            "total": 66190,
                            "writeq": 0
                        },
                        "total": 66852
                    },
                    "exec_metadata": 0,
                    "last_queries": 0,
                    "sescmd_history": 485,
                    "total": 67337,
                    "variables": 0
                },
                "parameters": {
                    "log_debug": false,
                    "log_error": false,
                    "log_info": false,
                    "log_notice": false,
                    "log_warning": false
                },
                "port": 40664,
                "queries": [],
                "remote": "127.0.0.1",
                "seconds_alive": 5.2105843680000001,
                "state": "Session started",
                "thread": 2,
                "user": "maxuser"
            },
            "id": "1",
            "links": {
                "self": "http://localhost:8989/v1/sessions/1/"
            },
            "relationships": {
                "services": {
                    "data": [
                        {
                            "id": "RW-Split-Router",
                            "type": "services"
                        }
                    ],
                    "links": {
                        "related": "http://localhost:8989/v1/services/",
                        "self": "http://localhost:8989/v1/sessions/1/relationships/services/"
                    }
                }
            },
            "type": "sessions"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/sessions/"
    }
}

Update a Session

PATCH /v1/sessions/:id

The request body must be a JSON object which represents the new configuration of the session. The :id must be a valid session ID that is active.

The log_debug, log_info, log_notice, log_warning and log_error boolean parameters control whether the associated logging level is enabled:

{
    "data": {
        "attributes": {
            "parameters": {
                "log_info": true
            }
        }
    }
}

The filters that a session uses can be updated by re-defining the filter relationship of the session. This causes new filter sessions to be opened immediately. The old filter session are closed and replaced with the new filter session the next time the session is idle. The order in which the filters are defined in the request body is the order in which the filters are installed, similar to how the filter relationship for services behaves.

{
    "data": {
        "attributes": {
            "relationships": {
                "filters": {
                    "data": [
                        { "id": "my-cache-filter" },
                        { "id": "my-log-filter" }
                    ]
                }
            }
        }
    }
}

Response

Session is modified:

Status: 204 No Content

Restart a Session

POST /v1/sessions/:id/restart

This endpoint causes the session to re-read the configuration from the service. As a result of this, all backend connections will be closed and then opened again. All router and filter sessions will be created again which means that for modules that perform something whenever a new module session is opened, this behaves as if a new session was started.

This endpoint can be used to apply configuration changes that were done after the session was started. This can be useful for situations where the client connections live for a long time and connections are not recycled often enough.

Response

Session is was restarted:

Status: 204 No Content

Restart all Sessions

POST /v1/sessions/restart

This endpoint does the same thing as the /v1/sessions/:id/restart endpoint except that it applies to all sessions.

Response

Session is was restarted:

Status: 204 No Content

Kill a Session

DELETE /v1/sessions/:id

This endpoint causes the session to be forcefully closed.

Request Parameters

This endpoint supports the following request parameters.

  • ttl

  • The time after which the session is killed. If this parameter is not given, the session is killed immediately. This can be used to give the session time to finish the work it is performing before the connection is closed.

Response

Session was killed:

Status: 204 No Content

This page is licensed: CC BY-SA / Gnu FDL

MaxScale SQL Resource

SQL Resource

The SQL resource represents a database connection.

SQL Connection Interface

The following endpoints provide a simple REST API interface for executing SQL queries on servers and services in MaxScale.

This endpoint also supports executing SQL queries using an ODBC driver. The results returned by connections that use ODBC drivers can differ from the ones returned by normal SQL connections to objects in MaxScale.

This document uses the :id value in the URL to represent a connection ID and the :query_id to represent a query ID. These values do not need to be manually added as the relevant links are returned in the request body of each endpoint.

The endpoints use JSON Web Tokens to uniquely identify open SQL connections. A connection token can be acquired with a POST /v1/sql request and can be used with the POST /v1/sql/:id/query, GET /v1/sql/:id/results/:query_id andDELETE /v1/sql endpoints. All of these endpoints accept a connection token in the token parameter of the request:

POST /v1/sql/query?token=eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZG1pbiIsImV4cCI6MTU4MzI1NDE1MSwiaWF0IjoxNTgzMjI1MzUxLCJpc3MiOiJtYXhzY2FsZSJ9.B1BqhjjKaCWKe3gVXLszpOPfeu8cLiwSb4CMIJAoyqw

In addition to request parameters, the token can be stored in cookies in which case they are automatically used by the REST API. For more information about token storage in cookies, see the documentation for POST /v1/sql.

Request Parameters

All of the endpoints that operate on a single connection support the following request parameters. The GET /v1/sql and GET /v1/sql/:id endpoints are an exception as they ignore the current connection token.

  • token

  • The connection token to use for the request. If provided, the value is unconditionally used even if a cookie with a valid token exists.

Get one SQL connection

GET /v1/sql/:id

Response

Response contains the requested resource.

Status: 200 OK

{
    "data": {
        "attributes": {
            "seconds_idle": 0.0013705639999999999,
            "sql": null,
            "target": "server1",
            "thread_id": 10
        },
        "id": "96be0ffe-10fb-4ed1-8e66-a17ef1eea0fe",
        "links": {
            "related": "http://localhost:8989/v1/sql/96be0ffe-10fb-4ed1-8e66-a17ef1eea0fe/queries/",
            "self": "http://localhost:8989/v1/sql/96be0ffe-10fb-4ed1-8e66-a17ef1eea0fe/"
        },
        "type": "sql"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/96be0ffe-10fb-4ed1-8e66-a17ef1eea0fe/"
    }
}

Get all SQL connections

GET /v1/sql

Response

Response contains a resource collection with all the open SQL connections.

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "seconds_idle": 0.0010341230000000001,
                "sql": null,
                "target": "server1",
                "thread_id": 12
            },
            "id": "90761656-3352-420b-83e7-0dcef691552a",
            "links": {
                "related": "http://localhost:8989/v1/sql/90761656-3352-420b-83e7-0dcef691552a/queries/",
                "self": "http://localhost:8989/v1/sql/90761656-3352-420b-83e7-0dcef691552a/"
            },
            "type": "sql"
        },
        {
            "attributes": {
                "seconds_idle": 0.002397377,
                "sql": null,
                "target": "server1",
                "thread_id": 11
            },
            "id": "98a8b5c5-3632-4f0f-98bb-0dc440a3409a",
            "links": {
                "related": "http://localhost:8989/v1/sql/98a8b5c5-3632-4f0f-98bb-0dc440a3409a/queries/",
                "self": "http://localhost:8989/v1/sql/98a8b5c5-3632-4f0f-98bb-0dc440a3409a/"
            },
            "type": "sql"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/sql/"
    }
}

Open SQL connection to server

POST /v1/sql

The request body must be a JSON object consisting of the following fields:

  • target

  • The object to connect to. This is a mandatory value and the given value must be the name of a valid server, service or listener in MaxScale or the value odbc if an ODBC connection is being made.

  • user

  • The username to use when creating the connection. This is a mandatory value when connecting to an object in MaxScale.

  • password

  • The password for the user. This is a mandatory value when connecting to an object in MaxScale.

  • db

  • The default database for the connection. By default the connection will have no default database. This is ignored by ODBC connections.

  • timeout

  • Connection timeout in seconds. The default connection timeout is 10 seconds. This controls how long the SQL connection creation can take before an error is returned. This is accepted by all connection types.

  • connection_string

  • Connection string that defines the ODBC connection. This is a required value for ODBC type connections and is ignored by all other connection types.

Here is an example request body:

{
    "user": "jdoe",
    "password": "my-s3cret",
    "target": "server1",
    "db": "test",
    "timeout": 15
}

And here is an example request that uses an ODBC driver to connect to a remote server:

{
    "target": "odbc",
    "connection_string": "Driver=MariaDB;SERVER=127.0.0.1;UID=maxuser;PWD=maxpwd"
}

The response will contain the new connection with the token stored atmeta.token. If the request uses the persist=yes request parameter, the token is stored in cookies instead of the metadata object and the response body will not contain the token.

The location of the newly created connection will be stored at links.self in the response body as well as in the Location header.

The token must be given to all subsequent requests that use the connection. It must be either given in the token parameter of a request or it must be stored in the cookies. If both a token parameter and a cookie exist at the same time, the token parameter will be used instead of the cookie.

Request Parameters

This endpoint supports the following request parameters.

  • persist

  • Store the connection token in cookies instead of returning it as the response body. This parameter expects only one value, yes, as its argument. Whenpersist=yes is set, the token is stored in the conn_id_sig_<id> cookie where the <id> part is replaced by the ID of the connection.

  • max-age

  • Sets the connection token maximum age in seconds. The default ismax-age=28800. Only positive values are accepted and if a non-positive or a non-integer value is found, the parameter is ignored. Once the token age exceeds the configured maximum value, the token can no longer be used and a new connection must be created.

Response

Connection was opened:

Status: 201 Created

{
    "data": {
        "attributes": {
            "seconds_idle": 7.6394000000000001e-5,
            "sql": null,
            "target": "server1",
            "thread_id": 13
        },
        "id": "f4e38d96-99b4-479e-ac36-5f3b437aff99",
        "links": {
            "related": "http://localhost:8989/v1/sql/f4e38d96-99b4-479e-ac36-5f3b437aff99/queries/",
            "self": "http://localhost:8989/v1/sql/f4e38d96-99b4-479e-ac36-5f3b437aff99/"
        },
        "type": "sql"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/f4e38d96-99b4-479e-ac36-5f3b437aff99/"
    },
    "meta": {
        "token": "eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJmNGUzOGQ5Ni05OWI0LTQ3OWUtYWMzNi01ZjNiNDM3YWZmOTkiLCJleHAiOjE2ODk5NTA4MDQsImlhdCI6MTY4OTkyMjAwNCwiaXNzIjoibXhzLXF1ZXJ5Iiwic3ViIjoiZjRlMzhkOTYtOTliNC00NzllLWFjMzYtNWYzYjQzN2FmZjk5In0.gCKYl7XwwnMLjJbQT6UShDuK8aJ6gessmredQ1i0On4"
    }
}

Missing or invalid payload:

Status: 400 Bad Request

Close an opened SQL connection

DELETE /v1/sql/:id

Response

Connection was closed:

Status: 204 No Content

Missing or invalid connection token:

Status: 400 Bad Request

Reconnect an opened SQL connection

POST /v1/sql/:id/reconnect

Reconnects an existing connection. This can also be used if the connection to the backend server was lost due to a network error.

The connection will use the same credentials that were passed to the POST /v1/sql endpoint. The new connection will still have the same ID in the REST API but will be treated as a new connection by the database. A reconnection re-initializes the connection and resets the session state. Reconnections cannot take place while a transaction is open.

Response

Reconnection was successful:

Status: 204 No Content

Reconnection failed or connection is already in use:

Status: 503 Service Unavailable

Missing or invalid connection token:

Status: 400 Bad Request

Clone an existing SQL connection

POST /v1/sql/:id/clone

Clones an existing connection. This is done by opening a new connection using the credentials and configuration from the given connection.

Request Parameters

This endpoint supports the same request parameters as the POST /v1/sql endpoint.

Response

The response is identical to the one in the POST /v1/sql endpoint. In addition, this endpoint can return the following responses.

Connection is already in use:

Status: 503 Service Unavailable

Missing or invalid connection token:

Status: 400 Bad Request

Execute SQL query

POST /v1/sql/:id/queries

The request body must be a JSON object with the value of the sql field set to the SQL to be executed:

{
    "sql": "SELECT * FROM test.t1",
    "max_rows": 1000
}

The request body must be a JSON object consisting of the following fields:

  • sql

  • The SQL to be executed. If the SQL contain multiple statements, multiple results are returned in the response body.

  • max_rows

  • The maximum number of rows returned in the response. By default this is 1000 rows. Setting the value to 0 means no limit. Any extra rows in the result will be discarded.

By default, the complete result is returned in the response body. If the SQL query returns more than one result, the results array will contain all the results. If the async=true request option is used, the query is queued for execution.

The results array can have three types of objects: resultsets, errors, and OK responses.

  • A resultset consists of the data field with the result data stored as a two dimensional array. The names of the fields are stored in an array in thefields field and the field types and other metadata are stored in themetadata field. These types of results will be returned for any operation that returns rows (i.e. SELECT statements)

{
    "data": {
        "attributes": {
            "execution_time": 0.00028492799999999999,
            "results": [
                {
                    "complete": true,
                    "data": [
                        [
                            1
                        ],
                        [
                            2
                        ],
                        [
                            3
                        ]
                    ],
                    "fields": [
                        "id"
                    ],
                    "metadata": [
                        {
                            "catalog": "def",
                            "decimals": 0,
                            "length": 11,
                            "name": "id",
                            "schema": "test",
                            "table": "t1",
                            "type": "LONG"
                        }
                    ]
                }
            ],
            "sql": "SELECT id FROM test.t1"
        },
        "id": "b7243d92-5bc6-4814-80fb-6772831ead4b.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/b7243d92-5bc6-4814-80fb-6772831ead4b/queries/b7243d92-5bc6-4814-80fb-6772831ead4b.1/"
    }
}
  • An error consists of an object with the errno field set to the MariaDB error code, the message field set to the human-readable error message and thesqlstate field set to the current SQLSTATE of the connection.

{
    "data": {
        "attributes": {
            "execution_time": 0.00012686699999999999,
            "results": [
                {
                    "errno": 1064,
                    "message": "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TABLE test.t1' at line 1",
                    "sqlstate": "42000"
                }
            ],
            "sql": "SELECT syntax_error FROM TABLE test.t1"
        },
        "id": "621bacd9-48fd-436c-afda-b4e4d0d7b228.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/621bacd9-48fd-436c-afda-b4e4d0d7b228/queries/621bacd9-48fd-436c-afda-b4e4d0d7b228.1/"
    }
}
  • An OK response is returned for any result that completes successfully but not return rows (e.g. an INSERT or UPDATE statement). The affected_rows field contains the number of rows affected by the operation, thelast_insert_id contains the auto-generated ID and the warnings field contains the number of warnings raised by the operation.

{
    "data": {
        "attributes": {
            "execution_time": 0.000474659,
            "results": [
                {
                    "affected_rows": 0,
                    "last_insert_id": 0,
                    "warnings": 0
                }
            ],
            "sql": "CREATE TABLE test.my_table(id INT)"
        },
        "id": "60005d40-c034-4aa3-94de-b15c14d9c91c.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/60005d40-c034-4aa3-94de-b15c14d9c91c/queries/60005d40-c034-4aa3-94de-b15c14d9c91c.1/"
    }
}

It is also possible for the fields of the error response to be present in the resultset response if the result ended with an error but still generated some data. Usually this happens when query execution is interrupted but a partial result was generated by the server.

Request Parameters

  • async

  • If set to true, the query is queued for asynchronous execution and the results must be retrieved later from the URL stored in links.self field of the response. The HTTP response code is set to HTTP 202 Accepted if the query was successfully queued for execution.

Response

Query successfully executed:

Status: 201 Created

{
    "data": {
        "attributes": {
            "execution_time": 0.00014767200000000001,
            "results": [
                {
                    "complete": true,
                    "data": [
                        [
                            1
                        ]
                    ],
                    "fields": [
                        "1"
                    ],
                    "metadata": [
                        {
                            "catalog": "def",
                            "decimals": 0,
                            "length": 1,
                            "name": "1",
                            "schema": "",
                            "table": "",
                            "type": "LONG"
                        }
                    ]
                }
            ],
            "sql": "SELECT 1"
        },
        "id": "5999b711-d190-4f0e-8322-db3ce3bd97a2.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/5999b711-d190-4f0e-8322-db3ce3bd97a2/queries/5999b711-d190-4f0e-8322-db3ce3bd97a2.1/"
    }
}

Query queued for execution:

Status: 202 Accepted

{
    "data": {
        "attributes": {
            "execution_time": 0.0,
            "sql": "SELECT 1"
        },
        "id": "3d23f7e0-6a83-4282-94a5-8a1089d56f72.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/3d23f7e0-6a83-4282-94a5-8a1089d56f72/queries/3d23f7e0-6a83-4282-94a5-8a1089d56f72.1/"
    }
}

Invalid payload or missing connection token:

Status: 400 Bad Request

Fatal connection error:

Status: 503 Service Unavailable

  • If the API returns this response, the connection to the database server was lost. The only valid action to take at this point is to close it with theDELETE /v1/sql/:id endpoint.

Get Asynchronous Query Results

GET /v1/sql/:id/queries/:query_id

The results are only available if a POST /v1/sql/:id/queries was executed with the async field set to true. The result of any asynchronous query can be read multiple times. Only the latest result is stored: executing a new query will cause the latest result to be erased. Results can be explicitly erased with a DELETE request.

Response

Query successfully executed:

Status: 201 Created

{
    "data": {
        "attributes": {
            "execution_time": 0.00011945,
            "results": [
                {
                    "complete": true,
                    "data": [
                        [
                            1
                        ]
                    ],
                    "fields": [
                        "1"
                    ],
                    "metadata": [
                        {
                            "catalog": "def",
                            "decimals": 0,
                            "length": 1,
                            "name": "1",
                            "schema": "",
                            "table": "",
                            "type": "LONG"
                        }
                    ]
                }
            ],
            "sql": "SELECT 1"
        },
        "id": "63ec5e96-2bfa-40a9-b631-425b4e3e993c.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/63ec5e96-2bfa-40a9-b631-425b4e3e993c/queries/63ec5e96-2bfa-40a9-b631-425b4e3e993c.1/"
    }
}

Query not yet complete:

Status: 202 Accepted

No asynchronous results expected, invalid payload or missing connection token:

Status: 400 Bad Request

Fatal connection error:

Status: 503 Service Unavailable

  • If the API returns this response, the connection to the database server was lost. The only valid action to take at this point is to close it with theDELETE /v1/sql/:id endpoint.

Erase Asynchronous Query Results

DELETE /v1/sql/:id/queries/:query_id

Erases the latest result of an asynchronously executed query. All asynchronous results are erased when the connection that owns them is closed.

Response

Result erased:

Status: 200 OK

Connection is busy or it was not found:

Status: 503 Service Unavailable

Missing connection token:

Status: 400 Bad Request

Cancel a Query

POST /v1/sql/:id/cancel

This endpoint cancels the current query being executed by this connection. If no query is being done and the connection is idle, no action is taken.

If the connection is busy but it is not executing a query, an attempt to cancel is still made: in this case the results of this operation are undefined for ODBC connections, for MariaDB connections this will cause a KILL QUERY command to be executed.

Response

Query was canceled:

Status: 200 OK

Connection was not found:

Status: 503 Service Unavailable

Missing connection token:

Status: 400 Bad Request

List ODBC Drivers

GET /v1/sql/odbc/drivers

Get the list of configured ODBC drivers found by the driver manager. The list of drivers includes all drivers known to the driver manager for which an installed library was found (i.e. Driver or Driver64 in /etc/odbcinst.ini points to a file).

Response

The response contains a resource collection with all available drivers.

Status: 200 OK

{
    "data": [
        {
            "attributes": {
                "description": "ODBC for MariaDB",
                "driver": "/usr/lib/libmaodbc.so",
                "driver64": "/usr/lib64/libmaodbc.so",
                "fileusage": "1"
            },
            "id": "MariaDB",
            "type": "drivers"
        }
    ],
    "links": {
        "self": "http://localhost:8989/v1/sql/odbc/drivers/"
    }
}

Prepare ETL Operation

POST /v1/sql/:id/etl/prepare

The ETL operation requires two connections: an ODBC connection to a remote server (source connection) and a connection to a server in MaxScale (destination connection). All ETL operations must be done on the ODBC connection.

The ETL operations require that the MariaDB ODBC driver is installed on the MaxScale server. This driver is often available in the package manager of your operating system but it can also be downloaded from the MariaDB website.

The request body must be a JSON object consisting of the following fields:

  • target

The target connection ID that defines the destination server. This must be the ID of a connection (i.e. data.attributes.id ) to a server in MaxScale created via the POST /v1/sql/ endpoint.

  • type

The type of the ETL data source. The value must be a string with one of the following values:

- `mariadb`

  Extract data from a MariaDB database.

- `postgresql`

  Extract data from a PostgreSQL database. This requires that the PostgreSQL
  ODBC driver is installed on the MaxScale server. This driver is often
  available in the package manager of your operating system.

- `generic`

  Extract data from a generic ODBC source. This uses the ODBC catalog
  functions to determine the table layout. The results provided by this are
  not as accurate as the specialized versions but it can serve as a good
  starting point from which manual modifications to the SQL can be done.

  This ETL type requires that the table catalog is provided at the top level
  with the `catalog` field. The meaning of the catalog differs between
  database implementations.
  • tables

An array of objects, each of which must define a table and a schema field. The table field defines the name of the table to be imported and theschema field defines the schema it is in. If the objects contain a value forcreate, select or insert, the SQL generation for that part is skipped.

  • connection_string

Extra connection string that is appended to the destination server's connection string. This connection will always use the MariaDB ODBC driver. The list of supported options can be foundhere.

  • threads

The number of parallel connections used during the ETL operation. By default the ETL operation will use up to 16 connections.

  • timeout

The connection and query timeout in seconds. By default a timeout of 30 seconds is used.

  • create_mode

A string with either normal, ignore or replace which controls how tables are handled that already exist on the destination server.

If left undefined or set to normal, the tables are created using a normalCREATE TABLE statement. This will cause an error to be reported if the table already exist and will prevent the ETL from proceeding past the object creation stage.

If set to ignore the tables are created with CREATE TABLE IF NOT EXISTS which will ignore any existing tables and assume that they are compatible with the rest of the ETL operation. This mode can be used to continuously load data from an external source into MariaDB.

If set to replace, the tables are created with CREATE OR REPLACE TABLE which will cause existing tables to be dropped if they exist. This is not a reversible process so caution should be taken when this mode is used.

  • catalog

The catalog for the tables. This is only used when type is set togeneric. In all other cases this value is ignored.

Here is an example payload that prepares the table test.t1 for extraction from a MariaDB server.

{
  "type": "mariadb",
  "target": "e2a56d2f-6514-4926-8dba-dca0c4ae3a86",
  "tables": [
    {
      "table": "t1",
      "schema": "test"
    }
  ]
}

The token for the source connection is provided the same way it is provided for all other /v1/sql endpoints: in the token request parameter or in the cookies. The destination connection token is provided either in the target_token request parameter or as a cookie.

Request Parameters

This endpoints supports the following additional request parameters.

  • target_token

  • The connection token for the destination connection. If provided, the value is unconditionally used even if a cookie with a valid token exists for the destination connection.

Response

ETL operation prepared:

Status: 202 Accepted

Once complete, the /v1/sql/:id/queries/:query_id endpoint will return the following result.

{
    "data": {
        "attributes": {
            "execution_time": 0.0062226729999999997,
            "results": {
                "ok": true,
                "stage": "prepare",
                "tables": [
                    {
                        "create": "CREATE DATABASE IF NOT EXISTS `test`;\nUSE `test`;\nCREATE TABLE `t1` (\n  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n  `data` varchar(255) DEFAULT NULL,\n  UNIQUE KEY `id` (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci",
                        "insert": "INSERT INTO `test`.`t1` (`id`,`data`) VALUES (?,?)",
                        "schema": "test",
                        "select": "SELECT `id`,`data` FROM `test`.`t1`",
                        "table": "t1"
                    }
                ]
            },
            "sql": "ETL"
        },
        "id": "31dc09b7-ec09-4e6d-b098-e925f706233c.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/31dc09b7-ec09-4e6d-b098-e925f706233c/queries/31dc09b7-ec09-4e6d-b098-e925f706233c.1/"
    }
}

Invalid payload or missing connection token:

Status: 400 Bad Request

Start ETL Operation

POST /v1/sql/:id/etl/start

The behavior of this endpoint is identical to the preparation but instead of preparing the operation, this endpoint will execute the prepared ETL and load the data into MariaDB.

The intended way of doing an ETL operation is to first prepare it using the/v1/sql/:id/etl/prepare endpoint to retrieve the SQL statements that define the ETL operation. Then if the ETL preparation is successful, thedata.attributes.results.tables value from the response is used as the tables value for the ETL start operation, done on the /v1/sql/:id/etl/start endpoint.

If any of the create, select or insert fields for a table in the tables list have not been defined, the SQL will be automatically generated by querying the source server, similarly to how the preparation generates the SQL statements. This means that the preparation step is optional if there is no need to adjust the automatically generated SQL.

The ETL operation can be canceled using the /v1/sql/:id/cancel endpoint which will roll back the ETL operation. Any tables that were created during the ETL operation are not deleted on the destination server and must be manually cleaned up.

If the ETL fails to extract the SQL from the source server or an error was encountered during table creation, the response will have the "ok" field set to false. Both the top-level object as well as the individual tables can have the "error" field set to the error message. This field is filled during the ETL operation which means errors are visible even if the ETL is still ongoing.

During the ETL operation, tables that have been fully processed will have a"execution_time" field. This field has the total time in seconds it took to execute the data loading step.

Response

ETL operation started:

Status: 202 Accepted

Once complete, the /v1/sql/:id/queries/:query_id endpoint will return the following result.

{
    "data": {
        "attributes": {
            "execution_time": 0.0094386039999999997,
            "results": {
                "ok": true,
                "stage": "load",
                "tables": [
                    {
                        "create": "CREATE DATABASE IF NOT EXISTS `test`;\nUSE `test`;\nCREATE TABLE `t1` (\n  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n  `data` varchar(255) DEFAULT NULL,\n  UNIQUE KEY `id` (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci",
                        "execution_time": 0.0033923809999999999,
                        "insert": "INSERT INTO `test`.`t1` (`id`,`data`) VALUES (?,?)",
                        "rows": 1,
                        "schema": "test",
                        "select": "SELECT `id`,`data` FROM `test`.`t1`",
                        "table": "t1"
                    }
                ]
            },
            "sql": "ETL"
        },
        "id": "1391b67e-58a7-4be3-b686-2498cb3a0e06.1",
        "type": "queries"
    },
    "links": {
        "self": "http://localhost:8989/v1/sql/1391b67e-58a7-4be3-b686-2498cb3a0e06/queries/1391b67e-58a7-4be3-b686-2498cb3a0e06.1/"
    }
}

Invalid payload or missing connection token:

Status: 400 Bad Request

This page is licensed: CC BY-SA / Gnu FDL