Tuesday, January 15, 2013

MySQL Cluster utilities

During a night action I had the opportunity to reconfigure an MySQL Cluster that had a storage node failed. At start time all storega nodes were stuck in Phase 0. The status of all storage nodes can be view from management client.

# ndb_mgm
ndb_mgm> all status

Also the status of the entire cluster can be view with the command

# ndb_mgm -e show
or from management client
ndb_mgm> show

Memory used on each NDB storage node can be view with:

ndb_mgm> all report memory

From this i learned a lesson: on storage nodes the firewall should be disabled.
Disabling firewall on linux:


# service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
# service iptables status
Firewall is stopped.
# chkconfig iptables off


NDB specific command can be run from storage nodes. These command gives you some details about the data distribution on NDB nodes.

To see all objects stored in NDB engine storage:
# ndb_show_tables
# ndb_show_tables | grep UserTable  // to see only the tables

To see the definitioan of a table and the data distribution for this table in partitions on NDB nodes:
# ndb_desc [table_name] -d [database_name] -p

To get the parameters used for NDB storage nodes:

# ndb_config --type=ndbd --query=id,host,datamemory,indexmemory,datadir -f ' : ' -r '\n'

This ndb_config command check only the data nodes (--type) and shows for each node the values for node's id, hostname, DataMemory, IndexMemory and DataDir parameters.

To get all nodes type in the cluster:

# ndb_config --query=id,type --fields=':' --rows='\n'

To get the row counting for a NDB table:


# ndb_select_count -d [database_name] [table_name1] [table_name2] ...


No comments:

Post a Comment