MySQL NDB Cluster API Developer Guide

3.2.5 Cluster Status Functions

This section provides information about MGM API functions used to obtain status information from NDB Cluster nodes.

ndb_mgm_get_status()

Description

This function is used to obtain the status of the nodes in an NDB Cluster.

Note

The caller must free the pointer returned by this function.

Signature
struct ndb_mgm_cluster_state* ndb_mgm_get_status
    (
      NdbMgmHandle handle
    )
Parameters

This function takes a single parameter, a management server handle.

Return value

A pointer to an ndb_mgm_cluster_state data structure.

ndb_mgm_get_status2()

Description

This function is similar to ndb_mgm_get_status(), in that it is used to obtain the status of the nodes in an NDB Cluster. However, ndb_mgm_get_status2() allows one to specify the type or types of nodes (ndb_mgm_node_type) to be checked.

Note

The caller must free the pointer returned by this function.

Signature
struct ndb_mgm_cluster_state* ndb_mgm_get_status2
    (
      NdbMgmHandle handle,
      const enum ndb_mgm_node_type types[]
    )
Parameters

This function takes two parameters:

  • A management server handle

  • A pointer to array of the node types to be checked. These are ndb_mgm_node_type values. The array should be terminated by an element of type NDB_MGM_NODE_TYPE_UNKNOWN.

Return value

A pointer to an ndb_mgm_cluster_state data structure.

ndb_mgm_dump_state()

Description

This function can be used to dump debugging information to the cluster log. The NDB Cluster management client DUMP command is a wrapper for this function.

ndb_mgm_dump_state(), like the DUMP command, can cause a running NDB Cluster to malfunction or even to fail completely if it is used improperly. Be sure to consult the relevant documentation before using this function. For more information on the DUMP command, and for a listing of current DUMP codes and their effects, see NDB Cluster Management Client DUMP Commands.

Signature
int ndb_mgm_dump_state
    (
      NdbMgmHandle handle,
      int nodeId,
      const int* arguments,
      int numberOfArguments,
      struct ndb_mgm_reply* reply
    )
Parameters

This function takes the following pararemeters:

  • A management server handle (NdbMgmHandle)

  • The nodeId of a cluster data node.

  • An array of arguments. The first of these is the DUMP code to be executed. Subsequent arguments can be passed in this array if needed by or desired for the corresponding DUMP command.

  • The numberOfArguments to be passed.

  • An ndb_mgm_reply, which contains a return code along with a response or error message.

Return value

0 on success; otherwise, an error code.

Example.  The following example has the same result as running 2 DUMP 1000 in the management client:

//  [...]
#include <mgmapi_debug.h>
//  [...]
struct ndb_mgm_reply reply;
int args[1];
int stat, arg_count, node_id;

args[0] = 1000;
arg_count = 1;
node_id = 2;

stat = ndb_mgm_dump_state(h, node_id, args, arg_count, &reply);