MySQL Cluster 节点分布如下:
用途 Ip(主机名) os
管理节点 192.168.1.201(MGM1) redhat 6.2 64bit
sql节点1 192.168.1.202(SQL1) redhat 6.2 64bit
sql节点2 192.168.1.203(SQL2) redhat 6.2 64bit
NDB节点1 192.168.1.204(NDB1) redhat 6.2 64bit
NDB节点2 192.168.1.205(NDB2) redhat 6.2 64bitMGM配置如下:
 [ndbd default] 
   NoOfReplicas=2
   DataMemory=80M 
   IndexMemory=18M 
  [ndb_mgmd] 
   hostname=192.168.0.201 
   datadir=/home/mysql/dbdata 
  [ndbd] 
   hostname=192.168.0.204
   datadir=/home/mysql/dbdata/
  [ndbd] 
  # Options for data node "B": 
   hostname=192.168.0.205
   datadir=/home/mysql/dbdata/ 
  [mysqld] 
  # SQL node options: 
   hostname=192.168.0.202 
  [mysqld] 
  hostname=192.168.0.203 sql配置如下:
[client] 
socket=/var/lib/mysql/mysql.sock 
[mysqld] 
max_connections=100 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
ndbcluster 
ndb-connectstring=192.168.0.201
[mysqld_safe] 
log-error=/var/log/mysqld.log 
pid-pold=/var/run/mysqld/mysqld.pid 
[mysql_cluster] 
ndb-connectstring=192.168.0.201   ##  管理节点 ndb配置如下:
[mysqld]
datadir=/home/mysql/dbdata/
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
ndbcluster
ndb-connectstring=192.168.0.201 [MYSQL_CLUSTER]
ndb-connectstring=192.168.0.201[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pidsql节点用mysql用户用命令:mysqld start --explicit_defaults_for_timestamp启动后日志如下:
[mysql@SQL2 ~]$ mysqld start --explicit_defaults_for_timestamp
2015-08-30 21:40:42 0 [Note] mysqld (mysqld 5.6.25-ndb-7.4.7-cluster-gpl) starting as process 9367 ...
2015-08-30 21:40:42 9367 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2015-08-30 21:40:42 9367 [Warning] Buffered warning: Changed limits: table_open_cache: 457 (requested 2000)
2015-08-30 21:40:42 9367 [Note] Plugin 'FEDERATED' is disabled.
2015-08-30 21:40:42 9367 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
mysqld start --explicit_defaults_for_timestamp2015-08-30 21:41:17 9367 [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-08-30 21:41:17 9367 [Note] NDB Binlog: Starting...
2015-08-30 21:41:17 9367 [Note] NDB Binlog: Started
2015-08-30 21:41:17 9367 [Note] NDB Binlog: Setting up
2015-08-30 21:41:17 9367 [Note] NDB Binlog: Created schema Ndb object, reference: 0x0, name: 'Ndb Binlog schema change monitoring'
2015-08-30 21:41:17 9367 [Note] NDB Binlog: Created injector Ndb object, reference: 0x0, name: 'Ndb Binlog data change monitoring'
2015-08-30 21:41:17 9367 [Note] NDB Binlog: Setup completed
2015-08-30 21:41:17 9367 [Note] NDB Binlog: Wait for server start completed
2015-08-30 21:41:17 9367 [Note] NDB Util: Starting...
2015-08-30 21:41:17 9367 [Note] NDB Util: Wait for server start completed
2015-08-30 21:41:17 9367 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-30 21:41:17 9367 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-30 21:41:17 9367 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-30 21:41:17 9367 [Note] InnoDB: Memory barrier is not used
2015-08-30 21:41:17 9367 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-30 21:41:17 9367 [Note] InnoDB: Using Linux native AIO
2015-08-30 21:41:17 9367 [Note] InnoDB: Using CPU crc32 instructions
2015-08-30 21:41:17 9367 [Note] NDB Index Stat: Starting...
2015-08-30 21:41:17 9367 [Note] NDB Index Stat: Wait for server start completed
2015-08-30 21:41:17 9367 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-30 21:41:17 9367 [Note] InnoDB: Completed initialization of buffer pool
2015-08-30 21:41:17 9367 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-30 21:41:17 9367 [Note] InnoDB: The log sequence numbers 1626057 and 1626057 in ibdata files do not match the log sequence number 1626087 in the ib_logfiles!
2015-08-30 21:41:17 9367 [Note] InnoDB: Database was not shutdown normally!
2015-08-30 21:41:17 9367 [Note] InnoDB: Starting crash recovery.
2015-08-30 21:41:17 9367 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-08-30 21:41:17 9367 [Note] InnoDB: Restoring possible half-written data pages 
2015-08-30 21:41:17 9367 [Note] InnoDB: from the doublewrite buffer...
2015-08-30 21:41:17 9367 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-30 21:41:17 9367 [Note] InnoDB: Waiting for purge to start
2015-08-30 21:41:17 9367 [Note] InnoDB: 5.6.25 started; log sequence number 1626087
mysqld: Too many arguments (first extra is 'start').
Use --verbose --help to get a list of available options
2015-08-30 21:41:17 9367 [ERROR] Aborting
2015-08-30 21:41:17 9367 [Note] Binlog end
2015-08-30 21:41:17 9367 [Note] NDB Util: Stop
2015-08-30 21:41:17 9367 [Note] NDB Util: Wakeup
2015-08-30 21:41:18 9367 [Note] NDB Util: Stopped
2015-08-30 21:41:18 9367 [Note] NDB Util: Stop completed
2015-08-30 21:41:18 9367 [Note] NDB Binlog: Stop
2015-08-30 21:41:18 9367 [Note] NDB Binlog: Wakeup
2015-08-30 21:41:19 9367 [Note] NDB Binlog: Shutting down
2015-08-30 21:41:19 9367 [Note] NDB Binlog: Stopping...
2015-08-30 21:41:19 9367 [Note] NDB Binlog: Stopped
2015-08-30 21:41:19 9367 [Note] NDB Binlog: Stop completed
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'partition'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'BLACKHOLE'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'ARCHIVE'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_METRICS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_CMPMEM'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_CMP'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_LOCKS'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'INNODB_TRX'
2015-08-30 21:41:19 9367 [Note] Shutting down plugin 'InnoDB'
2015-08-30 21:41:19 9367 [Note] InnoDB: FTS optimize thread exiting.
2015-08-30 21:41:19 9367 [Note] InnoDB: Starting shutdown...
2015-08-30 21:41:20 9367 [Note] InnoDB: Shutdown completed; log sequence number 1626097
2015-08-30 21:41:20 9367 [Note] Shutting down plugin 'ndb_transid_mysql_connection_map'
2015-08-30 21:41:20 9367 [Note] Shutting down plugin 'ndbinfo'
2015-08-30 21:41:20 9367 [Note] Shutting down plugin 'ndbcluster'
2015-08-30 21:41:20 9367 [Note] NDB Index Stat: Stop
2015-08-30 21:41:20 9367 [Note] NDB Index Stat: Wakeup
2015-08-30 21:41:21 9367 [Note] NDB Index Stat: Stopping...
2015-08-30 21:41:21 9367 [Note] NDB Index Stat: Stopped
2015-08-30 21:41:21 9367 [Note] NDB Index Stat: Stop completed
2015-08-30 21:41:21 9367 [Note] NDB Util: Stop
2015-08-30 21:41:21 9367 [Note] NDB Util: Wakeup
2015-08-30 21:41:21 9367 [Note] NDB Util: Stop completed
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'CSV'
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'MEMORY'
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'MRG_MYISAM'
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'MyISAM'
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'sha256_password'
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'mysql_old_password'
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'mysql_native_password'
2015-08-30 21:41:22 9367 [Note] Shutting down plugin 'binlog'
2015-08-30 21:41:22 9367 [Note] mysqld: Shutdown completemgm的状态如下:
[root@MGM mysql-cluster]# ndb_mgm -e show
Connected to Management Server at: 192.168.0.201:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=2    @192.168.0.204  (mysql-5.6.25 ndb-7.4.7, starting, Nodegroup: 0)
id=3    @192.168.0.205  (mysql-5.6.25 ndb-7.4.7, starting, Nodegroup: 0)[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.0.201  (mysql-5.6.25 ndb-7.4.7)[mysqld(API)]   2 node(s)
id=4 (not connected, accepting connect from 192.168.0.202)
id=5 (not connected, accepting connect from 192.168.0.203)
所有设备防火墙都已经关闭,且都能ping通,求解决方案。

解决方案 »

  1.   

    之前我也碰到类似的问题,解决办法是写多个 [mysqld] 
    [ndbd default] 
       NoOfReplicas=2
       DataMemory=80M 
       IndexMemory=18M 
      [ndb_mgmd] 
       hostname=192.168.0.201 
       datadir=/home/mysql/dbdata 
      [ndbd] 
       hostname=192.168.0.204
       datadir=/home/mysql/dbdata/
      [ndbd] 
      # Options for data node "B": 
       hostname=192.168.0.205
       datadir=/home/mysql/dbdata/ 
      [mysqld] 
      [mysqld] 
      [mysqld] 
      [mysqld] 
      [mysqld] 
      

  2.   

    折腾了一下,还是起不来,日志如下:
    [root@SQL2 ~]# mysqld_safe --user=mysql --explicit_defaults_for_timestamp &
    150901 17:19:42 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    2015-09-01 17:19:43 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25-ndb-7.4.7-cluster-gpl) starting as process 4837 ...
    2015-09-01 17:19:43 4837 [Note] Plugin 'FEDERATED' is disabled.
    2015-09-01 17:19:43 4837 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
    2015-09-01 17:20:18 4837 [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-09-01 17:20:18 4837 [Note] NDB Binlog: Starting...
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Started
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Setting up
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Created schema Ndb object, reference: 0x0, name: 'Ndb Binlog schema change monitoring'
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Created injector Ndb object, reference: 0x0, name: 'Ndb Binlog data change monitoring'
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Setup completed
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Wait for server start completed
    2015-09-01 17:20:18 4837 [Note] NDB Util: Starting...
    2015-09-01 17:20:18 4837 [Note] NDB Util: Wait for server start completed
    2015-09-01 17:20:18 4837 [Note] InnoDB: Using atomics to ref count buffer pool pages
    2015-09-01 17:20:18 4837 [Note] InnoDB: The InnoDB memory heap is disabled
    2015-09-01 17:20:18 4837 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2015-09-01 17:20:18 4837 [Note] InnoDB: Memory barrier is not used
    2015-09-01 17:20:18 4837 [Note] InnoDB: Compressed tables use zlib 1.2.3
    2015-09-01 17:20:18 4837 [Note] InnoDB: Using Linux native AIO
    2015-09-01 17:20:18 4837 [Note] InnoDB: Using CPU crc32 instructions
    2015-09-01 17:20:18 4837 [Note] NDB Index Stat: Starting...
    2015-09-01 17:20:18 4837 [Note] NDB Index Stat: Wait for server start completed
    2015-09-01 17:20:18 4837 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    2015-09-01 17:20:18 4837 [Note] InnoDB: Completed initialization of buffer pool
    2015-09-01 17:20:18 4837 [Note] InnoDB: Highest supported file format is Barracuda.
    2015-09-01 17:20:18 4837 [Note] InnoDB: The log sequence numbers 1626133 and 1626133 in ibdata files do not match the log sequence number 1626173 in the ib_logfiles!
    2015-09-01 17:20:18 4837 [Note] InnoDB: Database was not shutdown normally!
    2015-09-01 17:20:18 4837 [Note] InnoDB: Starting crash recovery.
    2015-09-01 17:20:18 4837 [Note] InnoDB: Reading tablespace information from the .ibd files...
    2015-09-01 17:20:18 4837 [Note] InnoDB: Restoring possible half-written data pages 
    2015-09-01 17:20:18 4837 [Note] InnoDB: from the doublewrite buffer...
    2015-09-01 17:20:18 4837 [Note] InnoDB: 128 rollback segment(s) are active.
    2015-09-01 17:20:18 4837 [Note] InnoDB: Waiting for purge to start
    2015-09-01 17:20:18 4837 [Note] InnoDB: 5.6.25 started; log sequence number 1626173
    2015-09-01 17:20:18 4837 [Note] Server hostname (bind-address): '*'; port: 3306
    2015-09-01 17:20:18 4837 [Note] IPv6 is available.
    2015-09-01 17:20:18 4837 [Note]   - '::' resolves to '::';
    2015-09-01 17:20:18 4837 [Note] Server socket created on IP: '::'.
    2015-09-01 17:20:18 4837 [Note] Event Scheduler: Loaded 0 events
    2015-09-01 17:20:18 4837 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.6.25-ndb-7.4.7-cluster-gpl'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Cluster Community Server (GPL)
    2015-09-01 17:20:18 4837 [Note] NDB Util: Wait for cluster to start
    2015-09-01 17:20:18 4837 [Note] NDB Index Stat: Wait for cluster to start
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Check for incidents
    2015-09-01 17:20:18 4837 [Note] NDB Binlog: Wait for cluster to start
    2015-09-01 17:20:48 4837 [Warning] NDB : Tables not available after 30 seconds.  Consider increasing --ndb-wait-setup value
      

  3.   

    是否是SQL节点主机中MySQL服务启动成功。但管理节点中却监测不到MySQL节点已开启啊?