add process {--processhosts=|-R }process_host_list
[--set=attribute_assignment_list] [--verbose | -v] [--sequential-restart] cluster_name
process_host_list:
process_name[:node_id]@host[,process_name@host[,...]]
process_name:
{ndb_mgmd|ndbd|ndbmtd|mysqld|ndbapi}
attribute_assignment_list:
attribute_assignment[,attribute_assignment][,...]
attribute_assignment:
attribute_name:process_name[=value]
此命令向现有集群添加一个或多个进程,这些进程使用
process_host_list
with
--processhosts
选项指定,其格式与命令使用的格式相同
create cluster
。列表中引用的任何主机都必须是集群所属站点的成员。此外,所有主机都必须是可解析的。
例如,以下命令
在主机上add
process
添加两个mysqldtonfisk
进程并
添加flundra
到名为 的集群
mycluster
:
mcm> add process --processhosts=mysqld@tonfisk,mysqld@flundra mycluster;
+------------------------------+
| Command result |
+------------------------------+
| Processes added successfully |
+------------------------------+
1 row in set (2 min 10.39 sec)
使用该--verbose
选项,该命令会在添加新进程后显示更新的进程列表:
mcm> add process --processhosts=ndbmtd@tonfisk,ndbmtd@flundra --verbose mycluster;
+--------+----------+---------+
| NodeId | Name | Host |
+--------+----------+---------+
| 49 | ndb_mgmd | tonfisk |
| 53 | ndb_mgmd | flundra |
| 1 | ndbmtd | tonfisk |
| 2 | ndbmtd | flundra |
| 3 | ndbmtd | tonfisk |
| 4 | ndbmtd | flundra |
| 50 | mysqld | tonfisk |
| 51 | mysqld | flundra |
| 52 | ndbapi | * |
+--------+----------+---------+
9 rows in set (2 min 7.57 sec)
You can also manually assign a node ID to the new process you
are adding to the cluster by adding
“:
”
after the node_ID.
process_name
. For MySQL Cluster Manager
1.3.3 and earlier, trying to manually assign node IDs less than
49 for ndb_mgmd, mysqld,
or ndbapi
fails with an error; the
restriction, however, has been lifted since MySQL Cluster Manager 1.3.4.
Nevertheless, you are still recommended to follow the best
practice of reserving node ID 1 to 48 for data nodes. The
following command adds two ndbd processes
with node IDs 10 and 11 on hosts tonfisk
and
flundra
, respectively, to
mycluster
:
mcm> add process --processhosts=ndbd:10@tonfisk,ndbd:11@flundra mycluster;
+------------------------------+
| Command result |
+------------------------------+
| Processes added successfully |
+------------------------------+
1 row in set (2 min 13.40 sec)
NDB 8.0 supports up to 144 data nodes (for release 8.0.18 and later). So, when managing an NDB 8.0 cluster, you are recommended to follow the best practice of reserving node ID 1 to 144 for data nodes.
If the cluster is not running when you run the
add process
command, it is
recommended that you start all the new processes added by this
command together using the start
process
--added
command or
start them together with the whole cluster using the
start cluster
command—besides starting the nodes, either of the two
commands also initializes the added nodes and causes new cluster
nodegroups to be formed by issuing a
CREATE NODEGROUP
command to
the cluster. If the added nodes are started with
start process
--initial
instead,
you are then required to run CREATE
NODEGROUP
manually via the ndb_mgm
client.
If the cluster is running when you run the
add process
command, a rolling
restart for the cluster is performed at the end of the
add process
command.
For MySQL Cluster Manager 1.4.8 and later, use the
--sequential-restart
option to make the rolling restart a
sequential
one.
Adding Free Processes
Using the add process
command,
you can add unmanaged mysqld processes, or
ndbapi
slots for ndbapi
applications such as ndb_restore. To add an
unmanaged mysqld process, prefix the hostname
with the wildcard * (asterisk character):
mcm> add process --processhosts=mysqld@*tonfisk,mysqld@*flundra mycluster;
+------------------------------+
| Command result |
+------------------------------+
| Processes added successfully |
+------------------------------+
1 row in set (2 min 3.14 sec)
To allow the unmanaged mysqld nodes to
connect from any host, use the wildcard *
(asterisk character) in place of the hostname or IP address:
mcm> add process --processhosts=mysqld@*,mysqld@* mycluster;
+------------------------------+
| Command result |
+------------------------------+
| Processes added successfully |
+------------------------------+
1 row in set (2 min 3.14 sec)
The same applies to ndbapi
slots for
ndbapi
applications such as
ndb_restore: prefix the hostname with the
wildcard character to limit connectivity to a specific host, or
use only a wildcard, without hostname, to allow
ndbapi
applications from any host:
mcm> add process --processhosts=ndbapi@*tonfisk,ndbapi@* mycluster;
+------------------------------+
| Command result |
+------------------------------+
| Processes added successfully |
+------------------------------+
1 row in set (2 min 8.13 sec)
Because “free” processes are not managed by MySQL Cluster Manager,
there is no need to run the start
process
command after they have been successfully added to the cluster.
--added
Using add process
to Simplify create
cluster
Commands
Processes added before the cluster is started for the first time
are started with the cluster. This makes it possible to use this
command to break down what would otherwise be very long
create cluster
commands.
Consider the following set of commands that creates and then
starts a cluster named mycluster
:
create cluster --processhosts=ndb_mgmd@host1,ndbd@host1,ndbd@host2, \
mysqld@host3,mysqld@host4 mycluster;
start cluster mycluster;
The long create cluster
command
can be divided into a shorter (and more manageable) version of
itself, plus several add
process
commands. This set of commands performs the
same task as the previous set, creating
mycluster
with exactly the same processes and
hosts as before, and then starting it:
create cluster --processhosts=ndb_mgmd@host1 mycluster;
add process --processhosts=ndbd@host1,ndbd@host2 mycluster;
add process --processhosts=mysqld@host3,mysqld@host4 mycluster;
start cluster mycluster;
Notice that a process that is added to a cluster that was
created using create cluster
--import
and
before the import takes place is added with status
import
, which means it cannot be started or
stopped using start process
or
stop process
before an import
has taken place.
Configuring a New Process when Adding it
A newly added process inherits its configuration attribute settings from those in effect for its process type on the parent cluster, or assume the default settings for that process type if none apply. Existing attribute settings in the cluster must have process-level scope to be inherited by new processes added later; instance-level settings set for existing process instances prior to adding any new ones do not apply to any of the added processes. (See Configuration attributes, for more information about the scope of attribute settings.)
Inherited attribute settings can be overridden when adding
processes; to do this, use the add
process
command's
--set
option. This
option takes as its argument an attribute assignment list
similar in format to that used with the
get
and
set
commands. Suppose that the
current ndbd process-level setting in the
cluster named mycluster
for the
DataDir
attribute is
/home/users/ndb/cluster-data
, but you wish
to add two new ndbd processes that use
/tmp/cluster/data
instead. You can do this
using the following command:
mcm> add process --set=ndbd:DataDir=/tmp/cluster/data
> --processhosts=mysqld@tonfisk,mysqld@flundra
> mycluster;
Unlike the way you use the
set
command, an equal sign
(=
) immediately following the
--set
option is
required.
When setting attributes this way, which involves specifying
paths for processes running on Windows, you must replace any
backslashes (\
) used with forward slashes
(/
), just as with the
set
command. See
Setting Attributes Containing Paths on Windows, for more information.
使用添加进程后add
process
,您还可以使用该
set
命令修改其配置属性设置(或指定其他设置),就像使用 MySQL Cluster Manager 管理的任何其他集群进程一样。
当启用 IPv6 的 Windows 系统用作 MySQL Cluster Manager 下的 MySQL NDB Cluster 主机时,您必须使用 IPv4 地址引用这些主机。否则,MySQL Cluster Manager 无法连接到这些主机上的代理进程。请参阅 第 5.1 节,“MySQL 集群管理器使用和设计限制”。