九:破坏性测试:
1,关闭其中一个数据节点,验证结果表明,集群工作正常,
以下操作在数据节点2[192.168.133.102]上执行,如下:
[root@localhost bin]# ps -ef | grep ndbd
root 7541 1 0 01:52 ? 00:00:00 ./ndbd –nodeid=3 –initial
root 7542 7541 0 01:52 ? 00:02:39 ./ndbd –nodeid=3 –initial
root 9931 3295 0 20:47 pts/1 00:00:00 grep ndbd
[root@localhost bin]# kill 7541 7542
[root@localhost bin]# ps -ef | grep ndbd
root 9933 3295 0 20:47 pts/1 00:00:00 grep ndbd
[root@localhost bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:B8:00:13
inet addr:192.168.133.102 Bcast:192.168.133.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:feb8:13/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:19511513 errors:0 dropped:0 overruns:0 frame.:0
TX packets:19957492 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1781288143 (1.6 GiB) TX bytes:1899963551 (1.7 GiB)
Base address:0x2000 Memory:d8920000-d8940000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:597990 errors:0 dropped:0 overruns:0 frame.:0
TX packets:597990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:51521498 (49.1 MiB) TX bytes:51521498 (49.1 MiB)
[root@localhost bin]#
--------------------------------------------------------------------------------
十:去管理节点看集群的状态:
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.133.101 (Version: 7.1.10, Nodegroup: 0, Master)
id=3 (not connected, accepting connect from 192.168.133.102)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.133.98 (Version: 7.1.10)
[MySQLd(API)] 2 node(s)
id=4 @192.168.133.62 (Version: 7.1.10)
id=5 @192.168.133.100 (Version: 7.1.10)
ndb_mgm>
表明192.168.133.102上的数据节点确实当掉了.
去mysql节点1[192.168.133.62]做如下操作:
[root@localhost setup]# mysql
[root@localhost setup]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:B8:00:0F
inet addr:192.168.133.62 Bcast:192.168.133.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:feb8:f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7603400 errors:0 dropped:0 overruns:0 frame.:0
TX packets:4072260 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:684602777 (652.8 MiB) TX bytes:402432650 (383.7 MiB)
Base address:0x2000 Memory:d8920000-d8940000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:203352 errors:0 dropped:0 overruns:0 frame.:0
TX packets:203352 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11961759 (11.4 MiB) TX bytes:11961759 (11.4 MiB)
[root@localhost setup]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.51-ndb-7.1.10-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| ndbdatabase |
| ndbinfo |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> use ndbdatabase;
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_ndbdatabase |
+-----------------------+
| test |
+-----------------------+
1 row in set (0.01 sec)
mysql> select * from test;
+------+
| id |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
mysql>
以上操作表明在一个数据节点当机后,集群依然工作正常。