關於MySQL簇問題的成功解決

來源:互聯網
上載者:User

我在測試MySQL cluster時出現如下問題請大家幫忙分析一下是怎麼回事,我的mysql cluster布署如下,用的是mysql-cluster-gpl-6.2.15-linux-i686-glibc23.tar.gz tar 包
節點管理器:192.168.5.254
儲存節點
192.168.5.45
192.168.5.30
sql節點
192.168.5.238
按著官方文檔配置好後在節點管理器(192.168.5.254)用show命令顯示結果如下:
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.5.45 (mysql-5.1.23 ndb-6.2.15, starting, Nodegroup: 0)
id=3 @192.168.5.30 (mysql-5.1.23 ndb-6.2.15, starting, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1 (mysql-5.1.23 ndb-6.2.15)

[mysqld(API)] 1 node(s)
id=4 (not connected, accepting connect from 192.168.5.23
管理節點簇日誌如下:
2008-09-27 14:17:30 [MgmSrvr] ALERT -- Node 1: Node 2 Disconnected
2008-09-27 14:17:30 [MgmSrvr] INFO -- Node 2: Node shutdown completed.
2008-09-27 14:17:30 [MgmSrvr] ALERT -- Node 1: Node 3 Disconnected
2008-09-27 14:17:30 [MgmSrvr] INFO -- Node 3: Node shutdown completed.
2008-09-27 14:17:32 [MgmSrvr] INFO -- Shutting down server...
2008-09-27 14:17:40 [MgmSrvr] INFO -- Mgmt server state: nodeid 4 freed, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000002.
2008-09-27 14:17:40 [MgmSrvr] INFO -- Shutdown complete
2008-09-27 14:20:37 [MgmSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.23 ndb-6.2.15
2008-09-27 14:20:37 [MgmSrvr] INFO -- Id: 1, Command port: *:1186
2008-09-27 14:20:45 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 reserved for ip 192.168.5.45, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000006.
2008-09-27 14:20:45 [MgmSrvr] INFO -- Node 1: Node 2 Connected
2008-09-27 14:20:46 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 freed, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000002.
2008-09-27 14:20:48 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:20:51 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:20:54 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:20:57 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:00 [MgmSrvr] WARNING -- Allocate nodeid (0) failed. Connection from ip 192.168.5.45. Returned error string "Connection done from wrong host ip 192.168.5.45."
2008-09-27 14:21:00 [MgmSrvr] INFO -- Mgmt server state: node id's 2 connected but not reserved
2008-09-27 14:21:00 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:03 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:06 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:09 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:12 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:15 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:18 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:21 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:24 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:27 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:30 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:21:31 [MgmSrvr] ALERT -- Node 1: Node 2 Disconnected
2008-09-27 14:21:31 [MgmSrvr] INFO -- Node 2: Node shutdown completed.
2008-09-27 14:21:33 [MgmSrvr] INFO -- Shutting down server...
2008-09-27 14:21:37 [MgmSrvr] INFO -- Shutdown complete
2008-09-27 14:33:52 [MgmSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.23 ndb-6.2.15
2008-09-27 14:33:52 [MgmSrvr] INFO -- Id: 1, Command port: *:1186
2008-09-27 14:34:53 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 reserved for ip 192.168.5.45, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000006.
2008-09-27 14:34:53 [MgmSrvr] INFO -- Node 1: Node 2 Connected
2008-09-27 14:34:54 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 freed, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000002.
2008-09-27 14:34:56 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:34:58 [MgmSrvr] INFO -- Mgmt server state: nodeid 3 reserved for ip 192.168.5.30, m_reserved_nodes 000000000000000000000000000000000000000000000000000000000000000a.
2008-09-27 14:34:59 [MgmSrvr] INFO -- Node 1: Node 3 Connected
2008-09-27 14:34:59 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:34:59 [MgmSrvr] INFO -- Mgmt server state: nodeid 3 freed, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000002.
2008-09-27 14:35:02 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:35:02 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:35:05 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:35:05 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:35:08 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:35:08 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:35:11 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:35:11 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:35:14 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:35:14 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:35:17 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:35:17 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:35:20 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:35:20 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
[root@host254 mysql-cluster]# cat ndb_1_cluster.log |tail
2008-09-27 14:36:02 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:36:02 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:36:02 [MgmSrvr] WARNING -- Allocate nodeid (0) failed. Connection from ip 192.168.5.45. Returned error string "Connection done from wrong host ip 192.168.5.45."
2008-09-27 14:36:02 [MgmSrvr] INFO -- Mgmt server state: node id's 2 3 connected but not reserved
2008-09-27 14:36:05 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:36:05 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:36:08 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:36:08 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]
2008-09-27 14:36:11 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [ all: 000000000000000c connected: 0000000000000008 no-wait: 0000000000000000 ]
2008-09-27 14:36:11 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [ all: 000000000000000c connected: 0000000000000004 no-wait: 0000000000000000 ]

儲存節點的錯誤記錄檔如下所示:
Configuration error: Error : Could not alloc node id at 192.168.5.254 port 1186: Connection done from wrong host ip 192.168.5.45.
080927 14:35:15 [ERROR] Plugin 'ndbcluster' init function returned error.
080927 14:35:15 [ERROR] Plugin 'ndbcluster' registration as a STORAGE ENGINE failed.
080927 14:35:15 [Note] Event Scheduler: Loaded 0 events
080927 14:35:15 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.1.23-ndb-6.2.15-cluster-gpl' socket: '/tmp/mysql.sock' port: 3306 MySQL Cluster Server (GPL)

在sql節點建立測試表表時出現ndb引擎沒有準備好的錯誤 提示:
mysql> use ctest;
Database changed
mysql> create table ctest(name varchar(50)) engine=ndbcluster;
ERROR 1005 (HY000): Can't create table 'ctest.ctest' (errno: 157)
管理節點設定檔內容如下config.ini:
#options affecting ndbd processes on all data nodes:

[NDBD DEFAULT]

NoOfReplicas=2 # Number of replicas

DataMemory=180M # How much memory to allocate for data storage

IndexMemory=80M # How much memory to allocate for index storage

# For DataMemory and IndexMemory, we have used the

# default values. Since the "world" database takes up

# only about 500KB, this should be more than enough for

# this example Cluster setup.

# TCP/IP options:

[TCP DEFAULT]

portnumber=2202
# This the default; however, you can use any
# port that is free for all the hosts in cluster
# Note: It is recommended beginning with MySQL 5.0 that
# you do not specify the portnumber at all and simply allow
# the default value to be used instead

# Management process options:

[NDB_MGMD]
id=1
hostname=192.168.5.254 # Hostname or IP address of MGM node

datadir=/var/lib/mysql-cluster # Directory for MGM node logfiles

# Options for data node "A":

[NDBD]

# (one [NDBD] section per data node)
id=2
hostname=192.168.5.45 # Hostname or IP address

datadir=/usr/local/mysql/data # Directory for this data node's datafiles

# Options for data node "B":

[NDBD]
id=3
hostname=192.168.5.30 # Hostname or IP address

datadir=/usr/local/mysql/data # Directory for this data node's datafiles

# SQL node options:

[MYSQLD]
id=4
hostname=192.168.5.238
# Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)

儲存節點與sql節點設定檔如下 :
[MYSQLD]
ndbcluster
ndb-connectstring=192.168.5.254
[MYSQL_CLUSTER]
ndb-connectstring=192.168.5.254
從節點伺服器或儲存伺服器上nmap管理伺服器時看不到1186連接埠,但telnet 192.168.5.254可以連上,不過在輸入get version與get status時沒有任何反應(這是我在國外一貼子上看到的)。

最終確定為192.168.5.45上防火牆引起的故障,無法與伺服器1186連接埠通話。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.