Moon Light Box

Time is Money

Docker - MariaDB Galera Cluster

| Comments

node1, node2, node3

[mysqld]
character-set-server=utf8mb4
collation_server=utf8mb4_unicode_ci

[server]
bind-address=0.0.0.0
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1
query_cache_size=0
query_cache_type=0

[galera]
wsrep_on=ON
wsrep_provider="/usr/lib/galera/libgalera_smm.so"
wsrep_cluster_address="gcomm://10.10.10.10,10.10.10.11,10.10.10.12"
wsrep-sst-method=rsync

# Optional setting
wsrep_slave_threads=8
#innodb_flush_log_at_trx_commit=0
docker run -d \
--name mariadb \
--net=host \
-v /YOUR_MYSQL_DB_PATH/mysql.conf.d:/etc/mysql/conf.d \
-v /YOUR_MYSQL_DB_PATH/mysql:/var/lib/mysql \
-e MYSQL_INITDB_SKIP_TZINFO=yes \
-e MYSQL_ROOT_PASSWORD=YOUR_PASSWORD \
mariadb:10.3.0 \
--wsrep-new-cluster \
--wsrep_node_address=10.10.10.10

docker run -d \
--name mariadb \
--net=host \
-v /YOUR_MYSQL_DB_PATH/mysql.conf.d:/etc/mysql/conf.d \
-v /YOUR_MYSQL_DB_PATH/mysql:/var/lib/mysql \
-e MYSQL_INITDB_SKIP_TZINFO=yes \
-e MYSQL_ROOT_PASSWORD=YOUR_PASSWORD \
mariadb:10.3.0 \
--wsrep_node_address=10.10.10.11

docker run -d \
--name mariadb \
--net=host \
-v /YOUR_MYSQL_DB_PATH/mysql.conf.d:/etc/mysql/conf.d \
-v /YOUR_MYSQL_DB_PATH/mysql:/var/lib/mysql \
-e MYSQL_INITDB_SKIP_TZINFO=yes \
-e MYSQL_ROOT_PASSWORD=YOUR_PASSWORD \
mariadb:10.3.0 \
--wsrep_node_address=10.10.10.12

docker exec -it mariadb bash

mysql -u root -p

SHOW STATUS LIKE 'wsrep_%';

CREATE USER 'YOUR_ACCOUNT'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';

GRANT ALL PRIVILEGES ON *.* TO 'YOUR_ACCOUNT'@'localhost' WITH GRANT OPTION;

CREATE USER 'YOUR_ACCOUNT'@'%' IDENTIFIED BY 'YOUR_PASSWORD';

GRANT ALL PRIVILEGES ON *.* TO 'YOUR_ACCOUNT'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

http://benjr.tw/95536
http://blog.yam.com/keynes0918/article/63269343
http://www.pupuliao.info/2016/05/mariadbgalera-%E7%9A%84%E3%84%A7%E4%BA%9B%E5%84%AA%E7%BC%BA%E9%BB%9E/
http://livinote.com/post/MariaDB-Galera-Cluster%E6%9E%B6%E8%A8%AD
https://severalnines.com/blog/how-bootstrap-mysqlmariadb-galera-cluster

Comments

comments powered by Disqus