Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

High Availability MySQL Cookbook phần 5 doc
Nội dung xem thử
Mô tả chi tiết
Chapter 3
79
Finally, restart all SQL nodes (mysqld processes). On RedHat-based systems, this can be
achieved using the service command:
[root@node1 ~]# service mysqld restart
Congratulations! Your cluster is now configured with multiple management nodes. Test that
failover works by killing a management node, in turn, the remaining management nodes
should continue to work.
There's more...
It is sometimes necessary to add a management node to an existing cluster if for example,
due to a lack of hardware or time, an initial cluster only has a single management node.
Adding a management node is simple. Firstly, install the management client on the new node
(refer to the recipe in Chapter 1). Secondly, modify the config.ini file, as shown earlier in
this recipe for adding the new management node, and copy this new config.ini file to both
management nodes. Finally, stop the existing management node and start the new one using
the following commands:
For the existing management node, type:
[root@node6 mysql-cluster]# killall ndb_mgmd [root@node6 mysql-cluster]#
ndb_mgmd --config-file=config.ini --initial --ndb-nodeid=2
2009-08-15 21:29:53 [MgmSrvr] INFO -- NDB Cluster Management Server.
mysql-5.1.34 ndb-7.0.6
2009-08-15 21:29:53 [MgmSrvr] INFO -- Reading cluster configuration
from 'config.ini'
Then type the following command for the new management node:
[root@node5 mysql-cluster]# ndb_mgmd --config-file=config.ini --initial
--ndb-nodeid=1
2009-08-15 21:29:53 [MgmSrvr] INFO -- NDB Cluster Management Server.
mysql-5.1.34 ndb-7.0.6
2009-08-15 21:29:53 [MgmSrvr] INFO -- Reading cluster configuration
from 'config.ini'
Now, restart each storage node one at a time. Ensure that you only stop one node per
nodegroup at a time and wait for it to fully restart before taking another node in the
nodegroup, when offline, in order to avoid any downtime.
MySQL Cluster Management
80
See also
Look at the section for the online addition of storage nodes (discussed later in this chapter)
for further details on restarting storage nodes one at a time. Also look at Chapter 1 for
detailed instructions on how to build a MySQL Cluster (with one management node).
Obtaining usage information
This recipe explains how to monitor the usage of a MySQL Cluster, looking at the memory,
CPU, IO, and network utilization on storage nodes.
Getting ready
MySQL Cluster is extremely memory-intensive. When a MySQL Cluster starts, the storage
nodes will start using the entire DataMemory and IndexMemory allocated to them. In
a production cluster with a large amount of RAM, it is likely that this will include a large
proportion of the physical memory on the server.
How to do it...
An essential part of managing a MySQL Cluster is looking into what is happening inside each
storage node. In this section, we will cover the vital commands used to monitor a cluster.
To monitor the memory (RAM) usage of the nodes within the cluster, execute the
<nodeid> REPORT MemoryUsage command within the management client as follows:
ndb_mgm> 3 REPORT MemoryUsage
Node 3: Data usage is 0%(21 32K pages of total 98304)
Node 3: Index usage is 0%(13 8K pages of total 131104)
This command can be executed for all storage nodes rather than just one by using ALL nodeid:
ndb_mgm> ALL REPORT MemoryUsage
Node 3: Data usage is 0%(21 32K pages of total 98304)
Node 3: Index usage is 0%(13 8K pages of total 131104)
Node 4: Data usage is 0%(21 32K pages of total 98304)
Node 4: Index usage is 0%(13 8K pages of total 131104)
Node 5: Data usage is 0%(21 32K pages of total 98304)
Node 5: Index usage is 0%(13 8K pages of total 131104)
Node 6: Data usage is 0%(21 32K pages of total 98304)
Node 6: Index usage is 0%(13 8K pages of total 131104)