[MXS-1528] Remove server as well from the maxadmin list servers Created: 2017-11-16  Updated: 2017-12-01  Resolved: 2017-11-17

Status: Closed
Project: MariaDB MaxScale
Component/s: N/A
Affects Version/s: None
Fix Version/s: N/A

Type: New Feature Priority: Minor
Reporter: Wagner Bianchi (Inactive) Assignee: Unassigned
Resolution: Done Votes: 1
Labels: None


 Description   

Folks,

Testing the remove server command I'm seeing that, the removed server will only appear if you check the servers under the monitor from which you removed the server if you issue the command show monitors.

The whole story is like this - the environment was created based on the https://jira.mariadb.org/browse/MXS-1526. This way, I have 1 master and 2 replicas. I removed one replica and relied on what I was seeing out of list servers:

[root@maxscale maxscale.cnf.d]# maxadmin list monitors
---------------------+---------------------
Monitor              | Status
---------------------+---------------------
cluster-monitor      | Running
---------------------+---------------------
[root@maxscale maxscale.cnf.d]# maxadmin list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status
-------------------+-----------------+-------+-------------+--------------------
prod_mariadb01     | 192.168.50.11   |  3306 |           0 | Master, Running
prod_mariadb02     | 192.168.50.12   |  3306 |           0 | Slave, Running
prod_mariadb03     | 192.168.50.13   |  3306 |           0 | Slave, Running
-------------------+-----------------+-------+-------------+--------------------
[root@maxscale maxscale.cnf.d]# maxadmin remove server prod_mariadb03 cluster-monitor
Removed server 'prod_mariadb03' from 'cluster-monitor'
[root@maxscale maxscale.cnf.d]# ls -lh
total 24K
-rw-r--r-- 1 root root 236 Nov 16 17:05 cluster-monitor.cnf
-rw-r--r-- 1 root root 114 Nov 16 12:48 prod_mariadb01.cnf
-rw-r--r-- 1 root root 114 Nov 16 12:48 prod_mariadb02.cnf
-rw-r--r-- 1 root root 114 Nov 16 12:48 prod_mariadb03.cnf
-rw-r--r-- 1 root root 128 Nov 16 14:19 rwsplit-listener.cnf
-rw-r--r-- 1 root root 100 Nov 16 16:02 rwsplit-service.cnf
[root@maxscale maxscale.cnf.d]# cat prod_mariadb03.cnf
[prod_mariadb03]
type=server
protocol=MySQLBackend
address=192.168.50.13
port=3306
authenticator=MySQLBackendAuth
[root@maxscale maxscale.cnf.d]# maxadmin list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status
-------------------+-----------------+-------+-------------+--------------------
prod_mariadb01     | 192.168.50.11   |  3306 |           0 | Master, Running
prod_mariadb02     | 192.168.50.12   |  3306 |           0 | Slave, Running
prod_mariadb03     | 192.168.50.13   |  3306 |           0 | Slave, Running
-------------------+-----------------+-------+-------------+--------------------

As you can see, the server prod_mariadb02 is kept out of the list of servers and the configuration file as well is kept in place. This is great as it makes it easy to re-add the server you just removed in case you need.

The request, maybe we can add a flag on the server's configuration file in order to make servers active=0|1 and then, removed servers update the server's file in order to remove that server from the list servers, what do you think?

Kind of:

[root@maxscale maxscale.cnf.d]# cat prod_mariadb03.cnf
[prod_mariadb03]
type=server
protocol=MySQLBackend
address=192.168.50.13
port=3306
authenticator=MySQLBackendAuth
active=0

Now and currently, removed servers is going to be noticed as removed just out of show monitors:

[root@maxscale maxscale.cnf.d]# maxadmin show monitors
Monitor:           0x22bd9c0
Name:              cluster-monitor
State:             Running
Sampling interval: 10000 milliseconds
Connect Timeout:   3 seconds
Read Timeout:      1 seconds
Write Timeout:     2 seconds
Monitored servers: [192.168.50.11]:3306, [192.168.50.12]:3306
MaxScale MonitorId:	0
Replication lag:	disabled
Detect Stale Master:	enabled
Server information
 
Server: prod_mariadb01
Server ID: 1
Read only: OFF
Slave configured: NO
Slave IO running: NO
Slave SQL running: NO
Master ID: -1
Master binlog file:
Master binlog position: 0
 
Server: prod_mariadb02
Server ID: 2
Read only: OFF
Slave configured: YES
Slave IO running: YES
Slave SQL running: YES
Master ID: 1
Master binlog file: box01-bin.000021
Master binlog position: 2482235
 



 Comments   
Comment by markus makela [ 2017-11-17 ]

The maxadmin destroy server command implements this.

Comment by Wagner Bianchi (Inactive) [ 2017-11-17 ]

It makes complete sense Markus, thanks for the feedback.

Generated at Thu Feb 08 04:07:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.