Mysql Cluster 7.1.9

Udah hampir 2 bulan mulai Project untuk membuat HA Mysql Server dengan Cluster.  udah berburu mulai dari baca tutorial sampai uji coba. tutorial yang menurut aku paling gampang dimengerti itu  disini, disini, disini dan disini

Kemudian setelah melihat2 tutorial tersebut bisa di simpulan kalau instalasinya adalah :

Instalasi.
Download packet yang dibutuhkan untuk server management dan node di web mysql.
Untuk Management Server :
- MySQL-Cluster-gpl-management-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-storage-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-client-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-server-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-tools-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-extra-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-shared-7.1.9-1.rhel5.i386.rpm
Untuk Node / Mysql API Server :
- MySQL-Cluster-gpl-client-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-extra-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-shared-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-server-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-storage-7.1.9-1.rhel5.i386.rpm
- MySQL-Cluster-gpl-tools-7.1.9-1.rhel5.i386.rpm
2. Proses Instalasi
Untuk server management :
- Setelah semua packet didownload dan disimpan dalam 1 folder.
- Install mysql management cluster dengan perintah :

rpm -ivh MySQL-Cluster-gpl-management-7.1.9-1.rhel5.i386.rpm 
MySQL-Cluster-gpl-storage-7.1.9-1.rhel5.i386.rpm 
MySQL-Cluster-gpl-client-7.1.9-1.rhel5.i386.rpm 
MySQL-Cluster-gpl-server-7.1.9-1.rhel5.i386.rpm 
MySQL-Cluster-gpl-tools-7.1.9-1.rhel5.i386.rpm 
MySQL-Cluster-gpl-extra-7.1.9-1.rhel5.i386.rpm 
MySQL-Cluster-gpl-shared-7.1.9-1.rhel5.i386.rpm

- Kemudian proses instalasi akan berjalan.
- Pindah kepada direktori /var/lib/mysql-cluster
- Buat file dengan nama config.cnf dan isikan dengan file konfigurasi nya:

# Options affecting ndbd processes on all data nodes:
 [NDBD DEFAULT]
 NoOfReplicas=2
 # Number of replicas
DataMemory=96M
 # How much memory to allocate for data storage
IndexMemory=64M
 # 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.
LockPagesInMainMemory=0
 # Node 3: Forced node shutdown completed.
 # Caused by error 2305: 'Node lost connection to other nodes
 # and can not form a unpartitioned cluster, please investigate if there are
 # error(s) on other node(s)(Arbitration error). Temporary error, restart node'.
# 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]
 hostname=192.168.0.227
 # Hostname or IP address of MGM node
 datadir=/var/lib/mysql-cluster
 # Directory for MGM node log files
# Options for data node "A":
 [NDBD]
 # (one [ndbd] section per data node)
 hostname=192.168.0.230
 # Hostname or IP address
 datadir=/var/lib/mysql-cluster
 # Directory for this data node's data files
# Options for data node "B":
 [NDBD]
 hostname=192.168.0.236
 # Hostname or IP address
 datadir=/var/lib/mysql-cluster
 # Directory for this data node's data files
# SQL node options:
 # [MYSQLD]
 # hostname=192.168.0.227
 # Hostname or IP address
 # (additional mysqld connections can be
 # specified for this node for various
 # purposes such as running ndb_restore)
[MYSQLD]
 hostname=192.168.0.230
 # Hostname or IP address
 # (additional mysqld connections can be
 # specified for this node for various
 # purposes such as running ndb_restore)
[MYSQLD]
 hostname=192.168.0.236
 # Hostname or IP address
 # (additional mysqld connections can be
 # specified for this node for various
 # purposes such as running ndb_restore)
[MYSQLD]
[MYSQLD]

kemudian untuk konfigurasi my.cnf adalah :

 

[mysqld]
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
#user=mysql
 # Default to using old password format for compatibility with mysql 3.x
 # clients (those using the mysqlclient10 compatibility package).
 #old_passwords=1
ndbcluster
 # IP address of the cluster management node
 ndb-connectstring=192.168.0.227
 #default-storage-engine=NDBCLUSTER
 default-storage-engine=NDBCLUSTER
[mysql_cluster]
 # IP address of the cluster management node
 ndb-connectstring=192.168.0.227
[ndb_mgmd]
 config-file=/var/lib/mysql-cluster/config.cnf
[mysqld_safe]
 log-error=/var/log/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid

Jalankan Server management dengan perintah :

ndb_mgmd -f /var/lib/mysql-cluster/config.cnf

Jalankan  node server mysql dengan perintah :

 

ndbd --initial

Cek hasil instalasi dan konfigurasi mysql cluster dengan perintah

ndb_mdm -e show

akan terlihat hasilnya seperti:

Cluster Configuration
 -_--_-___-_-_--___-_-
 [ndbd(NDB)] 2 node(s)
 id=2 @192.168.0.230 (mysql-5.1.51 ndb-7.1.9, Nodegroup: 0, Master)
 id=3 @192.168.0.236 (mysql-5.1.51 ndb-7.1.9, Nodegroup: 0)
 [ndb_mgmd(MGM)] 1 node(s)
 id=1 @192.168.0.227 (mysql-5.1.51 ndb-7.1.9)
 [mysqld(API)] 4 node(s)
 id=4 @192.168.0.230 (mysql-5.1.51 ndb-7.1.9)
 id=5 @192.168.0.236 (mysql-5.1.51 ndb-7.1.9)
 id=6 (not connected, accepting connect from any host)
 id=7 (not connected, accepting connect from any host)