MySQL NDB Cluster API Developer Guide
The MGM API provides several functions which can be used to start, stop, and restart one or more Cluster data nodes. These functions are described in this section.
Starting, Stopping, and Restarting Nodes. You can start, stop, and restart Cluster nodes using the following functions, which are described in more detail in the next few sections.
Starting Nodes.
Use ndb_mgm_start()
.
Stopping Nodes.
Use ndb_mgm_stop()
,
ndb_mgm_stop2()
,
ndb_mgm_stop3()
, or
ndb_mgm_stop4()
.
Normally, you cannot use any of these functions to stop a
node while other nodes are starting. You can override this
restriction using
ndb_mgm_stop4()
with the
force
parameter set to 1.
Restarting Nodes.
Use ndb_mgm_restart()
,
ndb_mgm_restart2()
,
ndb_mgm_restart3()
, or
ndb_mgm_restart4()
.
Normally, you cannot use any of these functions to restart a
node while other nodes are starting. You can override this
restriction using
ndb_mgm_restart4()
with the
force
parameter set to 1.
This function can be used to start one or more Cluster
nodes. The nodes to be started must have been started
with the no-start option (-n
), meaning
that the data node binary was started and is waiting for
a START
management
command which actually enables the node.
int ndb_mgm_start ( NdbMgmHandlehandle
, intnumber
, const int*list
)
ndb_mgm_start()
takes 3 parameters:
An NdbMgmHandle
.
A number
of nodes to be
started. Use 0
to start all of
the data nodes in the cluster.
A list
of the node IDs of
the nodes to be started.
The number of nodes actually started; in the event of
failure, -1
is returned.
This function stops one or more data nodes.
int ndb_mgm_stop ( NdbMgmHandlehandle
, intnumber
, const int*list
)
ndb_mgm_stop()
takes 3 parameters:
Calling this function is equivalent to calling
ndb_mgm_stop2(
.
handle
,
number
,
list
, 0)
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
The number of nodes actually stopped; in the event of
failure, -1
is returned.
Like ndb_mgm_stop()
,
this function stops one or more data nodes. However, it
offers the ability to specify whether or not the nodes
shut down gracefully.
int ndb_mgm_stop2 ( NdbMgmHandlehandle
, intnumber
, const int*list
, intabort
)
ndb_mgm_stop2()
takes 4 parameters:
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
The value of abort
determines how the nodes will be shut down.
1
indicates the nodes will shut
down immediately; 0
indicates
that the nodes will stop gracefully.
The number of nodes actually stopped; in the event of
failure, -1
is returned.
Like ndb_mgm_stop()
and
ndb_mgm_stop2()
, this
function stops one or more data nodes. Like
ndb_mgm_stop2()
, it
offers the ability to specify whether the nodes should
shut down gracefully. In addition, it provides for a way
to check to see whether disconnection is required prior
to stopping a node.
int ndb_mgm_stop3 ( NdbMgmHandlehandle
, intnumber
, const int*list
, intabort
, int*disconnect
)
ndb_mgm_stop3()
takes 5 parameters:
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
The value of abort
determines how the nodes will be shut down.
1
indicates the nodes will shut
down immediately; 0
indicates
that the nodes will stop gracefully.
If disconnect
returns
1
(true
), this
means the you must disconnect before you can apply
the command to stop. For example, disconnecting is
required when stopping the management server to
which the handle is connected.
The number of nodes actually stopped; in the event of
failure, -1
is returned.
Like the other
ndb_mgm_stop
functions, this function stops one or more data nodes.
Like *
()ndb_mgm_stop2()
,
it offers the ability to specify whether the nodes
should shut down gracefully; like
ndb_mgm_stop3()
it
provides for a way to check to see whether disconnection
is required prior to stopping a node. In addition, it is
possible to force the node to shut down even if this
would cause the cluster to become nonviable.
int ndb_mgm_stop4 ( NdbMgmHandlehandle
, intnumber
, const int*list
, intabort
, intforce
, int*disconnect
)
ndb_mgm_stop4()
takes 6 parameters:
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
The value of abort
determines how the nodes will be shut down.
1
indicates the nodes will shut
down immediately; 0
indicates
that the nodes will stop gracefully.
The value of force
determines the action to be taken in the event that
the shutdown of a given node would cause an
incomplete cluster. 1
causes the
node—and the entire cluster—to be shut
down in such cases, 0
means the
node will not be shut down.
Setting force
equal to 1
also makes it possible to stop a node even while
other nodes are starting. (Bug #58451)
If disconnect
returns
1
(true
), this
means the you must disconnect before you can apply
the command to stop. For example, disconnecting is
required when stopping the management server to
which the handle is connected.
The number of nodes actually stopped; in the event of
failure, -1
is returned.
This function can be used to restart one or more Cluster data nodes.
int ndb_mgm_restart ( NdbMgmHandlehandle
, intnumber
, const int*list
)
ndb_mgm_restart()
takes 3 parameters:
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
Calling this function is equivalent to calling
ndb_mgm_restart2(handle
,number
,list
, 0, 0, 0);
See ndb_mgm_restart2(), for more information.
The number of nodes actually restarted;
-1
on failure.
Like ndb_mgm_restart()
,
this function can be used to restart one or more Cluster
data nodes. However,
ndb_mgm_restart2()
provides
additional restart options, including initial restart,
waiting start, and immediate (forced) restart.
int ndb_mgm_restart2 ( NdbMgmHandlehandle
, intnumber
, const int*list
, intinitial
intnostart
, intabort
)
ndb_mgm_restart2()
takes 6
parameters:
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
If initial
is true
(1
), then each node undergoes an
initial restart—that is, its file system is
removed.
If nostart
is true, then the
nodes are not actually started, but instead are left
ready for a start command.
If abort
is true, then
the nodes are restarted immediately, bypassing any
graceful restart.
The number of nodes actually restarted;
-1
on failure.
Like
ndb_mgm_restart2()
,
this function can be used to cause an initial restart,
waiting restart, and immediate (forced) restart on one
or more Cluster data nodes. However,
ndb_mgm_restart3()
provides the
additional options of checking whether disconnection is
required prior to the restart.
int ndb_mgm_restart3 ( NdbMgmHandlehandle
, intnumber
, const int*list
, intinitial
intnostart
, intabort
, int*disconnect
)
ndb_mgm_restart3()
takes 7
parameters:
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
If initial
is true
(1
), then each node undergoes an
initial restart—that is, its file system is
removed.
If nostart
is true, then the
nodes are not actually started, but instead are left
ready for a start command.
If abort
is true, then
the nodes are forced to restart immediately without
performing a graceful restart.
If disconnect
returns
1
(true
), this
means the you must disconnect before you can apply
the command to restart. For example, disconnecting
is required when stopping the management server to
which the handle is connected.
The number of nodes actually restarted;
-1
on failure.
Like the other
ndb_mgm_restart
functions, this function restarts one or more data
nodes. Like
*
()ndb_mgm_restart2()
, it
can be used to cause an initial restart, waiting
restart, and immediate (forced) restart on one or more
NDB Cluster data nodes; like
ndb_mgm_stop3()
it
provides for a way to check to see whether disconnection
is required prior to stopping a node. In addition, it is
possible to force the node to restart even if this would
cause a restart of the cluster.
int ndb_mgm_restart4 ( NdbMgmHandlehandle
, intnumber
, const int*list
, intinitial
intnostart
, intabort
, intforce
, int*disconnect
)
ndb_mgm_restart4()
takes 7
parameters:
An NdbMgmHandle
.
The number
of nodes to be
stopped. Use 0
to stop all of the
data nodes in the cluster.
A list
of the node IDs of
the nodes to be stopped.
If initial
is true
(1
), then each node undergoes an
initial restart—that is, its file system is
removed.
If nostart
is true, then the
nodes are not actually started, but instead are left
ready for a start command.
If abort
is true, then
the nodes are forced to restart immediately without
performing a graceful restart.
The value of force
determines the action to be taken in the event that
the loss of a given node due to restarting would
cause an incomplete cluster.
1
causes the node—and the
entire cluster—to be restarted in such cases,
0
means that the node will not be
restarted.
Setting force
equal to 1
also makes it possible to restart a node even while
other nodes are starting. (Bug #58451)
If disconnect
returns
1
(true
), this
means the you must disconnect before you can apply
the command to restart. For example, disconnecting
is required when stopping the management server to
which the handle is connected.
The number of nodes actually restarted;
-1
on failure.