Skip to content

Commit

Permalink
Add Multi Primary Support for V8.4.2 (#41)
Browse files Browse the repository at this point in the history
* Add Multi Primary Support

Signed-off-by: raihankhan <[email protected]>
Co-authored-by: raihankhan <[email protected]>
  • Loading branch information
AshrafulHaqueToni and raihankhan committed Dec 17, 2024
1 parent 759ac78 commit c834275
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
branches:
- "*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-ci
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v1

- name: Print version info
id: semver
run: |
make version
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build
run: |
make container
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]
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
Expand Down Expand Up @@ -144,6 +188,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

0 comments on commit c834275

Please sign in to comment.