欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

关于MySQL簇问题的成功解决

程序员文章站 2022-05-19 21:15:55
...

我在测试MySQL cluster时出现如下问题请大家帮忙分析一下是怎么回事,我的mysql cluster布署如下,用的是mysql-cluster-gpl-6.2.

我在测试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端口通话。

关于MySQL簇问题的成功解决