Removing a Server using MaxCtrl

When operating MariaDB MaxScale in dynamic environments—such as Kubernetes, where nodes are frequently provisioned and deleted—it is critical to cleanly remove decommissioned servers from your MaxScale configuration. To delete a server using maxctrl, one has to unlink the server from any services or monitors beforehand. This step-by-step guide walks you through the safe removal process, following the recommended teardown sequence: Listener ➔ Service ➔ Monitor ➔ Server.

triangle-exclamation
1

Destroy the Listener (If Applicable)

If your setup utilizes a dedicated listener that must be removed alongside the server, you must destroy the listener first.

  • Destroying a listener closes the listening socket, opening it up for immediate reuse.

  • If two arguments are given and they are a service and a listener, the listener is only destroyed if it is for the given service.

maxctrl destroy listener \
   Round-Robin-Service \
   Round-Robin-Listener
2

Next, the server object for the node must be unlinked from the service.

  • This command unlinks targets from a service, removing them from the list of available targets for that service.

  • Unlink the server object from the service using the unlink service command.

maxctrl unlink service \
   Round-Robin-Service \
   mariadbgalera3
  • Confirm that the server object was properly unlinked from the service

maxctrl show services
3

The server object for the node must now be unlinked from its health monitor.

  • This command unlinks servers from a monitor, removing them from the list of monitored servers.

  • Unlink a server object from the monitor using the unlink monitor command.

maxctrl unlink monitor \
   MariaDB-Monitor \
   mariadbgalera3
  • Confirm that the server object was properly unlinked from the monitor

maxctrl show monitors
4

Destroy the Server in MaxScale

Finally, the server object for the node must be removed from MaxScale.

  • The server must be unlinked from all services and monitor before it can be destroyed.

  • Remove the server object using the destroy server command.

maxctrl destroy server \
   mariadbgalera3
  • Confirm that the server object was properly removed

maxctrl show servers

Last updated

Was this helpful?