📄 mgmapi.h
字号:
* * * @return Number of nodes stopped (-1 on error). */ int ndb_mgm_restart3(NdbMgmHandle handle, int no_of_nodes, const int * node_list, int initial, int nostart, int abort, int *disconnect); /** * Start database nodes * * @param handle Management handle. * @param no_of_nodes Number of database nodes to be started<br> * 0: Start all database nodes in the cluster<br> * n: Start the <var>n</var> node(s) specified in * the array node_list * @param node_list List of node IDs of database nodes to be started * * @return Number of nodes actually started (-1 on error). * * @note The nodes to be started must have been started with nostart(-n) * argument. * This means that the database node binary is started and * waiting for a START management command which will * actually enable the database node */ int ndb_mgm_start(NdbMgmHandle handle, int no_of_nodes, const int * node_list); /** @} *********************************************************************/ /** * @name Functions: Controlling Clusterlog output * @{ */ /** * Filter cluster log severities * * @param handle NDB management handle. * @param severity A cluster log severity to filter. * @param enable set 1=enable o 0=disable * @param reply Reply message. * * @return -1 on error. */ int ndb_mgm_set_clusterlog_severity_filter(NdbMgmHandle handle, enum ndb_mgm_event_severity severity, int enable, struct ndb_mgm_reply* reply); /** * Get clusterlog severity filter * * @param handle NDB management handle * * @return A vector of seven elements, * where each element contains * 1 if a severity indicator is enabled and 0 if not. * A severity level is stored at position * ndb_mgm_clusterlog_level; * for example the "error" level is stored in position * [NDB_MGM_EVENT_SEVERITY_ERROR]. * The first element [NDB_MGM_EVENT_SEVERITY_ON] in * the vector signals * whether the cluster log * is disabled or enabled. */ const unsigned int *ndb_mgm_get_clusterlog_severity_filter(NdbMgmHandle handle); /** * Set log category and levels for the cluster log * * @param handle NDB management handle. * @param nodeId Node ID. * @param category Event category. * @param level Log level (0-15). * @param reply Reply message. * @return -1 on error. */ int ndb_mgm_set_clusterlog_loglevel(NdbMgmHandle handle, int nodeId, enum ndb_mgm_event_category category, int level, struct ndb_mgm_reply* reply); /** * get log category and levels * * @param handle NDB management handle. * @return A vector of twelve elements, * where each element contains * loglevel of corresponding category */ const unsigned int *ndb_mgm_get_clusterlog_loglevel(NdbMgmHandle handle); /** @} *********************************************************************/ /** * @name Functions: Listening to log events * @{ */ /** * Listen to log events. They are read from the return file descriptor * and the format is textual, and the same as in the cluster log. * * @param handle NDB management handle. * @param filter pairs of { level, ndb_mgm_event_category } that will be * pushed to fd, level=0 ends list. * * @return fd filedescriptor to read events from */ int ndb_mgm_listen_event(NdbMgmHandle handle, const int filter[]);#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** * Set log category and levels for the Node * * @param handle NDB management handle. * @param nodeId Node ID. * @param category Event category. * @param level Log level (0-15). * @param reply Reply message. * @return -1 on error. */ int ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId, enum ndb_mgm_event_category category, int level, struct ndb_mgm_reply* reply); /** * Returns the port number where statistics information is sent * * @param handle NDB management handle. * @param reply Reply message. * @return -1 on error. */ int ndb_mgm_get_stat_port(NdbMgmHandle handle, struct ndb_mgm_reply* reply);#endif /** * The NdbLogEventHandle */ typedef struct ndb_logevent_handle * NdbLogEventHandle; /** * Listen to log events. * * @param handle NDB management handle. * @param filter pairs of { level, ndb_mgm_event_category } that will be * pushed to fd, level=0 ends list. * * @return NdbLogEventHandle */ NdbLogEventHandle ndb_mgm_create_logevent_handle(NdbMgmHandle, const int filter[]); void ndb_mgm_destroy_logevent_handle(NdbLogEventHandle*); /** * Retrieve filedescriptor from NdbLogEventHandle. May be used in * e.g. an application select() statement. * * @note Do not attemt to read from it, it will corrupt the parsing. * * @return filedescriptor, -1 on failure. */ int ndb_logevent_get_fd(const NdbLogEventHandle); /** * Attempt to retrieve next log event and will fill in the supplied * struct dst * * @param dst Pointer to struct to fill in event information * @param timeout_in_milliseconds Timeout for waiting for event * * @return >0 if event exists, 0 no event (timed out), or -1 on error. * * @note Return value <=0 will leave dst untouched */ int ndb_logevent_get_next(const NdbLogEventHandle, struct ndb_logevent *dst, unsigned timeout_in_milliseconds); /** * Retrieve laterst error code * * @return error code */ int ndb_logevent_get_latest_error(const NdbLogEventHandle); /** * Retrieve laterst error message * * @return error message */ const char *ndb_logevent_get_latest_error_msg(const NdbLogEventHandle); /** @} *********************************************************************/ /** * @name Functions: Backup * @{ */ /** * Start backup * * @param handle NDB management handle. * @param wait_completed 0: Don't wait for confirmation<br> * 1: Wait for backup to be started<br> * 2: Wait for backup to be completed * @param backup_id Backup ID is returned from function. * @param reply Reply message. * @return -1 on error. * @note backup_id will not be returned if * wait_completed == 0 */ int ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed, unsigned int* backup_id, struct ndb_mgm_reply* reply); /** * Abort backup * * @param handle NDB management handle. * @param backup_id Backup ID. * @param reply Reply message. * @return -1 on error. */ int ndb_mgm_abort_backup(NdbMgmHandle handle, unsigned int backup_id, struct ndb_mgm_reply* reply); /** @} *********************************************************************/ /** * @name Functions: Single User Mode * @{ */ /** * Enter Single user mode * * @param handle NDB management handle. * @param nodeId Node ID of the single user node * @param reply Reply message. * @return -1 on error. */ int ndb_mgm_enter_single_user(NdbMgmHandle handle, unsigned int nodeId, struct ndb_mgm_reply* reply); /** * Exit Single user mode * * @param handle NDB management handle. * @param reply Reply message. * * @return -1 on error. */ int ndb_mgm_exit_single_user(NdbMgmHandle handle, struct ndb_mgm_reply* reply);#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** @} *********************************************************************/ /** * @name Configuration handling * @{ */ /** * Get configuration * @param handle NDB management handle. * @param version Version of configuration, 0 means latest * (Currently this is the only supported value for this parameter) * * @return configuration * * @note The caller is responsible for calling ndb_mgm_destroy_configuration() */ struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned version); void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *); int ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned version, int nodetype, int log_event); /** * End Session * * This function tells the mgm server to free all resources associated with * this connection. It will also close it. * * This differs from just disconnecting as we now synchronously clean up, * so that a quickly restarting server that needs the same node id can * get it when it restarts. * * @param handle NDB management handle * @return 0 on success * * @note you still have to destroy the NdbMgmHandle. */ int ndb_mgm_end_session(NdbMgmHandle handle); /** * ndb_mgm_get_fd * * get the file descriptor of the handle. * INTERNAL ONLY. * USE FOR TESTING. OTHER USES ARE NOT A GOOD IDEA. * * @param handle NDB management handle * @return handle->socket * */ int ndb_mgm_get_fd(NdbMgmHandle handle); /** * Get the node id of the mgm server we're connected to */ Uint32 ndb_mgm_get_mgmd_nodeid(NdbMgmHandle handle); /** * Get the version of the mgm server we're talking to. * Designed to allow switching of protocol depending on version * so that new clients can speak to old servers in a compat mode */ int ndb_mgm_get_version(NdbMgmHandle handle, int *major, int *minor, int* build, int len, char* str); /** * Config iterator */ typedef struct ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator; ndb_mgm_configuration_iterator* ndb_mgm_create_configuration_iterator (struct ndb_mgm_configuration *, unsigned type_of_section); void ndb_mgm_destroy_iterator(ndb_mgm_configuration_iterator*); int ndb_mgm_first(ndb_mgm_configuration_iterator*); int ndb_mgm_next(ndb_mgm_configuration_iterator*); int ndb_mgm_valid(const ndb_mgm_configuration_iterator*); int ndb_mgm_find(ndb_mgm_configuration_iterator*, int param, unsigned value); int ndb_mgm_get_int_parameter(const ndb_mgm_configuration_iterator*, int param, unsigned * value); int ndb_mgm_get_int64_parameter(const ndb_mgm_configuration_iterator*, int param, Uint64 * value); int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*, int param, const char ** value); int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **); int ndb_mgm_check_connection(NdbMgmHandle handle); int ndb_mgm_report_event(NdbMgmHandle handle, Uint32 *data, Uint32 length);#endif#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED enum ndb_mgm_clusterlog_level { NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1, NDB_MGM_CLUSTERLOG_ON = 0, NDB_MGM_CLUSTERLOG_DEBUG = 1, NDB_MGM_CLUSTERLOG_INFO = 2, NDB_MGM_CLUSTERLOG_WARNING = 3, NDB_MGM_CLUSTERLOG_ERROR = 4, NDB_MGM_CLUSTERLOG_CRITICAL = 5, NDB_MGM_CLUSTERLOG_ALERT = 6, NDB_MGM_CLUSTERLOG_ALL = 7 }; inline int ndb_mgm_filter_clusterlog(NdbMgmHandle h, enum ndb_mgm_clusterlog_level s, int e, struct ndb_mgm_reply* r) { return ndb_mgm_set_clusterlog_severity_filter(h,(ndb_mgm_event_severity)s, e,r); } inline const unsigned int *ndb_mgm_get_logfilter(NdbMgmHandle h) { return ndb_mgm_get_clusterlog_severity_filter(h); } inline int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle h, int n, enum ndb_mgm_event_category c, int l, struct ndb_mgm_reply* r) { return ndb_mgm_set_clusterlog_loglevel(h,n,c,l,r); } inline const unsigned int *ndb_mgm_get_loglevel_clusterlog(NdbMgmHandle h) { return ndb_mgm_get_clusterlog_loglevel(h); }#endif#ifdef __cplusplus}#endif/** @} */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -