完成配置后,启动簇并不困难。必须在数据节点所在的主机上分别启动每个簇节点进程。尽管能够按任何顺序启动节点,但还是建议,首先启动管理节点,然后启动存储节点,最后启动SQL节点。
7.1. 管理节点启动可使用nbd_mgm指令登录到ndb_mgm客户端,登录后,可使用show指令来查看簇中个节点情况。
注意,启动MGM时,必须用-f或者–config-file选项,告诉ndb_mgmd到哪里找到配置文件。首次启动时必须选用–initial选项,或者更改了MGM节点的配置信息后,也需选用–initial选项。
sudo /usr/local/MySQL/ndb_mgmd -f /usr/local/mysql/config.ini
Ndb客户端查看:
wiki@zoweewiki:/usr/local/mysql$ /usr/local/mysql/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm>
ndb_mgm>
ndb_mgm>
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=11 @10.24.6.4 (mysql-5.6.25 ndb-7.4.7, Nodegroup: 0, *)
id=12 @10.24.6.6 (mysql-5.6.25 ndb-7.4.7, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @10.24.0.101 (mysql-5.6.25 ndb-7.4.7)
[mysqld(API)] 2 node(s)
id=21 @10.24.6.4 (mysql-5.6.25 ndb-7.4.7)
id=22 @10.24.6.6 (mysql-5.6.25 ndb-7.4.7)
7.2. 数据节点启动
在每台数据节点主机上,对于首次启动,运行下述命令启动NDBD进程:
sudo /opt/mysql/server-5.6/bin/ndbd --initial
注意,应仅在首次启动时ndbd时,或者在备份/恢复或者配置变化后重启ndbd时使用“–initial”参数,这很重要,因为该参数会使数据节点删除由早期ndbd实例创建的,用于恢复的任何文件,包括恢复用日志文件。
7.3. MYSQL节点启动sudo /etc/init.d/mysql restart
启动日志:
/opt/mysql/server-5.6/data/drbd02.err
151015 14:33:19 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/server-5.6/data
2015-10-15 14:33:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-10-15 14:33:22 0 [Note] /opt/mysql/server-5.6/bin/mysqld (mysqld 5.6.25-ndb-7.4.7-cluster-gpl-log) starting as process 15192 ...
2015-10-15 14:33:23 15192 [Note] Plugin 'FEDERATED' is disabled.
2015-10-15 14:33:23 15192 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-10-15 14:33:23 15192 [Note] InnoDB: The InnoDB memory heap is disabled
2015-10-15 14:33:23 15192 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-10-15 14:33:23 15192 [Note] InnoDB: Memory barrier is not used
2015-10-15 14:33:23 15192 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-10-15 14:33:23 15192 [Note] InnoDB: Using Linux native AIO
2015-10-15 14:33:23 15192 [Note] InnoDB: Not using CPU crc32 instructions
2015-10-15 14:33:23 15192 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-10-15 14:33:23 15192 [Note] InnoDB: Completed initialization of buffer pool
2015-10-15 14:33:24 15192 [Note] InnoDB: Highest supported file format is Barracuda.
2015-10-15 14:33:24 15192 [Note] InnoDB: 128 rollback segment(s) are active.
2015-10-15 14:33:24 15192 [Note] InnoDB: Waiting for purge to start
2015-10-15 14:33:24 15192 [Note] InnoDB: 5.6.25 started; log sequence number 1626027
2015-10-15 14:33:24 15192 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
2015-10-15 14:33:24 15192 [Note] NDB: NodeID is 22, management server '10.24.0.101:1186'
2015-10-15 14:33:25 15192 [Note] NDB[0]: NodeID: 22, all storage nodes connected
2015-10-15 14:33:25 15192 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Starting...
2015-10-15 14:33:25 15192 [Note] NDB Util: Starting...
2015-10-15 14:33:25 15192 [Note] NDB Index Stat: Starting...
2015-10-15 14:33:25 15192 [Note] NDB Index Stat: Wait for server start completed
2015-10-15 14:33:25 15192 [Note] NDB Util: Wait for server start completed
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Started
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Setting up
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Created schema Ndb object, reference: 0x80040016, name: 'Ndb Binlog schema change monitoring'
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Created injector Ndb object, reference: 0x80050016, name: 'Ndb Binlog data change monitoring'
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Setup completed
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Wait for server start completed
2015-10-15 14:33:25 15192 [Note] Server hostname (bind-address): '*'; port: 3306
2015-10-15 14:33:25 15192 [Note] IPv6 is available.
2015-10-15 14:33:25 15192 [Note] - '::' resolves to '::';
2015-10-15 14:33:25 15192 [Note] Server socket created on IP: '::'.
2015-10-15 14:33:25 15192 [Note] Event Scheduler: Loaded 0 events
2015-10-15 14:33:25 15192 [Note] /opt/mysql/server-5.6/bin/mysqld: ready for connections.
Version: '5.6.25-ndb-7.4.7-cluster-gpl-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Cluster Community Server (GPL)
2015-10-15 14:33:25 15192 [Note] NDB Util: Wait for cluster to start
2015-10-15 14:33:25 15192 [Note] NDB Util: Started
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Check for incidents
2015-10-15 14:33:25 15192 [Note] NDB Binlog: Wait for cluster to start
2015-10-15 14:33:25 15192 [Note] NDB Index Stat: Wait for cluster to start
2015-10-15 14:33:25 15192 [Note] ndb_index_stat_proc: Created Ndb object, reference: 0x80070016, name: 'Ndb Index Statistics monitoring'
2015-10-15 14:33:25 15192 [Note] NDB Index Stat: Started
2015-10-15 14:33:26 15192 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_schema
2015-10-15 14:33:26 15192 [Note] NDB Binlog: logging ./mysql/ndb_schema (UPDATED,USE_WRITE)
2015-10-15 14:33:26 15192 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_apply_status
2015-10-15 14:33:26 15192 [Note] NDB Binlog: logging ./mysql/ndb_apply_status (UPDATED,USE_WRITE)
2015-10-15 14:33:26 15192 [Note] NDB: Cleaning stray tables from database 'ndb_12_fs'
2015-10-15 14:33:26 15192 [Note] NDB: Cleaning stray tables from database 'ndbinfo'
2015-10-15 14:33:26 15192 [Note] NDB: Cleaning stray tables from database 'performance_schema'
2015-10-15 14:33:26 15192 [Note] NDB: Cleaning stray tables from database 'test'
2015-10-15 14:33:26 15192 [Note] NDB Binlog: Wait for first event
2015-10-15 14:33:26 [NdbApi] INFO -- Flushing incomplete GCI:s< 4554/3
2015-10-15 14:33:26 [NdbApi] INFO -- Flushing incomplete GCI:s< 4554/3
2015-10-15 14:33:26 15192 [Note] NDB Binlog: starting log at epoch 4554/3
2015-10-15 14:33:26 15192 [Note] NDB Binlog: Got first event
2015-10-15 14:33:26 15192 [Note] NDB Binlog: ndb tables writable
2015-10-15 14:33:26 15192 [Note] NDB Binlog: Startup and setup completed
2015-10-15 14:33:26 15192 [Note] NDB Schema dist: Data node: 11 reports subscribe from node 21, subscriber bitmask 0200000
2015-10-15 14:33:26 15192 [Note] NDB Schema dist: Data node: 12 reports subscribe from node 21, subscriber bitmask 0200000
2015-10-15 14:34:03 15192 [Warning] IP address '10.24.6.170' could not be resolved: Name or service not known
2015-10-15 14:34:56 15192 [Note] NDB Schema dist: Data node: 11 reports subscribe from node 21, subscriber bitmask 00
2015-10-15 14:34:56 15192 [Note] NDB Schema dist: Data node: 12 reports subscribe from node 21, subscriber bitmask 00
2015-10-15 14:35:03 15192 [Note] NDB Schema dist: Data node: 11 reports subscribe from node 21, subscriber bitmask 0200000
2015-10-15 14:35:03 15192 [Note] NDB Schema dist: Data node: 12 reports subscribe from node 21, subscriber bitmask 0200000
2015-10-15 14:41:04 15192 [Note] NDB Schema dist: Data node: 11 failed, subscriber bitmask 00
2015-10-15 14:42:36 15192 [Note] NDB Schema dist: Data node: 12 reports subscribe from node 21, subscriber bitmask 00