WL#12816: REST endpoints for routes

Affects: Server-8.0   —   Status: Complete

Motivation

Understanding when the configured limits like max_connections are reached in the MySQL Router is currently not possible.

These datapoints can be exposed through the REST interface of the Router (WL#8965)

Design Requirements

DR1
MUST support InnoDB Cluster deployments
DR2
MUST support deployments with static routing

Functional Requirement

FR1
Configuration of each route of the routing plugin MUST be exposed via GET as JSON.
FR2
Status information of each route of the routing plugin MUST be exposed via GET as JSON.
FR3
The structure of all responses MUST be defined in an openapi.json file.
FR4
Blocked Hosts of each route of the routing plugin MUST be exposed via a REST endpoint.
FR5
List of all the current potential destination nodes of each route of the routing plugin MUST be exposed via a REST endpoint.
FR6
List of all the active connections of each route of the routing plugin MUST be exposed via a REST endpoint.

Implementation

  • add a new plugin rest_routing
    • depends on routing component running
    • depends on rest_api component running (WL#8965)

Configuration Options

  • require_realm, string, name of an authentication realm

Interface Spec

<base>/routes

GET /routes returns the names of the routes the MySQL Router supports as JSON object.

  • object,
    • items, array
    • string, name of route

They match the names of the [routing:...] sections in the configuration file.

<base>/routes/{routeName}/config

GET /routes/{routeName}/config returns the configuration of the route if {routeName} matches one of the known routes.

  • object
    • bindAddress, string, address route is listening on,
    • bindPort, integer, TCP port router is linstening on
    • clientConnectTimeout, integer, connect timeout for incoming connections in seconds
    • destinationConnectTimeout, integer, connect timeout for outgoing connections in seconds
    • maxActiveConnections, integer, max active connections
    • maxConnectErrors, integer, max number of adjacent connect errors before a client gets blocked.
    • mode, optional, string, enum("read-write", "read-only")
    • protocol, string, enum("classic", "x")
    • routingStrategy, optional, string, enum("round-robin", "round-robin-with-fallback", "first-available", "next-available")
    • socket, optional, string, listening socket/named pipe

/routes/{routeName}/status

GET /routes/{routeName}/status returns status information about the named route.

  • object
    • totalConnections, integer, number of connections handled by this route
    • activeConnections, integer, currently active connections on this route
    • blockedHosts, integer, count of blocked hosts

/routing/{routeName}/blockedHosts

GET /routes/{routeName}/blockedHosts returns:

  • object
    • items, array
    • string, ip-address that is currently blocked by the routing core.

/routing/{routeName}/destinations

GET /routes/{routeName}/destinations returns:

  • object
    • items, array
    • address, string, IP address of the destination node
    • port, integer, port of the destination node

/routing/{routeName}/connections

GET /routes/{routeName}/connections returns:

  • object
    • items, array
    • bytesFromServer, integer, number of bytes sent from the server to the client over the given connection
    • bytesToServer, integer, number of bytes sent from the client to the server over the given connection
    • sourceAddress, string, adddress:port pair of the connection source (client)
    • destinationAddress, string, adddress:port pair of the connection destination (server)
    • timeStarted, string, timepoint of the connection initialization
    • timeConnectedToServer, string, timepoint when the connection successfully established
    • timeLastSentToServer, string, timepoint when there was last data sent from client to server on the given connection
    • timeLastReceivedFromServer, string, timepoint when there was last data sent from server to client on the given connection