WL#12441: REST endpoints for metadata-cache
Affects: Server-8.0
—
Status: Complete
Motivation
MySQL Router exposes monitoring data via REST endpoints.
The metadata-cache component of the router takes care of:
- querying the data from the metadata servers
- communicating with the routing component for
- liveness of group replication backends
- liveness of network connections
- maintains a cache of the metadata that is refreshed on trigger or TTL
User Stories
- As a tester I want to wait until metadata component has fetched data before sending traffic to the routing component to avoid false-positive test-results.
- As a devop I want to be able to configure a liveness test in the load-balancer to send only traffic to the router when it has valid metadata of the cluster.
Goal
Add REST endpoints for the metadata-cache that expose
- current known cluster nodes and their state
- success and failure counters
- time of last fetch
- current configuration
Function Requirements
- FR1
-
HTTP GET request to
<base>/metadata/{metadaName}/status
MUST return the cache status as JSON object - FR2
-
HTTP GET request to
<base>/metadata/{metadataName}/config
MUST return the configuration of the metadata cache - FR3
-
HTTP GET request to
<base>/metadata/
MUST return the list of configurated metadata caches.
Implementation
- add a new plugin
rest_metadata_cache
- depends on
metadata_cache
component running - depends on
rest_api
component running (WL#8965)
- depends on
Configuration Options
require_realm
, required, string, name of an authentication realm
rest_metadata_cache
metadata-list
- URL
-
<base>/metadata/
- Methods
- GET
- object
- items: array of objects
- name: string, name of metadata instance
cache-config
- URL
-
<base>/metadata/{metadataName}/config
- Methods
- GET
- object
- timeRefreshInMs number, ttl
- clusterName: string, optional, name of the Replication Group
- groupReplicationId: string, optional
- nodes: array of object:
- hostname: string
- port: integer
cache-status
- URL
-
<base>/metadata/{metadataName}/status
- Methods
- GET
- object
- refreshSucceeded: number (positive, integer)
- refreshFailed: number (positive, integer)
- timeLastRefreshSucceeded: string (date-time)
- timeLastRefreshFailed: string (date-time)
- lastRefreshHostname: string
- lastRefreshPort: integer
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.