[MXS-476] maxscale [mysql monitor] / infinidb [mysql cluster replication] Created: 2015-11-16  Updated: 2015-11-24  Resolved: 2015-11-24

Status: Closed
Project: MariaDB MaxScale
Component/s: mariadbmon
Affects Version/s: 1.4.0
Fix Version/s: 1.2.1

Type: Bug Priority: Major
Reporter: way Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Debian Jessie 8.2
Maxscale 1.2.1



 Description   

Hi,

I tried to setup mysql monitor from maxscale on mysql replication on 3 infinidb nodes (master/slave/slave) but I have this error :

 Error : No Master can be determined

As you can see, my replication is up on master/slaves and from maxscale mysql monitor host I can connect to all dbs nodes :

 
mysql -hum1 -umaxscalerepl -pmaxscalepass -e "show slave status"
mysql -hum2 -umaxscalerepl -pmaxscalepass -e "show slave status"
mysql -hum3 -umaxscalerepl -pmaxscalepass -e "show slave status"
...
 
| Waiting for master to send event | 192.168.56.10 | idbrep      |        3306 |            60 | mysql-bin.000010 |                1078 | relay-bin.000003 |           251 | mysql-bin.000010      | Yes              | Yes               |                 |                     |                    |                        |                         |                             |          0 |            |            0 |                1078 |             545 | None            |                |             0 | No                 |                    |                    |                 |                   |                |                     0 | No                            |             0 |               |              0 |                |
 
...

Here my configuration :

 
[maxscale]
threads=3
log_trace=1
 
[um1]
type=server
address=192.168.56.10
port=3306
protocol=MySQLBackend
 
[um2]
type=server
address=192.168.56.12
port=3306
protocol=MySQLBackend
 
[um3]
type=server
address=192.168.56.17
port=3306
protocol=MySQLBackend
 
[MySQL Monitor]
mysql51_replication=true
type=monitor
module=mysqlmon
servers=um1,um2,um3
user=maxscalerepl
passwd=maxscalepass
monitor_interval=10000
 
[RWSplitRouter]
type=service
router=readwritesplit
servers=um1,um2,um3
user=maxscalerepl
passwd=maxscalepass
 
[RWSplitListener]
type=listener
service=RWSplitRouter
protocol=MySQLClient
port=3306

and ouput from maxadmin how servers :

Server 0x3676ae0 (um1)
	Server:				192.168.56.10
	Status:               		Running
	Protocol:			MySQLBackend
	Port:				3306
	Server Version:			5.1.73-log
	Node Id:			1
	Master Id:			-1
	Slave Ids:
	Repl Depth:			-1
	Number of connections:		0
	Current no. of conns:		0
	Current no. of operations:	0
Server 0x36769d0 (um2)
	Server:				192.168.56.12
	Status:               		Slave, Running
	Protocol:			MySQLBackend
	Port:				3306
	Server Version:			5.1.73-log
	Node Id:			2
	Master Id:			-1
	Slave Ids:
	Repl Depth:			-1
	Number of connections:		0
	Current no. of conns:		0
	Current no. of operations:	0
Server 0x36768c0 (um3)
	Server:				192.168.56.17
	Status:               		Slave, Running
	Protocol:			MySQLBackend
	Port:				3306
	Server Version:			5.1.73-log
	Node Id:			3
	Master Id:			-1
	Slave Ids:
	Repl Depth:			-1
	Number of connections:		0
	Current no. of conns:		0
	Current no. of operations:	0

Where is the problem please ?



 Comments   
Comment by Dipti Joshi (Inactive) [ 2015-11-16 ]

no Of the three um1, um2 and um3 which one is master node ?

Comment by way [ 2015-11-16 ]

Hi Dipti Joshi,

Master is um1 and slaves are um2, um3, as you can see from maxscale mysqlmonioir node :

mysql -hum2 -umaxscalerepl -pmaxscalepass -e "show slave status\G"
...
                  Master_Host: 192.168.56.10 (um1)
                  Master_User: idbrep
                  Master_Port: 3306
...
 
mysql -hum3 -umaxscalerepl -pmaxscalepass -e "show slave status"
...
                  Master_Host: 192.168.56.10 (um1)
                  Master_User: idbrep
                  Master_Port: 3306
...

Comment by way [ 2015-11-16 ]

I've tried with official mysql server (version 5.5) from Jessie and all is ok :

Server 0x21a74b0 (mysql1)
	Server:				192.168.56.23
	Status:               		Master, Running
	Protocol:			MySQLBackend
	Port:				3306
	Server Version:			5.5.46-0+deb8u1-log
	Node Id:			1
	Master Id:			-1
	Slave Ids:			11, 12
	Repl Depth:			0
	Number of connections:		0
	Current no. of conns:		0
	Current no. of operations:	0
Server 0x21a73a0 (mysql2)
	Server:				192.168.56.21
	Status:               		Slave, Running
	Protocol:			MySQLBackend
	Port:				3306
	Server Version:			5.5.46-0+deb8u1-log
	Node Id:			11
	Master Id:			1
	Slave Ids:
	Repl Depth:			1
	Number of connections:		0
	Current no. of conns:		0
	Current no. of operations:	0
Server 0x21a7290 (mysql3)
	Server:				192.168.56.22
	Status:               		Slave, Running
	Protocol:			MySQLBackend
	Port:				3306
	Server Version:			5.5.46-0+deb8u1-log
	Node Id:			12
	Master Id:			1
	Slave Ids:
	Repl Depth:			1
	Number of connections:		0
	Current no. of conns:		0
	Current no. of operations:	0

Any issues with mysql version (5.1.73-log) from infinidb ?

Comment by way [ 2015-11-17 ]

Hi,

All right, I've found problem, look at monitor mysql module source code from maxscale, in my case, the last mysql version on infinidb is 5.1 so we need to enable "mysql51_replication=true" :

static MONITOR_SERVERS *build_mysql51_replication_tree(MONITOR *mon)
{
    MONITOR_SERVERS* database = mon->databases;
    MONITOR_SERVERS *ptr,*rval = NULL;
    int i;
    while(database)
    {
	bool ismaster = false;
	MYSQL_RES* result;
	MYSQL_ROW row;
	int nslaves = 0;
	if(database->con)
	{
	    if (mysql_query(database->con, "SHOW SLAVE HOSTS") == 0
	     && (result = mysql_store_result(database->con)) != NULL)
	    {
		if(mysql_field_count(database->con) < 4)
		{
		    mysql_free_result(result);
		    skygw_log_write_flush(LE,"Error: \"SHOW SLAVE HOSTS\" "
			    "returned less than the expected amount of columns. Expected 4 columns."
			    " MySQL Version: %s",version_str);
		    return NULL;
		}
 
		if(mysql_num_rows(result) > 0)
		{
		    ismaster = true;
		    while (nslaves < MONITOR_MAX_NUM_SLAVES && (row = mysql_fetch_row(result)))
		    {
			/* get Slave_IO_Running and Slave_SQL_Running values*/
			database->server->slaves[nslaves] = atol(row[0]);
			nslaves++;
			LOGIF(LD,(skygw_log_write_flush(LD,"Found slave at %s:%d",row[1],row[2])));
		    }
		    database->server->slaves[nslaves] = 0;
		}
 
		mysql_free_result(result);
	    }
 
	    
	    /* Set the Slave Role */
	    if (ismaster)
	    {
		LOGIF(LD,(skygw_log_write(LD,"Master server found at %s:%d with %d slaves",
					 database->server->name,
					 database->server->port,
					 nslaves)));
		monitor_set_pending_status(database, SERVER_MASTER);
		if(rval == NULL || rval->server->node_id > database->server->node_id)
		    rval = database;
	    }
	}
	database = database->next;
    }

As you can see "SHOW SLAVE HOSTS" is called to build the tree. Problem, (I think it's not a problem) is that this feature is not enabled by default in mysql 5.1, I think it's normal, this option is required for replication but we must to have warning from maxscale like "mysql51_replication", you can enable it from my.cnf or in command line argument "--report-host=server1"..

MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.10   |  3306 |           0 | Master, Running
server2            | 192.168.56.12   |  3306 |           0 | Slave, Running
server3            | 192.168.56.17   |  3306 |           0 | Slave, Running
-------------------+-----------------+-------+-------------+--------------------

tshuss.

Generated at Thu Feb 08 03:59:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.