📄 mgmapi.h
字号:
/** Log both sending/receiving*/ NDB_MGM_SIGNAL_LOG_MODE_INOUT, /** Log off*/ NDB_MGM_SIGNAL_LOG_MODE_OFF };#endif /***************************************************************************/ /** * @name Functions: Error Handling * @{ */ /** * Get the most recent error associated with the management server whose handle * is used as the value of <var>handle</var>. * * @param handle Management handle * @return Latest error code */ int ndb_mgm_get_latest_error(const NdbMgmHandle handle); /** * Get the most recent general error message associated with a handle * * @param handle Management handle. * @return Latest error message */ const char * ndb_mgm_get_latest_error_msg(const NdbMgmHandle handle); /** * Get the most recent error description associated with a handle * * The error description gives some additional information regarding * the error message. * * @param handle Management handle. * @return Latest error description */ const char * ndb_mgm_get_latest_error_desc(const NdbMgmHandle handle);#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED /** * Get the most recent internal source code error line associated with a handle * * @param handle Management handle. * @return Latest internal source code line of latest error * @deprecated */ int ndb_mgm_get_latest_error_line(const NdbMgmHandle handle);#endif /** * Set error stream */ void ndb_mgm_set_error_stream(NdbMgmHandle, FILE *); /** @} *********************************************************************/ /** * @name Functions: Create/Destroy Management Server Handles * @{ */ /** * Create a handle to a management server. * * @return A management handle<br> * or <var>NULL</var> if no management handle could be created. */ NdbMgmHandle ndb_mgm_create_handle(); /** * Destroy a management server handle. * * @param handle Management handle */ void ndb_mgm_destroy_handle(NdbMgmHandle * handle); /** * Set a name of the handle. Name is reported in cluster log. * * @param handle Management handle * @param name Name */ void ndb_mgm_set_name(NdbMgmHandle handle, const char *name); /** @} *********************************************************************/ /** * @name Functions: Connect/Disconnect Management Server * @{ */ /** * Sets the connectstring for a management server * * @param handle Management handle * @param connect_string Connect string to the management server, * * @return -1 on error. * * @code * <connectstring> := [<nodeid-specification>,]<host-specification>[,<host-specification>] * <nodeid-specification> := nodeid=<id> * <host-specification> := <host>[:<port>] * <id> is an integer greater than 0 identifying a node in config.ini * <port> is an integer referring to a regular unix port * <host> is a string containing a valid network host address * @endcode */ int ndb_mgm_set_connectstring(NdbMgmHandle handle, const char *connect_string); int ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid); int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle); int ndb_mgm_get_connected_port(NdbMgmHandle handle); const char *ndb_mgm_get_connected_host(NdbMgmHandle handle); const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz); /** * Set local bindaddress * @param arg - Srting of form "host[:port]" * @note must be called before connect * @note Error on binding local address will not be reported until connect * @return 0 on success */ int ndb_mgm_set_bindaddress(NdbMgmHandle, const char * arg); /** * Gets the connectstring used for a connection * * @note This function returns the default connectstring if no call to * ndb_mgm_set_connectstring() has been performed. Also, the * returned connectstring may be formatted differently. * * @param handle Management handle * @param buf Buffer to hold result * @param buf_sz Size of buffer. * * @return connectstring (same as <var>buf</var>) */ const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz); /** * Sets the number of seconds to wait for connect(2) during ndb_mgm_connect * Default is no timeout * * @param handle NdbMgmHandle * @param seconds number of seconds * @return non-zero on success */ int ndb_mgm_set_connect_timeout(NdbMgmHandle handle, unsigned int seconds); /** * Connects to a management server. Connectstring is set by * ndb_mgm_set_connectstring(). * * @param handle Management handle. * @param no_retries Number of retries to connect * (0 means connect once). * @param retry_delay_in_seconds * How long to wait until retry is performed. * @param verbose Make printout regarding connect retries. * * @return -1 on error. */ int ndb_mgm_connect(NdbMgmHandle handle, int no_retries, int retry_delay_in_seconds, int verbose); /** * Return true if connected. * * @param handle Management handle * @return 0 if not connected, non-zero if connected. */ int ndb_mgm_is_connected(NdbMgmHandle handle); /** * Disconnects from a management server * * @param handle Management handle. * @return -1 on error. */ int ndb_mgm_disconnect(NdbMgmHandle handle); /** * Gets connection node ID * * @param handle Management handle * * @return Node ID; 0 indicates that no node ID has been * specified */ int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle); /** * Gets connection port * * @param handle Management handle * * @return port */ int ndb_mgm_get_connected_port(NdbMgmHandle handle); /** * Gets connection host * * @param handle Management handle * * @return hostname */ const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** @} *********************************************************************/ /** * @name Functions: Used to convert between different data formats * @{ */ /** * Converts a string to an <var>ndb_mgm_node_type</var> value * * @param type Node type as string. * @return NDB_MGM_NODE_TYPE_UNKNOWN if invalid string. */ enum ndb_mgm_node_type ndb_mgm_match_node_type(const char * type); /** * Converts an ndb_mgm_node_type to a string * * @param type Node type. * @return <var>NULL</var> if invalid ID. */ const char * ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type); /** * Converts an ndb_mgm_node_type to a alias string * * @param type Node type. * @return <var>NULL</var> if the ID is invalid. */ const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char **str); /** * Converts a string to a <var>ndb_mgm_node_status</var> value * * @param status NDB node status string. * @return NDB_MGM_NODE_STATUS_UNKNOWN if invalid string. */ enum ndb_mgm_node_status ndb_mgm_match_node_status(const char * status); /** * Converts an ID to a string * * @param status NDB node status. * @return <var>NULL</var> if invalid ID. */ const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status); const char * ndb_mgm_get_event_severity_string(enum ndb_mgm_event_severity); ndb_mgm_event_category ndb_mgm_match_event_category(const char *); const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);#endif /** @} *********************************************************************/ /** * @name Functions: Cluster status * @{ */ /** * Gets status of the nodes in an NDB Cluster * * @note The caller must free the pointer returned by this function. * * @param handle Management handle. * * @return Cluster state (or <var>NULL</var> on error). */ struct ndb_mgm_cluster_state * ndb_mgm_get_status(NdbMgmHandle handle); /** @} *********************************************************************/ /** * @name Functions: Start/stop nodes * @{ */ /** * Stops database nodes * * @param handle Management handle. * @param no_of_nodes Number of database nodes to be stopped<br> * 0: All database nodes in cluster<br> * n: Stop the <var>n</var> node(s) specified in the * array node_list * @param node_list List of node IDs for database nodes to be stopped * * @return Number of nodes stopped (-1 on error) * * @note This function is equivalent * to calling ndb_mgm_stop2(handle, no_of_nodes, node_list, 0) */ int ndb_mgm_stop(NdbMgmHandle handle, int no_of_nodes, const int * node_list); /** * Stops database nodes * * @param handle Management handle. * @param no_of_nodes Number of database nodes to stop<br> * 0: All database nodes in cluster<br> * n: Stop the <var>n</var> node(s) specified in * the array node_list * @param node_list List of node IDs of database nodes to be stopped * @param abort Don't perform graceful stop, * but rather stop immediately * * @return Number of nodes stopped (-1 on error). */ int ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes, const int * node_list, int abort); /** * Stops cluster nodes * * @param handle Management handle. * @param no_of_nodes Number of database nodes to stop<br> * -1: All database and management nodes<br> * 0: All database nodes in cluster<br> * n: Stop the <var>n</var> node(s) specified in * the array node_list * @param node_list List of node IDs of database nodes to be stopped * @param abort Don't perform graceful stop, * but rather stop immediately * @param disconnect Returns true if you need to disconnect to apply * the stop command (e.g. stopping the mgm server * that handle is connected to) * * @return Number of nodes stopped (-1 on error). */ int ndb_mgm_stop3(NdbMgmHandle handle, int no_of_nodes, const int * node_list, int abort, int *disconnect); /** * Restart database nodes * * @param handle Management handle. * @param no_of_nodes Number of database nodes to restart<br> * 0: All database nodes in cluster<br> * n: Restart the <var>n</var> node(s) specified in the * array node_list * @param node_list List of node IDs of database nodes to be restarted * * @return Number of nodes restarted (-1 on error). * * @note This function is equivalent to calling * ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0); */ int ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes, const int * node_list); /** * Restart database nodes * * @param handle Management handle. * @param no_of_nodes Number of database nodes to be restarted:<br> * 0: Restart all database nodes in the cluster<br> * n: Restart the <var>n</var> node(s) specified in the * array node_list * @param node_list List of node IDs of database nodes to be restarted * @param initial Remove filesystem from restarting node(s) * @param nostart Don't actually start node(s) but leave them * waiting for start command * @param abort Don't perform graceful restart, * but rather restart immediately * * @return Number of nodes stopped (-1 on error). */ int ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list, int initial, int nostart, int abort); /** * Restart nodes * * @param handle Management handle. * @param no_of_nodes Number of database nodes to be restarted:<br> * 0: Restart all database nodes in the cluster<br> * n: Restart the <var>n</var> node(s) specified in the * array node_list * @param node_list List of node IDs of database nodes to be restarted * @param initial Remove filesystem from restarting node(s) * @param nostart Don't actually start node(s) but leave them * waiting for start command * @param abort Don't perform graceful restart, * but rather restart immediately * @param disconnect Returns true if mgmapi client must disconnect from * server to apply the requested operation. (e.g. * restart the management server)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -