16.3 MySQL Cluster configuration details (config. ini)
Config. in ini, each type of node has two (or more) corresponding configuration item groups. The configuration items of each type of node are mainly composed of two parts, and one part is the same configuration item group of all similar nodes, in the three configuration groups [NDB_MGM DEFAULT], [ndbd default], and [MySQLD DEFAULT], each configuration group appears only once; the other part is the configuration item Groups [NDB_MGM], [NDBD], and [MySQLD] that are unique to each node. because each node configured in these three configuration groups has its own personalized configuration, each configuration group may appear multiple times (once for each node ). The following describes the configurations of each type of node:
1. Manage node configurations
In the entire MySQL Cluster environment, the management node configuration is related to two groups: [NDBD_MGM DEFAULT] and [NDB_MGMD:
1) configuration items shared by Management Nodes in [NDB_MGMD DEFAULT:
PortNumber: the server program (ndb_mgmd) of the Configuration Management node listens to the client (ndb_mgm) for connecting requests and sending commands. You can find out from the documentation that the default port is port 1186. In general, this item does not need to be changed. Of course, if you want to start multiple management nodes on the same host, you must start two management nodes with different listening ports;
LogDestination: configure the cluster log processing method on the Management node.
A) can write files such as: LogDestination = FILE: filename = my-cluster.log, maxsize = 500000, maxfiles = 4;
B) It can also be printed out through standard output, for example, LogDestination = CONSOLE;
C) It can also be included in syslog, such as: LogDestination = SYSLOG: facility = syslog;
D) There are even multiple ways to coexist: LogDestination = CONSOLE; SYSLOG: facility = syslog; FILE: filename =/var/log/cluster-log
Datadir: Specifies the location where the management node stores file output. Such as the process FILE (. pid) and cluster log FILE (when LogDestination has a FILE processing method ).
ArbitrationRank: configure the level of each node when processing certain events. Values 0, 1, and 2 can be selected.
A) 0 indicates that the current node fully listens to other nodes and does not participate in decision-making.
B) 1 indicates that the current node has the highest priority. "Everything is decided by me"
C) 2 indicates that the current node participates in the decision, but the priority is lower than 1, but higher than 0
The ArbitrationRank parameter is not only available for management nodes, but also for MySQL nodes. In general, all management nodes should be set to 1, and all SQL nodes should be set to 2.
2) [NDB_MGMD] is a set of configuration items for each management node. The required configuration items are as follows (the following parameters can only be set in the [NDB_MGMD] parameter group ):
Id: specify a unique Id number for the node, which must be unique throughout the Cluster environment;
Hostname: configure the IP address or Host Name of the node. If it is a host name, the host name must exist in the/etc/hosts file of the node where the configuration file is located, and the bound IP address is accurate.
All the parameter items in [NDB_MGMD DEFAULT] above can be set in the [NDB_MGMD] parameter group below, but the Id and Hostname parameters can only be set in [NDB_MGMD, it cannot be set in [NDB_MGMD DEFAULT], because the two parameters are different for each node.