Successful MySQL cluster Solution

Source: Internet
Author: User
Tags node server

I encountered the following problems when testing MySQL cluster. Please help me analyze what is going on. My mysql clusterdeployment uses the mysql-cluster-gpl-6.2.15-linux-i686-glibc23.tar.gz tar package.
Node Manager: 192.168.5.254
Storage Node
192.168.5.45
192.168.5.30
SQL Node
192.168.5.238
After configuring according to the official documents, run the show command on the Node Manager (192.168.5.254) to display the result as follows:
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
The management node cluster log is as follows:
14:17:30 [MgmSrvr] ALERT -- Node 1: Node 2 Disconnected
2008-09-27 14:17:30 [MgmSrvr] INFO -- Node 2: Node shutdown completed.
14:17:30 [MgmSrvr] ALERT -- Node 1: Node 3 Disconnected
2008-09-27 14:17:30 [MgmSrvr] INFO -- Node 3: Node shutdown completed.
14:17:32 [MgmSrvr] INFO -- Shutting down server...
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
14:20:37 [MgmSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.23 ndb-6.2.15
14:20:37 [MgmSrvr] INFO -- Id: 1, Command port: *: 1186
14:20:45 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 reserved for ip 192.168.5.45, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000006.
14:20:45 [MgmSrvr] INFO -- Node 1: Node 2 Connected
14:20:46 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 freed, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000002.
14:20:48 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:20:51 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:20:54 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:20:57 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c 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
14:21:00 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:03 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:06 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:09 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:12 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:15 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:18 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:21 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:24 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:27 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:30 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:21:31 [MgmSrvr] ALERT -- Node 1: Node 2 Disconnected
2008-09-27 14:21:31 [MgmSrvr] INFO -- Node 2: Node shutdown completed.
14:21:33 [MgmSrvr] INFO -- Shutting down server...
2008-09-27 14:21:37 [MgmSrvr] INFO -- Shutdown complete
14:33:52 [MgmSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.23 ndb-6.2.15
14:33:52 [MgmSrvr] INFO -- Id: 1, Command port: *: 1186
14:34:53 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 reserved for ip 192.168.5.45, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000006.
14:34:53 [MgmSrvr] INFO -- Node 1: Node 2 Connected
14:34:54 [MgmSrvr] INFO -- Mgmt server state: nodeid 2 freed, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000002.
14:34:56 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:34:58 [MgmSrvr] INFO -- Mgmt server state.
14:34:59 [MgmSrvr] INFO -- Node 1: Node 3 Connected
14:34:59 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:34:59 [MgmSrvr] INFO -- Mgmt server state: nodeid 3 freed, m_reserved_nodes 0000000000000000000000000000000000000000000000000000000000000002.
14:35:02 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:35:02 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:35:05 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:35:05 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:35:08 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:35:08 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:35:11 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:35:11 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:35:14 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:35:14 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:35:17 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:35:17 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:35:20 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:35:20 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
[Root @ host254 mysql-cluster] # cat ndb_1_cluster.log | tail
14:36:02 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:36:02 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c 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
14:36:05 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:36:05 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:36:08 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:36:08 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]
14:36:11 [MgmSrvr] INFO -- Node 3: Initial start, waiting for 0000000000000004 to connect, nodes [all: commandid 0000000c connected: 0000000000000008 no-wait: 0000000000000000]
14:36:11 [MgmSrvr] INFO -- Node 2: Initial start, waiting for 0000000000000008 to connect, nodes [all: commandid 0000000c connected: 0000000000000004 no-wait: 0000000000000000]

The error log of the storage node is as follows:
Configuration error: Error: cocould 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' registry as a storage engine failed.
080927 14:35:15 [Note] Event schedents: 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)

When creating a test table on an SQL node, the following error occurs:
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)
The content of the management node configuration file is as follows: config. ini:
# Options affecting ndbd processes on all data nodes:

[Ndbd default]

NoOfReplicas = 2 # Number of replicas

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

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

# For DataMemory and IndexMemory, we have used

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

# Only about 500KB, this shoshould be more than enough

# 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 "":

[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)

The storage node and SQL node configuration file is as follows:
[MYSQLD]
Ndbcluster
Ndb-connectstring = 192.168.5.254
[MYSQL_CLUSTER]
Ndb-connectstring = 192.168.5.254
The nmap management server on the node server or storage server cannot see port 1186, but telnet 192.168.5.254 can be connected, however, there is no response when you enter get version and get status (this is what I saw on a foreign post ).

It is determined that the firewall on 192.168.5.45 is faulty and cannot communicate with port 1186 of the server.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.