31.07.2013 Views

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Administer <strong>MySQL</strong> <strong>Cluster</strong><br />

<strong>MySQL</strong> <strong>Cluster</strong> has a <strong>com</strong>mand line tool to talk directly to the management server to<br />

obtain information and execute basic functions. It also has a verbose logging system which<br />

can help diagnose many problems with the cluster.<br />

NDB_MGM<br />

A key tool for running basic administration tasks is ndb_mgm. This is a <strong>com</strong>mand line tool to<br />

send basic <strong>com</strong>mands to the cluster. It <strong>com</strong>municates to the management nodes using an<br />

unsecured port with no authentication (take note this should be done behind a firewall or<br />

private network).<br />

To invoke this tool simply run:<br />

shell> ndb_mgm<br />

If you are not running it locally to the management node then you will need to give it a<br />

connect string:<br />

shell> ndb_mgm --ndb-connectstring=192.168.1.10<br />

You can also execute a one-time <strong>com</strong>mand with this tool rather than getting a <strong>com</strong>mand<br />

prompt using:<br />

shell> ndb_mgm -e 'SHOW'<br />

Commands in ndb_mgm almost all follow a <strong>com</strong>mon syntax. Many <strong>com</strong>mands require<br />

node IDs, some do not, so the syntax is typically as follows:<br />

ndb_mgm> [node_id] {<strong>com</strong>mand} [parameters]<br />

The node_id can be any single node ID or the keyword 'ALL' to send it to all data nodes.<br />

Common Commands<br />

SHOW<br />

This <strong>com</strong>mand gives a quick overview of the status of all the nodes, whether or not they are<br />

connected and up/down.<br />

For example:<br />

ndb_mgm> show<br />

<strong>Cluster</strong> Configuration<br />

---------------------<br />

[ndbd(NDB)] 2 node(s)<br />

id=2 @127.0.0.1 (mysql-5.1.41 ndb-7.1.2, Nodegroup: 0, Master)<br />

id=3 @127.0.0.1 (mysql-5.1.41 ndb-7.1.2, Nodegroup: 0)<br />

[ndb_mgmd(MGM)] 1 node(s)<br />

id=1 @127.0.0.1 (mysql-5.1.41 ndb-7.1.2)<br />

[mysqld(API)] 2 node(s)<br />

id=4 @127.0.0.1 (mysql-5.1.41 ndb-7.1.2)<br />

id=5 (not connected, accepting connect from any host)<br />

If the data nodes are currently starting you will see this reflected in this status as follows:<br />

[ndbd(NDB)] 2 node(s)<br />

id=2 @127.0.0.1 (mysql-5.1.41 ndb-7.1.2, starting, Nodegroup: 0, Master)<br />

id=3 @127.0.0.1 (mysql-5.1.41 ndb-7.1.2, starting, Nodegroup: 0)<br />

Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 17/81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!