Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multi Primary Support for V8.4.2 #41

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# HOST_ADDRESS_TYPE = Address type of HOST_ADDRESS (one of DNS, IPV4, IPv6)
# POD_IP = IP address used to create whitelist CIDR. For HOST_ADDRESS_TYPE=DNS, it will be status.PodIP.
# POD_IP_TYPE = Address type of POD_IP (one of IPV4, IPv6)
# PRIMARY_TYPE = defines single/multi primary

env | sort | grep "POD\|HOST\|NAME"

Expand Down Expand Up @@ -104,6 +105,49 @@ mkdir -p /etc/mysql/group-replication.conf.d/
echo "!includedir /etc/mysql/group-replication.conf.d/" >>/etc/mysql/my.cnf
mkdir -p /etc/mysql/conf.d/
echo "!includedir /etc/mysql/conf.d/" >>/etc/mysql/my.cnf
if [[ "$PRIMARY_TYPE" == "Multi-Primary" ]]; then
cat >>/etc/mysql/group-replication.conf.d/group.cnf <<EOL
[mysqld]
mysql_native_password=ON
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"

# General replication settings
gtid_mode = ON
enforce_gtid_consistency = ON
binlog_checksum = NONE
log_bin = binlog
loose-group_replication_bootstrap_group = OFF
loose-group_replication_start_on_boot = OFF

# default tls configuration for the group
# group_replication_recovery_use_ssl will be overwritten from DB arguments
loose-group_replication_ssl_mode = REQUIRED
loose-group_replication_recovery_use_ssl = 1

# Shared replication group configuration
loose-group_replication_group_name = "${GROUP_NAME}"
#loose-group_replication_ip_whitelist = "${hosts}"
#loose-group_replication_ip_whitelist = "AUTOMATIC"
#loose-group_replication_ip_allowlist = "AUTOMATIC"
loose-group_replication_ip_whitelist = "${whitelist}"
loose-group_replication_ip_allowlist = "${whitelist}"
loose-group_replication_group_seeds = "${seeds}"

# Single or Multi-primary mode? Uncomment these two lines
# for multi-primary mode, where any host can accept writes
loose-group_replication_single_primary_mode = OFF
loose-group_replication_enforce_update_everywhere_checks = ON

# Host specific replication configuration
server_id = ${svr_id}
#bind-address = "${report_host}"
#bind-address = "0.0.0.0"
bind-address = *
report_host = "${report_host}"
loose-group_replication_local_address = "${report_host}:33061"
socket="/var/run/mysqld/mysqld.sock"
EOL
else
cat >>/etc/mysql/group-replication.conf.d/group.cnf <<EOL
[mysqld]
mysql_native_password=ON
Expand Down Expand Up @@ -145,6 +189,7 @@ report_host = "${report_host}"
loose-group_replication_local_address = "${report_host}:33061"
socket="/var/run/mysqld/mysqld.sock"
EOL
fi

# wait for mysql daemon be running (alive)
function wait_for_mysqld_running() {
Expand Down