# cat <<- '__GALERA__' > /etc/yum.repos.d/galera.repo [galera] name = Galera baseurl = http://releases.galeracluster.com/centos/$releasever/$basearch gpgkey = http://releases.galeracluster.com/GPG-KEY-galeracluster.com enabled = 0 gpgcheck = 1 __GALERA__
# rpm -ivh http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm # sed -i 's/^enable.*/enable = 0/g' /etc/yum.repos.d/percona-release.repo
# yum --enablerepo=galera install galera-3 mysql-wsrep-5.6 mysql-wsrep-server-5.6 mysql-wsrep-libs-compat-5.6
# yum --enablerepo=percona-release-x86_64 install percona-xtrabackup-22
# mysql_install_db --random-passwords
# cat /root/.mysql_secret
ウィザードに従って色々初期設定してくれる。
# mysql_secure_installation
cat <<- __MY__ >> /etc/my.cnf binlog_format=ROW bind-address=0.0.0.0 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock explicit_defaults_for_timestamp=true user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 default_storage_engine=InnoDB innodb_autoinc_lock_mode=2 innodb_flush_log_at_trx_commit=0 innodb_file_per_table=on innodb_buffer_pool_size=20G innodb_log_file_size=256M innodb_log_files_in_group=20 #innodb_additional_mem_pool_size=20M innodb_log_buffer_size=16M join_buffer_size = 128M sort_buffer_size = 2M read_rnd_buffer_size = 2M # Galera # Cluster setting wsrep_cluster_name="Galera_CLUSTER" wsrep_cluster_address="gcomm://" ## インストールノードごとに名称を変えること ## wsrep_node_name="$( hostname -s )" wsrep_node_address="" wsrep_sst_receive_address="" wsrep_sst_method="xtrabackup-v2" wsrep_sst_auth="xtrabk:WGHI6t84oaiCh8" wsrep_slave_threads=4 #wsrep_received_bytes=6637093 #wsrep_repl_data_bytes=265035226 #wsrep_incoming_address="" wsrep_provider="/usr/lib64/galera-3/libgalera_smm.so" #wsrep_provider_options="" # Xtrabackup setting [sst] compressor="gzip" decompressor="gzip -dc" rebuild=1 compact=1 encrypt=0 #tkey="" #tcert="" #tca="" [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] socket=/var/lib/mysql/mysql.sock __MY__ <code> === Xtrabackup用アカウント追加 === <code> mysql>GRANT ALL PRIVILEGES ON *.* TO xtrabk@'localhost' IDENTIFIED BY 'WGHI6t84oaiCh8'; FLUSH PRIVILEGES;
# /etc/init.d/mysql start --wsrep-new-cluster
mysql> set global wsrep_cluster_address='gcomm://192.168.10.11';
wsrep_cluster_sizeクラスタのノード数
mysql> show status like 'wsrep%'; wsrep_local_state_comment | Synced wsrep_cluster_size | 3