Ⅰ MYsql的CLUSTER的SQL节点配置需要注意什么
管理节点:
[root@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# ls
config.ini data ndb_mgm ndb_mgmd
[root@localhost mysql]# cat config.ini
[NDBD DEFAULT]
NoOfReplicas=1
[TCP DEFAULT]
portnumber=3306
[NDB_MGMD]
hostname=192.168.0.231
datadir=/usr/local/mysql/data
[NDBD]
hostname=192.168.0.233
datadir=/usr/local/mysql/data
[NDBD]
hostname=192.168.0.234
datadir=/usr/local/mysql/data
[MYSQLD]
hostname=192.168.0.232
[root@localhost mysql]#
[root@localhost mysql]# /usr/local/mysql/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.0.233 (Version: 5.0.24, starting, Nodegroup: 0)
id=3 @192.168.0.234 (Version: 5.0.24, starting, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 (Version: 5.0.24)
[mysqld(API)] 1 node(s)
id=4 (not connected, accepting connect from 192.168.0.232)
ndb_mgm>
SQL 节点:
[root@localhost ~]# cat /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/
user=nobody
port=3306
socket=/tmp/mysql.sock
ndbcluster
ndb-connectstring=192.168.0.231
[mysql_cluster]
ndb-connectstring=192.168.0.231
[root@localhost ~]# ps aux | grep mysql
root 2865 0.0 0.1 5312 1104 tty1 S 19:13 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
nobody 2910 0.0 1.8 122356 18384 tty1 Sl 19:13 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=nobody --pid-file=/usr/local/mysql/data//localhost.localdomain.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock
root 3167 0.0 0.0 4752 664 pts/0 S+ 21:20 0:00 grep mysql
DATA 节点:(两个配置一样的。另外一个是192.168.234)
[root@localhost ~]# cat /etc/my.cnf
[mysqld]
ndbcluster
ndb-connectstring=192.168.0.231
[mysql_cluster]
ndb-connectstring=192.168.0.231
[root@localhost ~]# ps aux | grep ndb
root 2953 0.0 0.2 6672 1956 ? Ss 11:09 0:00 /usr/local/mysql/bin/ndbd --initial
root 2954 0.0 10.0 491720 97412 ? Sl 11:09 0:00 /usr/local/mysql/bin/ndbd --initial
root 3229 0.0 0.0 4752 664 pts/0 S+ 13:19 0:00 grep ndb
[root@localhost ~]#