WL#11891: HTTP component to MySQL Router

Affects: Server-8.0   —   Status: Complete


For integration with external tools for

  • healthcheck
  • monitoring
  • management
  • ...

MySQL Router needs interface that is:

  • easy to interface with for applications
  • easy to use for users

In principle the MySQL Protocol could be used for this task, but the HTTP protocol fits the needs of this task better.


Using HTTP as underlying protocol allows to:

  • encrypt the traffic with TLS
  • authorize the users
  • allow to use existing tools and frameworks tested and validated by the web community to

    • easily interface with browsers for user-interfaces
    • easily expose REST endpoints to applications (document with tools like https://swagger.io/)


Add a tiny HTTP server library to MySQL Router to allow to expose REST endpoints and a web-interface.


communication MUST be encrypted by default
it MUST be possible to limit access to authenticated users
it MUST be possible to deliver data for humans
it MUST be possible to deliver machine parsable data

Protocol Evaluation

There are several option on how to expose monitoring information:

  • a SQL based interface over MySQL classic or xprotocol
  • a REST based interface based on HTTP and JSON

Both allow to:

  • provide secure access (authentication)
  • encrypted transportation (TLS)
  • compression if needed


The HTTP protocol server implementation can be taken from

  • libevent's HTTP library

which is already part of the Routers dependencies.

Session State

One of the differentiators between HTTP and MySQL protocols is statefulness:

  • HTTP is stateless
  • MySQL protocols are stateful


As state isn't needed, going with HTTP opens many interesting options down the road:

  • a integrated, browser based internal live reporting interface
  • simple administration via HTTP CRUD operations
  • simple integration the typical user, web-environment


http_server module

http_server module provides:

  • APIs for other plugins to register and unregister URL routes
  • HTTP handling


config-section: http_server


IPv4 address to bind to for "port". Default:
TCP port to listen for HTTP requests on. Default: 8081
base directory for static file requests. Default: empty. If empty, no static files will served.


Using libevent's HTTP component

removes the need to write a HTTP server library. libevent is already a dependency of the MySQL Router.