码迷,mamicode.com
首页 > 数据库 > 详细

MYSQL GALERA部署实录

时间:2018-02-14 11:48:02      阅读:369      评论:0      收藏:0      [点我收藏+]

标签:name   auth   clu   default   make   uil   percona   sock   nbsp   

[root@king01 ~]# yum install bison bison-devel check check-devel boost boost-devel scons socat perl-DBD-MySQL


[root@king01 ~]# rpm -ivh libev-4.15-1.el6.rf.x86_64.rpm

[root@king01 ~]# rpm -ivh percona-xtrabackup-24-2.4.9-1.el6.x86_64.rpm


[root@king01 ~]# tar zxvf mysql-wsrep-5.6.38-25.21.tar.gz

[root@king01 ~]# cd mysql-wsrep-5.6.38-25.21

[root@king01 mysql-wsrep-5.6.38-25.21]# cmake . \

-DCMAKE_BUILD_TYPE=Release \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/usr/local/mysql/data \

-DSYSCONFDIR=/etc \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_CSV_STORAGE_ENGINE=1 \

-DWITH_ARCHIVE_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EMBEDDED_SERVER=0 \

-DWITH_WSREP=1 \

-DWITH_INNODB_DISALLOW_WRITES=1


[root@king01 mysql-wsrep-5.6.38-25.21]# make && make install


[root@king01 mysql-wsrep-5.6.38-25.21]# cd support-files/

[root@king01 mysql-wsrep-5.6.38-25.21]# cp mysql.server /etc/init.d/mysqld



[root@king01 ~]# vi /etc/my.cnf

bind-address=0.0.0.0

default_storage_engine=innodb

innodb_autoinc_lock_mode=2

innodb_flush_log_at_trx_commit=0

wsrep_provider = /usr/local/mysql/lib/libgalera_smm.so

wsrep_provider_options="gcache.size=300M; gcache.page_size=300M"

wsrep_cluster_name = "my_wsrep_cluster"

wsrep_cluster_address = "gcomm://192.168.1.201,192.168.1.202"

wsrep_sst_method=xtrabackup-v2

wsrep_sst_auth=sst:sst

wsrep_node_name = king01

wsrep_node_address="192.168.1.201"


log_bin = mysql-bin

binlog_format = row

sync_binlog = 1

binlog_cache_size = 16M

max_binlog_cache_size = 32M

max_binlog_size = 512M

expire_logs_days = 7



[root@king01 ~]# tar zxvf galera-3-25.3.22.tar.gz

[root@king01 ~]# cd galera-3-25.3.22

[root@king01 galera-3-25.3.22]# scons


[root@king01 galera-3-25.3.22]# cp libgalera_smm.so /usr/local/mysql/lib/

[root@king01 galera-3-25.3.22]# cp garb/garbd /usr/local/mysql/bin


[root@king01 ~]# cd /usr/local/mysql/

[root@king01 mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data


[root@king01 ~]# service mysqld start --wsrep-new-cluster


[root@king01 ~]# mysql_secure_installation


[root@king01 ~]# mysql -uroot -pabcd.1234

mysql> grant usage on *.* to sst@'localhost' identified by 'sst';

Query OK, 0 rows affected (0.05 sec)


mysql> grant  all privileges on *.* to sst@'localhost';

Query OK, 0 rows affected (0.00 sec)


mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


[root@king01 ~]# netstat -tunlp | grep mysqld

tcp        0      0 0.0.0.0:4567                0.0.0.0:*                   LISTEN      18117/mysqld        

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      18117/mysqld     



[root@test02 ~]# rpm -ivh epel-release-6-8.noarch.rpm 

[root@king02 ~]# yum install bison bison-devel check check-devel boost boost-devel scons socat perl-DBD-MySQL


[root@test02 ~]# rpm -ivh libev-4.15-1.el6.rf.x86_64.rpm

[root@king02 ~]# rpm -ivh percona-xtrabackup-24-2.4.9-1.el6.x86_64.rpm


[root@king02 ~]# tar zxvf mysql-wsrep-5.6.38-25.21.tar.gz

[root@king02 ~]# cd mysql-wsrep-5.6.38-25.21


[root@king02 mysql-wsrep-5.6.38-25.21]# cmake . \

-DCMAKE_BUILD_TYPE=Release \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/usr/local/mysql/data \

-DSYSCONFDIR=/etc \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_CSV_STORAGE_ENGINE=1 \

-DWITH_ARCHIVE_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EMBEDDED_SERVER=0 \

-DWITH_WSREP=1 \

-DWITH_INNODB_DISALLOW_WRITES=1


[root@king02 mysql-wsrep-5.6.38-25.21]# make && make install


[root@king02 mysql-wsrep-5.6.38-25.21]# cd support-files/

[root@king02 mysql-wsrep-5.6.38-25.21]# cp mysql.server /etc/init.d/mysqld



[root@king02 ~]# vi /etc/my.cnf


bind-address=0.0.0.0

default_storage_engine=innodb

innodb_autoinc_lock_mode=2

innodb_flush_log_at_trx_commit=0

wsrep_provider = /usr/local/mysql/lib/libgalera_smm.so

wsrep_provider_options="gcache.size=300M; gcache.page_size=300M"

wsrep_cluster_name = "my_wsrep_cluster"

wsrep_cluster_address = "gcomm://192.168.1.201,192.168.1.202"

wsrep_sst_method=xtrabackup-v2

wsrep_sst_auth=sst:sst

wsrep_node_name = king02

wsrep_node_address="192.168.1.202"


log_bin = mysql-bin

binlog_format = row

sync_binlog = 1

binlog_cache_size = 16M

max_binlog_cache_size = 32M

max_binlog_size = 512M

expire_logs_days = 7



[root@king02 ~]# tar zxvf galera-3-25.3.22.tar.gz

[root@king02 ~]# cd galera-3-25.3.22

[root@king02 galera-3-25.3.22]# scons


[root@king02 galera-3-25.3.22]# cp libgalera_smm.so /usr/local/mysql/lib/

[root@king02 galera-3-25.3.22]# cp garb/garbd /usr/local/mysql/bin


[root@king02 ~]# cd /usr/local/mysql/

[root@king02 mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data


[root@king02 ~]# service mysqld start

[root@king02 ~]# netstat -tunlp | grep mysqld

tcp        0      0 0.0.0.0:4567                0.0.0.0:*                   LISTEN      18364/mysqld        

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      18364/mysqld 

         


MYSQL GALERA部署实录

标签:name   auth   clu   default   make   uil   percona   sock   nbsp   

原文地址:http://blog.51cto.com/13598811/2071627

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!