Skip to content

Commit 6764c48

Browse files
committed
refactor multi-master config
Signed-off-by: SK Ali Arman <[email protected]>
1 parent 39a6f43 commit 6764c48

File tree

1 file changed

+3
-45
lines changed

1 file changed

+3
-45
lines changed

scripts/run.sh

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ mkdir -p /etc/mysql/group-replication.conf.d/
120120
echo "!includedir /etc/mysql/group-replication.conf.d/" >>/etc/mysql/my.cnf
121121
mkdir -p /etc/mysql/conf.d/
122122
echo "!includedir /etc/mysql/conf.d/" >>/etc/mysql/my.cnf
123-
if [[ "$PRIMARY_TYPE" == "Multi-Primary" ]]; then
124123
cat >>/etc/mysql/group-replication.conf.d/group.cnf <<EOL
125124
[mysqld]
126125
mysql_native_password=ON
@@ -166,53 +165,12 @@ bind-address = *
166165
report_host = "${report_host}"
167166
loose-group_replication_local_address = "${report_host}:33061"
168167
socket="/var/run/mysqld/mysqld.sock"
169-
EOL
170-
else
168+
if [[ "$PRIMARY_TYPE" == "Multi-Primary" ]]; then
171169
cat >>/etc/mysql/group-replication.conf.d/group.cnf <<EOL
172170
[mysqld]
173-
mysql_native_password=ON
174-
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
175-
176-
# General replication settings
177-
gtid_mode = ON
178-
enforce_gtid_consistency = ON
179-
binlog_checksum = NONE
180-
log_bin = binlog
181-
loose-group_replication_bootstrap_group = OFF
182-
loose-group_replication_start_on_boot = OFF
183-
184-
# default tls configuration for the group
185-
# group_replication_recovery_use_ssl will be overwritten from DB arguments
186-
loose-group_replication_ssl_mode = REQUIRED
187-
loose-group_replication_recovery_use_ssl = 1
188-
189-
# recommended config
190-
innodb_buffer_pool_size = "$INNODB_BUFFER_POOL_SIZE"
191-
loose-group-replication-message-cache-size = "$GROUP_REPLICATION_MESSAGE_CACHE_SIZE"
192-
binlog_expire_logs_seconds = "$BINLOG_EXPIRE_LOGS_SECONDS"
193-
194-
# Shared replication group configuration
195-
loose-group_replication_group_name = "${GROUP_NAME}"
196-
#loose-group_replication_ip_whitelist = "${hosts}"
197-
#loose-group_replication_ip_whitelist = "AUTOMATIC"
198-
#loose-group_replication_ip_allowlist = "AUTOMATIC"
199-
loose-group_replication_ip_whitelist = "${whitelist}"
200-
loose-group_replication_ip_allowlist = "${whitelist}"
201-
loose-group_replication_group_seeds = "${seeds}"
202-
203-
# Single or Multi-primary mode? Uncomment these two lines
204171
# for multi-primary mode, where any host can accept writes
205-
#loose-group_replication_single_primary_mode = OFF
206-
#loose-group_replication_enforce_update_everywhere_checks = ON
207-
208-
# Host specific replication configuration
209-
server_id = ${svr_id}
210-
#bind-address = "${report_host}"
211-
#bind-address = "0.0.0.0"
212-
bind-address = *
213-
report_host = "${report_host}"
214-
loose-group_replication_local_address = "${report_host}:33061"
215-
socket="/var/run/mysqld/mysqld.sock"
172+
loose-group_replication_single_primary_mode = OFF
173+
loose-group_replication_enforce_update_everywhere_checks = ON
216174
EOL
217175
fi
218176

0 commit comments

Comments
 (0)