-1

I'm using mysql with cluster, so I have 1 node active (master) and the other node is slave.

In mysql utilities package, I know how to get status for each node using the command below:

mysqlrpladmin --master=root@localhost:3333 \
-- slaves=root@localhost:3332,root@localhost:3334 health

But I need help getting the status of the node via Java code. I think I need to connect to specific node and "ask" the node about this status.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
shirel
  • 91
  • 1
  • 1
  • 6

1 Answers1

1

Connect to the slave and send the SHOW SLAVE STATUS query.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • So make the query using the Java MySQL connector. – Barmar Sep 07 '17 at 20:46
  • thanks, i know it, you speak on this: connection.createStatement().executeQuery("SHOW SLAVE HOSTS") ) but the result is so low level, i want the summery like the tool give me. host | port | role | state | gtid_mode | health | +------------+-------+---------+--------+------------+---------+ | localhost | 3333 | MASTER | UP | ON | OK – shirel Sep 07 '17 at 20:47
  • It doesn't look like there's anything like that, I guess the tool is performing this query and then reformatting the data. – Barmar Sep 07 '17 at 20:53
  • Thanks a lot for your answer! , I hope that I'll find something. – shirel Sep 07 '17 at 20:55