3.1 MGM API Concepts

3.1.1 Working with Log Events
3.1.2 Structured Log Events

Each MGM API function needs a management server handle of type NdbMgmHandle. This handle is created by calling the function ndb_mgm_create_handle() and freed by calling ndb_mgm_destroy_handle().

See Section, “ndb_mgm_create_handle()”, and Section, “ndb_mgm_destroy_handle()”, for more information about these two functions.


You should not share an NdbMgmHandle between threads. While it is possible to do so (if you implement your own locks), this is not recommended; each thread should use its own management server handle.

A function can return any of the following:

Error conditions can be identified by using the appropriate error-reporting functions ndb_mgm_get_latest_error() and ndb_mgm_error().

Here is an example using the MGM API (without error handling for brevity's sake):

NdbMgmHandle handle= ndb_mgm_create_handle();
struct ndb_mgm_cluster_state *state= ndb_mgm_get_status(handle);
for(int i=0; i < state->no_of_nodes; i++)
  struct ndb_mgm_node_state *node_state= &state->node_states[i];
  printf("node with ID=%d ", node_state->node_id);

  if(node_state->version != 0)
    printf("not connected\n");