Souce Install Galera on MariaDB 10.3

구성 목표

MariaDB 서버 3대를 설치 후 Galera 클러스터링을 이용하여 Multi Active를 구성
Node 1 IP : 10.19.11.102
Node 2 IP : 10.19.11.103
Node 3 IP : 10.19.11.104
// MariaDB 10.3 버전이 모두 사전 설치 되 있는 상태에서 진행
// Galera는 낮은 사양의 Node를 기준으로 동기화 되기 때문에 최대한 모든 Node 동일 사양으로 구성

MariaDB 10.3 설치 매뉴얼

 

설치

의존성 패키지 설치

[root@10-19-11-102 /]# yum install git boost-devel check-devel scons automake autoconf socat

 

galera 소스 다운로드

[root@10-19-11-102 /]# cd /data/apps/dn/
[root@10-19-11-102 dn]# git clone -b mariadb-3.x https://github.com/MariaDB/galera.git

 

galera 모듈 빌드

[root@10-19-11-102 dn]# cd galera
[root@10-19-11-102 galera]# git submodule init
[root@10-19-11-102 galera]# git submodule update
[root@10-19-11-102 galera]# ./scripts/build.sh
[root@10-19-11-102 galera]# cp libgalera_smm.so /data/apps/ln/mariadb/lib/

 

Galera 인증 유저 생성

[root@10-19-11-102 galera]# /data/apps/ln/mariadb/bin/mysql -uroot -p
MariaDB [(none)]> CREATE USER 'sstuser'@'%' IDENTIFIED BY 'sstuser1~';
MariaDB [(none)]> GRANT LOCK TABLES, PROCESS, RELOAD, REPLICATION CLIENT, SUPER ON *.* TO 'sstuser'@'%';

 

생성된 유저 확인

MariaDB [(none)]> use mysql;
MariaDB [mysql]> select * from user where User = 'sstuser';

 

위의 과정을 모든 Node에 동일하게 적용하여 Galera 모듈 설치를 완료한다.

 

my.cnf 편집 (필수 편집 옵션만 나열합니다. 순서대로 진행하셔야 합니다.)

# Node 1 설정
: vi /data/apps/ln/mariadb/etc/my.cnf

# galera setting
binlog_format=row
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
wsrep_on = ON
wsrep_provider = /data/apps/ln/mariadb/lib/libgalera_smm.so
wsrep_slave_threads = 32
wsrep_provider_options = "pc.ignore_sb=no; pc.wait_prim=no; cert.log_conflicts=YES; gcs.fc_factor=0.8; gcs.fc_limit=160;"
wsrep_cluster_address = 'gcomm://'
#wsrep_cluster_address = 'gcomm://10.19.11.102,10.19.11.103,10.19.11.104'
wsrep_cluster_name = 'umount_cluster'
wsrep_node_address = '10.19.11.102'
wsrep_node_name = '10-19-11-102'
wsrep_sst_auth = "sstuser:sstuser1~"
wsrep_sst_method = 'mariabackup'

 

Node 1 mariadb 리스타트

[root@10-19-11-102 galera]# systemctl restart mariadb

 

# Node 2 설정
: vi /data/apps/ln/mariadb/etc/my.cnf

# galera setting
binlog_format = row
default_storage_engine = innodb
innodb_autoinc_lock_mode = 2
innodb_flush_log_at_trx_commit = 0
wsrep_on = ON
wsrep_provider = /data/apps/ln/mariadb/lib/libgalera_smm.so
wsrep_slave_threads = 32
wsrep_provider_options = "pc.ignore_sb=no; pc.wait_prim=no; cert.log_conflicts=YES; gcs.fc_factor=0.8; gcs.fc_limit=160;"
wsrep_cluster_address = 'gcomm://10.19.11.102,10.19.11.103'
#wsrep_cluster_address = 'gcomm://10.19.11.102,10.19.11.103,10.19.11.104'
wsrep_cluster_name = 'umount_cluster'
wsrep_node_address = '10.19.11.103'
wsrep_node_name = '10-19-11-103'
wsrep_sst_auth = "sstuser:sstuser1~"
wsrep_sst_method = 'mariabackup'

 

Node 2 mariadb 리스타트

[root@10-19-11-103 galera]# systemctl restart mariadb

 

# Node 3 설정
: vi /data/apps/ln/mariadb/etc/my.cnf

# galera setting
binlog_format = row
default_storage_engine = innodb
innodb_autoinc_lock_mode = 2
innodb_flush_log_at_trx_commit = 0
wsrep_on = ON
wsrep_provider = /data/apps/ln/mariadb/lib/libgalera_smm.so
wsrep_slave_threads = 32
wsrep_provider_options = "pc.ignore_sb=no; pc.wait_prim=no; cert.log_conflicts=YES; gcs.fc_factor=0.8; gcs.fc_limit=160;"
wsrep_cluster_address = 'gcomm://10.19.11.102,10.19.11.103,10.19.11.104'
wsrep_cluster_name = 'umount_cluster'
wsrep_node_address = '10.19.11.104'
wsrep_node_name = '10-19-11-104'
wsrep_sst_auth = "sstuser:sstuser1~"
wsrep_sst_method = 'mariabackup'

 

Node 3 mariadb 리스타트

[root@10-19-11-104 galera]# systemctl restart mariadb

 

클러스터링 확인 (3 노드중 아무곳에서나 확인 가능)

[root@10-19-11-104 galera]# /data/apps/ln/mariadb/bin/mysql -uroot -p
MariaDB [(none)]> show status like 'wsrep_%';
+------------------------------+-------------------------------------------------------+
| Variable_name | Value |
+------------------------------+-------------------------------------------------------+
| wsrep_apply_oooe | 0.000000 |
| wsrep_apply_oool | 0.000000 |
| wsrep_apply_window | 1.000000 |
| wsrep_causal_reads | 0 |
| wsrep_cert_deps_distance | 2.951220 |
| wsrep_cert_index_size | 1918 |
| wsrep_cert_interval | 0.000000 |
| wsrep_cluster_conf_id | 21 |
| wsrep_cluster_size | 3 |
| wsrep_cluster_state_uuid | 591c82d0-ebaa-11e8-9424-b75adfd45d50 |
| wsrep_cluster_status | Primary |
| wsrep_cluster_weight | 3 |
| wsrep_commit_oooe | 0.000000 |
| wsrep_commit_oool | 0.000000 |
| wsrep_commit_window | 1.000000 |
| wsrep_connected | ON |
| wsrep_desync_count | 0 |
| wsrep_evs_delayed | |
| wsrep_evs_evict_list | |
| wsrep_evs_repl_latency | 0/0/0/0/0 |
| wsrep_evs_state | OPERATIONAL |
| wsrep_flow_control_paused | 0.000000 |
| wsrep_flow_control_paused_ns | 0 |
| wsrep_flow_control_recv | 0 |
| wsrep_flow_control_sent | 0 |
| wsrep_gcomm_uuid | 88128b41-f222-11e8-8527-b7ec096051ba |
| wsrep_incoming_addresses | 10.19.11.102:3306,10.19.11.103:3306,10.19.11.104:3306 |
| wsrep_last_committed | 250 |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_cached_downto | 128 |
| wsrep_local_cert_failures | 0 |
| wsrep_local_commits | 66 |
| wsrep_local_index | 0 |
| wsrep_local_recv_queue | 0 |
| wsrep_local_recv_queue_avg | 0.000000 |
| wsrep_local_recv_queue_max | 1 |
| wsrep_local_recv_queue_min | 0 |
| wsrep_local_replays | 0 |
| wsrep_local_send_queue | 0 |
| wsrep_local_send_queue_avg | 0.000000 |
| wsrep_local_send_queue_max | 1 |
| wsrep_local_send_queue_min | 0 |
| wsrep_local_state | 4 |
| wsrep_local_state_comment | Synced |
| wsrep_local_state_uuid | 591c82d0-ebaa-11e8-9424-b75adfd45d50 |
| wsrep_open_connections | 0 |
| wsrep_open_transactions | 0 |
| wsrep_protocol_version | 9 |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 25.3.24(r3827) |
| wsrep_ready | ON |
| wsrep_received | 11 |
| wsrep_received_bytes | 1848 |
| wsrep_repl_data_bytes | 597097 |
| wsrep_repl_keys | 4845 |
| wsrep_repl_keys_bytes | 41728 |
| wsrep_repl_other_bytes | 0 |
| wsrep_replicated | 123 |
| wsrep_replicated_bytes | 647104 |
| wsrep_thread_count | 9 |
+------------------------------+-------------------------------------------------------+
61 rows in set (0.001 sec)

 

# Node 1 재설정
: vi /data/apps/ln/mariadb/etc/my.cnf

# galera setting
binlog_format = row
default_storage_engine = innodb
innodb_autoinc_lock_mode = 2
innodb_flush_log_at_trx_commit = 0
wsrep_on = ON
wsrep_provider = /data/apps/ln/mariadb/lib/libgalera_smm.so
wsrep_slave_threads = 32
wsrep_provider_options = "pc.ignore_sb=no; pc.wait_prim=no; cert.log_conflicts=YES; gcs.fc_factor=0.8; gcs.fc_limit=160;"
#wsrep_cluster_address = 'gcomm://'
wsrep_cluster_address = 'gcomm://10.19.11.102,10.19.11.103,10.19.11.104'
wsrep_cluster_name = 'umount_cluster'
wsrep_node_address = '10.19.11.102'
wsrep_node_name = '10-19-11-102'
wsrep_sst_auth = "sstuser:sstuser1~"
wsrep_sst_method = 'mariabackup'

 

Node 1 mariadb 리스타트

[root@10-19-11-102 galera]# systemctl restart mariadb

 

# Node 2 재설정
: vi /data/apps/ln/mariadb/etc/my.cnf

# galera setting
binlog_format = row
default_storage_engine = innodb
innodb_autoinc_lock_mode = 2
innodb_flush_log_at_trx_commit = 0
wsrep_on = ON
wsrep_provider = /data/apps/ln/mariadb/lib/libgalera_smm.so
wsrep_slave_threads = 32
wsrep_provider_options = "pc.ignore_sb=no; pc.wait_prim=no; cert.log_conflicts=YES; gcs.fc_factor=0.8; gcs.fc_limit=160;"
#wsrep_cluster_address = 'gcomm://10.19.11.102,10.19.11.103'
wsrep_cluster_address = 'gcomm://10.19.11.102,10.19.11.103,10.19.11.104'
wsrep_cluster_name = 'umount_cluster'
wsrep_node_address = '10.19.11.103'
wsrep_node_name = '10-19-11-103'
wsrep_sst_auth = "sstuser:sstuser1~"
wsrep_sst_method = 'mariabackup'

 

Node 2 mariadb 리스타트

[root@10-19-11-103 galera]# systemctl restart mariadb

You may also like...

Subscribe
Notify of
guest

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x