I have tried to run Management node, DATA node and SQL node on the same server, please refer to Part I.
I tried run DATA node on one server, and MANAGEMENT node, SQL node on the other server, please refer to Part II.
But none of this two cases works!
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
Part I: Single server
Management node, data node and SQL node all run on the same server.
They share the same my.cnf
-------------------------------------
My environment:
1)server: sunws05, Solaris 10 SPARC
2)software: mysql-cluster-gpl-7.0.9-solaris10-sparc-64bit.pkg [unzipped]
------------------------------------------------------------------------
steps:
1. Log in the server and switch to root context:
login as: yxiang
...
sunws05:/home/yxiang$
sunws05:/home/yxiang$ su
Password:***
# su - root
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
sunws05:/#
sunws05:/# bash
-------------------------------------
2. clean all mysql related things:
2.1 After all mysql-related processes are killed:
sunws05:/# ps -ef |grep mysql
root 23297 22979 0 09:08:39 pts/3 0:00 grep mysql
sunws05:/#
2.2 uninstall mysql
sunws05:/# pkginfo | grep mysql
application mysql MySQL Cluster Server (GPL)
sunws05:/# pkgrm mysql
.........................
Removal of <mysql> was successful.
2.3 clean all data and dirs:
sunws05:/# cd /opt/mysql/mysql
sunws05:/opt/mysql/mysql# ls
data mysql-cluster
sunws05:/opt/mysql/mysql# rm -r data
sunws05:/opt/mysql/mysql# rm -r mysql-cluster
sunws05:/opt/mysql/mysql#
sunws05:/# cd /var/lib
sunws05:/var/lib# ls
gdm log mysql mysql-cluster pgsql sgml
sunws05:/var/lib# rm -r mysql
sunws05:/var/lib#
sunws05:/var/lib# cd /etc/mysql
sunws05:/etc/mysql# ls
config.ini my.cnf temp
sunws05:/etc/mysql#
sunws05:/etc/mysql# rm config.ini
sunws05:/etc/mysql# rm my.cnf
-------------------------------------
3. Installation:
3.1 add mysql user and group
sunws05:/var/lib# groupadd mysql
UX: groupadd: ERROR: mysql is already in use. Choose another.
sunws05:/var/lib# useradd -g mysql mysql
sunws05:/var/lib#
3.2 install software
sunws05:/opt/yxiang_soft# pkgadd -d mysql-cluster-gpl-7.0.9-solaris10-sparc-64bit.pkg
...
MySQL Cluster Server (GPL)(sun4u) 7.0.9
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Using </opt/mysql> as the package base directory.
...
Do you want to continue with the installation of <mysql> [y,n,?]
...
## Installing part 1 of 1.
...
/opt/mysql/mysql/bin/mysql
...
/opt/mysql/mysql/bin/mysql_upgrade
...
/opt/mysql/mysql/bin/mysqladmin
/opt/mysql/mysql/bin/mysqlbinlog
...
Installation of <mysql> was successful.
-------------------------------------
4.review mysql cluster info:
4.1 mysql cluster
sunws05:/# cd /opt/mysql/mysql
sunws05:/opt/mysql/mysql# ls
COPYING README docs man share
EXCEPTIONS-CLIENT bin include mysql-test sql-bench
INSTALL-BINARY data lib scripts support-files
sunws05:/opt/mysql/mysql# cd data
sunws05:/opt/mysql/mysql/data# ls
mysql test
~~~~~~~~~~~Here we can see that two default sub-databases are installed.
4.2 priority of mysql
sunws05:/opt/mysql# ls -l mysql
total 218
-rw-r--r-- 1 root bin 19071 Nov 18 06:01 COPYING
-rw-r--r-- 1 root bin 5139 Nov 18 06:01 EXCEPTIONS-CLIENT
-rw-r--r-- 1 root bin 9439 Nov 18 06:01 INSTALL-BINARY
-rw-r--r-- 1 root bin 62989 Nov 18 06:01 README
drwxr-xr-x 2 root bin 2048 Feb 12 09:42 bin
drwxr-xr-x 4 mysql mysql 512 Feb 12 09:42 data
drwxr-xr-x 2 root bin 512 Feb 12 09:42 docs
drwxr-xr-x 3 root bin 1024 Feb 12 09:42 include
drwxr-xr-x 3 root bin 1024 Feb 12 09:42 lib
drwxr-xr-x 4 root bin 512 Feb 12 09:42 man
drwxr-xr-x 10 mysql mysql 512 Feb 12 09:43 mysql-test
drwxr-xr-x 2 root bin 512 Feb 12 09:43 scripts
drwxr-xr-x 28 root bin 1024 Feb 12 09:43 share
drwxr-xr-x 5 root bin 1024 Feb 12 09:43 sql-bench
drwxr-xr-x 2 root bin 512 Feb 12 09:43 support-files
sunws05:/opt/mysql#
-------------------------------------
5. Configure mysql cluster
Management node, data node and SQL node all run on the same server.
They share the same my.cnf
5.1 /etc/mysql/my.cnf
###################[my.cnf for Management/SQL/storage node]####################
[mysqld]
user=mysql
ndbcluster
ndb-connectstring=10.80.1.15
datadir=/var/lib/mysql
[ndb_mgm]
connect-string=10.80.1.15
[ndb_mgmd]
config-file=/etc/mysql/config.ini
#below section is for storage node.
[mysql_cluster]
ndb-connectstring=10.80.1.15
6. start cluster:
6.1 start management node:
sunws05:/etc/mysql# ndb_mgmd -f /etc/mysql/config.ini
2010-02-12 13:15:42 [MgmtSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.39 ndb-7.0.9b
2010-02-12 13:15:43 [MgmtSrvr] INFO -- Reading cluster configuration from '/etc/mysql/config.ini'
2010-02-12 13:15:43 [MgmtSrvr] WARNING -- at line 20: Cluster configuration warning:
arbitrator with id 1 and db node with id 2 on same host 10.80.1.15
Running arbitrator on the same host as a database node may cause complete cluster shutdown in case of host failure.
2010-02-12 13:15:44 [MgmtSrvr] INFO -- Reading cluster configuration from '/etc/mysql/config.ini'
2010-02-12 13:15:44 [MgmtSrvr] WARNING -- at line 20: Cluster configuration warning:
arbitrator with id 1 and db node with id 2 on same host 10.80.1.15
Running arbitrator on the same host as a database node may cause complete cluster shutdown in case of host failure.
sunws05:/etc/mysql#
6.1.1 show cluster file/dir info:
a)
sunws05:/etc/mysql# cd /export/mysql/mysql-cluster
sunws05:/export/mysql/mysql-cluster# ls
ndb_1.pid ndb_1_cluster.log ndb_1_out.log
b)
sunws05:/export/mysql/mysql-cluster# cd /opt/mysql/mysql/mysql-cluster
sunws05:/opt/mysql/mysql/mysql-cluster# ls
ndb_1_config.bin.1
6.1.2 show cluster process info:
a)
sunws05:/opt/mysql/mysql/mysql-cluster# ps -ef | grep mysql
root 12694 22979 0 13:23:18 pts/3 0:00 grep mysql
root 12163 1 0 13:15:44 ? 0:04 ndb_mgmd -f /etc/mysql/config.ini
[mysqld(API)] 2 node(s)
id=4 (not connected, accepting connect from 10.80.1.15)
id=5 (not connected, accepting connect from any host)
ndb_mgm>
6.3 start SQL node:
sunws05:/# mysqld_safe &
6.3.1 show error file:
sunws05:/var/lib/mysql/mysql# vi /var/lib/mysql/sunws05.err
"/var/lib/mysql/sunws05.err" 25 lines, 1682 characters
100212 13:53:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100212 13:53:43 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
100212 13:53:43 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
100212 13:53:44 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
100212 13:53:44 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
100212 13:53:45 InnoDB: Started; log sequence number 0 0
100212 13:53:45 [Note] NDB: NodeID is 4, management server '10.80.1.15:1186'
100212 13:53:46 [Note] NDB[0]: NodeID: 4, no storage nodes connected (timed out)
100212 13:53:46 [Warning] NDB: server id set to zero will cause any other mysqld with bin log to log with wrong server id
100212 13:53:46 [Note] Starting Cluster Binlog Thread
100212 13:53:46 [Note] Event Scheduler: Loaded 0 events
100212 13:54:01 [Warning] NDB : Tables not available after 15 seconds. Consider increasing --ndb-wait-setup value
100212 13:54:01 [Note] /opt/mysql/mysql/bin/mysqld: ready for connections.
Version: '5.1.39-ndb-7.0.9-cluster-gpl' socket: '/tmp/mysql.sock' port: 3306 MySQL Cluster Server (GPL)
~~~~~~~~we can see that mysqld is stared!!! but it does NOT work, i'll show you later.
6.3.2 show cluster info:
sunws05:/# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: 10.80.1.15:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @10.80.1.15 (mysql-5.1.39 ndb-7.0.9, starting, Nodegroup: 0)
id=3 (not connected, accepting connect from 10.80.1.16)
[mysqld(API)] 2 node(s)
id=4 (not connected, accepting connect from 10.80.1.15)
id=5 (not connected, accepting connect from any host)
ndb_mgm>
~~~~~~we can see, SQL node does NOT join the mysql cluster!!!
6.3.3 Now, let's see the error file[/var/lib/mysql/sunws05.err] again, i find that below contents are added:
100212 14:00:12 [Warning] NDB: Could not acquire global schema lock (4009)Cluster Failure
100212 14:03:15 [Warning] NDB: Could not acquire global schema lock (4009)Cluster Failure
100212 14:03:53 [Warning] NDB: Could not acquire global schema lock (4009)Cluster Failure
bash-3.00# vi /var/lib/mysql/sunsvr12.err
------------->server-id is commented:
"/var/lib/mysql/sunsvr12.err" 43 lines, 2936 characters
100220 16:18:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100220 16:18:20 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
100220 16:18:20 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
100220 16:18:21 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
100220 16:18:24 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
100220 16:18:30 InnoDB: Started; log sequence number 0 0
100220 16:18:30 [Note] NDB: NodeID is 4, management server '10.80.1.117:1186'
100220 16:18:31 [Note] NDB[0]: NodeID: 4, no storage nodes connected (timed out)
100220 16:18:31 [Warning] NDB: server id set to zero will cause any other mysqld with bin log to log with wrong server id
100220 16:18:31 [Note] Starting Cluster Binlog Thread
100220 16:18:31 [Note] Event Scheduler: Loaded 0 events
100220 16:18:49 [Warning] NDB : Tables not available after 15 seconds. Consider increasing --ndb-wait-setup value
100220 16:18:49 [Note] /opt/mysql/mysql/bin/mysqld: ready for connections.
Version: '5.1.39-ndb-7.0.9-cluster-gpl' socket: '/tmp/mysql.sock' port: 3306 MySQL Cluster Server (GPL)
------------->server-id is set to 4:
100220 16:26:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100220 16:26:58 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
100220 16:26:58 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
100220 16:26:59 InnoDB: Started; log sequence number 0 44233
100220 16:26:59 [Note] NDB: NodeID is 4, management server '10.80.1.117:1186'
100220 16:27:00 [Note] NDB[0]: NodeID: 4, no storage nodes connected (timed out)
100220 16:27:00 [Warning] NDB: server id set to zero will cause any other mysqld with bin log to log with wrong server id
100220 16:27:00 [Note] Starting Cluster Binlog Thread
100220 16:27:00 [Note] Event Scheduler: Loaded 0 events
100220 16:27:17 [Warning] NDB : Tables not available after 15 seconds. Consider increasing --ndb-wait-setup value
100220 16:27:17 [Note] /opt/mysql/mysql/bin/mysqld: ready for connections.
Version: '5.1.39-ndb-7.0.9-cluster-gpl' socket: '/tmp/mysql.sock' port: 3306 MySQL Cluster Server (GPL)
You can see that SQL NODE is started, but does NOT join the cluster.
I tried similar configuraiotn on two redhat EL 5.3 servers, everything is OK, even when server-id is NOT set!!!作者: lovechina 时间: 2010-2-25 09:10
6.2 start data node:
sunws05:/# ndbd
2010-02-12 13:51:52 [ndbd] INFO -- Configuration fetched from '10.80.1.15:1186', generation: 1
6.2.1 show data node info:
sunws05:/# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: 10.80.1.15:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @10.80.1.15 (mysql-5.1.39 ndb-7.0.9, starting, Nodegroup: 0)
id=3 (not connected, accepting connect from 10.80.1.16)
[mysqld(API)] 2 node(s)
id=4 (not connected, accepting connect from 10.80.1.15)
id=5 (not connected, accepting connect from any host)
ndb_mgm>
6.3 start SQL node:
sunws05:/# mysqld_safe &
6.3.1 show error file:
sunws05:/var/lib/mysql/mysql# vi /var/lib/mysql/sunws05.err
"/var/lib/mysql/sunws05.err" 25 lines, 1682 characters
100212 13:53:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100212 13:53:43 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
100212 13:53:43 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
100212 13:53:44 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
100212 13:53:44 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
100212 13:53:45 InnoDB: Started; log sequence number 0 0
100212 13:53:45 [Note] NDB: NodeID is 4, management server '10.80.1.15:1186'
100212 13:53:46 [Note] NDB[0]: NodeID: 4, no storage nodes connected (timed out)
100212 13:53:46 [Warning] NDB: server id set to zero will cause any other mysqld with bin log to log with wrong server id
100212 13:53:46 [Note] Starting Cluster Binlog Thread
100212 13:53:46 [Note] Event Scheduler: Loaded 0 events
100212 13:54:01 [Warning] NDB : Tables not available after 15 seconds. Consider increasing --ndb-wait-setup value
100212 13:54:01 [Note] /opt/mysql/mysql/bin/mysqld: ready for connections.
Version: '5.1.39-ndb-7.0.9-cluster-gpl' socket: '/tmp/mysql.sock' port: 3306 MySQL Cluster Server (GPL)
~~~~~~~~we can see that mysqld is stared!!! but it does NOT work, i'll show you later.
6.3.2 show cluster info:
sunws05:/# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: 10.80.1.15:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @10.80.1.15 (mysql-5.1.39 ndb-7.0.9, starting, Nodegroup: 0)
id=3 (not connected, accepting connect from 10.80.1.16)
[mysqld(API)] 2 node(s)
id=4 (not connected, accepting connect from 10.80.1.15)
id=5 (not connected, accepting connect from any host)
ndb_mgm>
~~~~~~we can see, SQL node does NOT join the mysql cluster!!!
6.3.3 Now, let's see the error file[/var/lib/mysql/sunws05.err] again, i find that below contents are added:
100212 14:00:12 [Warning] NDB: Could not acquire global schema lock (4009)Cluster Failure
100212 14:03:15 [Warning] NDB: Could not acquire global schema lock (4009)Cluster Failure
100212 14:03:53 [Warning] NDB: Could not acquire global schema lock (4009)Cluster Failure
You can see that SQL NODE is started, but does NOT join the cluster.
I tried similar configuraiotn on two redhat EL 5.3 servers, everything is OK, even when server-id is NOT set!!!作者: kider 时间: 2010-3-4 13:55
没有细看,有的只是提示:
1、所以的安装都用rpm包方式的,最好是用官方发布的最新的,适合你OS环境的。
2、你的问题与配置有关,仔细检查你的配置文件。如:server-id等。
3、OS方面的配置文件也要检查,如hosts
另外建议你看看"深入浅出MySQL数据库开发、优化与管理维护.pdf"一书中关于cluster一章节,简单易学。我放在了文档资料栏目中了,你找找吧...