http://www.codership.com/wiki/doku.php?id=Galera%20Wiki
https://mariadb.com/kb/en/mariadb/getting-started-with-mariadb-galera-cluster/
# vi /etc/yum.repos.d/MariaDB.repo
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.0/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
# yum install MariaDB-Galera-server MariaDB-client galera
https://mariadb.com/kb/en/mariadb/galera-cluster-system-variables/
http://galeracluster.com/documentation-webpages/performance.html
# vi /etc/my.cnf.d/server.cnf
[galera] # Mandatory settings # 任意のクラスタ名、デフォルト「my_wsrep_cluster」 wsrep_cluster_name=DBCLUSTER # ライブラリファイルをフルパスで指定 wsrep_provider='/usr/lib64/galera/libgalera_smm.so' # 参加するクラスタ・ノードのIPを指定。 wsrep_cluster_address=gcomm://192.168.56.211,192.168.56.212,192.168.56.213 # 自分のIPアドレスを指定、デフォルトはeth0のIPアドレス wsrep_node_address=192.168.56.211 # CPUコア数の2倍、書き込み接続数の1/4 wsrep_slave_threads=4 innodb_locks_unsafe_For_binlog=1 binlog_format=row default_storage_engine=InnoDB innodb_autoinc_lock_mode=2 bind-address=0.0.0.0
初期ノード起動時は「bootstrap」を指定
[root@db01 ~]# /etc/init.d/mysql bootstrap Bootstrapping the cluster.. Starting MySQL.. SUCCESS! [root@db02 ~]# /etc/init.d/mysql start Starting MySQL.. SUCCESS! [root@db03 ~]# /etc/init.d/mysql start Starting MySQL.. SUCCESS!
# mysql -h db03 MariaDB [(none)]> show status like 'wsrep_%'; +----------------------------+--------------------------------------+ | Variable_name | Value | +----------------------------+--------------------------------------+ ~省略~ | wsrep_local_state_comment | Synced | | wsrep_cert_index_size | 0 | | wsrep_causal_reads | 0 | | wsrep_incoming_addresses | 192.168.56.213:3306, | ~省略~ +----------------------------+--------------------------------------+ 40 rows in set (0.00 sec)