Merge branch 'develop' into blr_mariadb10
This commit is contained in:
commit
69dd1a5935
@ -21,7 +21,9 @@ Last Updated: 12th March 2015
|
||||
|
||||
# MaxScale Requirements
|
||||
|
||||
MaxScale must be configured with 'maxscaled' protocol for the administration interface
|
||||
MaxScale must be configured with 'maxscaled' protocol for the administration interface:
|
||||
|
||||
Example of MaxScale.cnf file:
|
||||
|
||||
[AdminInterface]
|
||||
type=service
|
||||
@ -35,7 +37,7 @@ MaxScale must be configured with 'maxscaled' protocol for the administration int
|
||||
|
||||
## Prepare Nagios configuration files.
|
||||
|
||||
Assuming plugins are in /usr/lib64/nagios/plugins and Nagios configuration in /etc/nagios:
|
||||
Assuming Nagios installed in its on server and the plugins are in /usr/lib64/nagios/plugins and configuration files are in /etc/nagios:
|
||||
|
||||
* Copy ./nagios/plugins/check_maxscale_*.pl under /usr/lib64/nagios/plugins
|
||||
* Copy ./nagios/plugins/maxscale_commands.cfg and server1.cfg to /etc/nagios/objects/
|
||||
@ -49,9 +51,10 @@ and add (just after localhost.cfg or commnads.cfg)
|
||||
### Please note:
|
||||
- modify server IP address in server1.cfg, pointing to MaxScale server
|
||||
- maxadmin executable must be in the nagios server
|
||||
- default AdminInterface port is 6603
|
||||
- default MaxScale AdminInterface port is 6603
|
||||
- default maxadmin executable path is /usr/local/skysql/maxscale/bin/maxadmin
|
||||
It can be changed by -m option
|
||||
- maxadmin executable could be copied from an existing maxscale setup (default location is /usr/local/skysql/maxscale/bin/maxadmin)
|
||||
|
||||
Example related to server1.cfg
|
||||
|
||||
|
@ -416,8 +416,6 @@ int query_len;
|
||||
else if (strcasecmp(word, "ALL") == 0)
|
||||
{
|
||||
free(query_text);
|
||||
spinlock_release(&router->lock);
|
||||
|
||||
return blr_slave_disconnect_all(router, slave);
|
||||
}
|
||||
else if (strcasecmp(word, "SERVER") == 0)
|
||||
@ -1893,21 +1891,23 @@ char serverid[40];
|
||||
uint8_t *ptr;
|
||||
int len, id_len, seqno = 2;
|
||||
|
||||
blr_slave_send_fieldcount(router, slave, 2);
|
||||
blr_slave_send_columndef(router, slave, "server_id", 0x03, 40, seqno++);
|
||||
blr_slave_send_columndef(router, slave, "state", 0xf, 40, seqno++);
|
||||
blr_slave_send_eof(router, slave, seqno++);
|
||||
|
||||
sprintf(serverid, "%d", server_id);
|
||||
id_len = strlen(serverid);
|
||||
if (found)
|
||||
strcpy(state, "disconnected");
|
||||
else
|
||||
strcpy(state, "not found");
|
||||
|
||||
id_len = strlen(serverid);
|
||||
len = 5 + id_len + strlen(state) + 1;
|
||||
|
||||
if ((pkt = gwbuf_alloc(len)) == NULL)
|
||||
return 0;
|
||||
|
||||
blr_slave_send_fieldcount(router, slave, 2);
|
||||
blr_slave_send_columndef(router, slave, "server_id", 0x03, 40, seqno++);
|
||||
blr_slave_send_columndef(router, slave, "state", 0xf, 40, seqno++);
|
||||
blr_slave_send_eof(router, slave, seqno++);
|
||||
|
||||
ptr = GWBUF_DATA(pkt);
|
||||
encode_value(ptr, id_len + 2 + strlen(state), 24); // Add length of data packet
|
||||
ptr += 3;
|
||||
@ -1955,9 +1955,12 @@ blr_slave_disconnect_server(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, int se
|
||||
{
|
||||
/* server_id found */
|
||||
server_found = 1;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "DISCONNECT SERVER: closing [%s], server id [%d]",
|
||||
sptr->dcb->remote, server_id)));
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "%s: Slave %s, server id %d, disconnected by %s@%s",
|
||||
router->service->name,
|
||||
sptr->dcb->remote,
|
||||
server_id,
|
||||
slave->dcb->user,
|
||||
slave->dcb->remote)));
|
||||
|
||||
/* send server_id with disconnect state to client */
|
||||
n = blr_slave_send_disconnected_server(router, slave, server_id, 1);
|
||||
@ -1981,7 +1984,15 @@ blr_slave_disconnect_server(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, int se
|
||||
n = blr_slave_send_disconnected_server(router, slave, server_id, 0);
|
||||
}
|
||||
|
||||
return n;
|
||||
if (n == 0) {
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR, "Error: gwbuf memory allocation in "
|
||||
"DISCONNECT SERVER server_id [%d]",
|
||||
sptr->serverid)));
|
||||
|
||||
blr_slave_send_error(router, slave, "Memory allocation error for DISCONNECT SERVER");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2019,13 +2030,11 @@ blr_slave_disconnect_all(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave)
|
||||
/* skip servers with state = 0 */
|
||||
if (sptr->state != 0)
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "DISCONNECT ALL: closing [%s], server_id [%d]",
|
||||
sptr->dcb->remote, sptr->serverid)));
|
||||
|
||||
sprintf(server_id, "%d", sptr->serverid);
|
||||
sprintf(state, "disconnected");
|
||||
|
||||
len = 5 + strlen(server_id) + strlen(state) + 1;
|
||||
|
||||
if ((pkt = gwbuf_alloc(len)) == NULL) {
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR, "Error: gwbuf memory allocation in "
|
||||
"DISCONNECT ALL for [%s], server_id [%d]",
|
||||
@ -2033,9 +2042,15 @@ blr_slave_disconnect_all(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave)
|
||||
|
||||
spinlock_release(&router->lock);
|
||||
|
||||
blr_slave_send_error(router, slave, "Memory allocation error for DISCONNECT ALL");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "%s: Slave %s, server id %d, disconnected by %s@%s",
|
||||
router->service->name,
|
||||
sptr->dcb->remote, sptr->serverid, slave->dcb->user, slave->dcb->remote)));
|
||||
|
||||
ptr = GWBUF_DATA(pkt);
|
||||
encode_value(ptr, len - 4, 24); // Add length of data packet
|
||||
|
||||
@ -2090,4 +2105,4 @@ uint8_t *ptr;
|
||||
*ptr++ = 0;
|
||||
*ptr++ = 0;
|
||||
return slave->dcb->func.write(slave->dcb, pkt);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user