Skip to content

Commit

Permalink
Replication fails in the ICPC image
Browse files Browse the repository at this point in the history
Because we have more interfaces we need to specify which network
interface we want to use.
  • Loading branch information
Michael Vasseur committed Mar 17, 2024
1 parent 07bfc95 commit b9f1051
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vrrp_instance lb_ipv4 {
state MASTER
interface {{ ansible_facts['default_ipv4']['interface'] }}
interface {{ KEEPALIVED_INTERFACE|default(ansible_facts['default_ipv4']['interface']) }}
use_vmac
virtual_router_id 32
priority {{KEEPALIVED_PRIORITY}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
regexp: '^bind-address\s*='
replace: '#bind-address ='

- name: Set the replication interface variable
set_fact:
replication_interface: "{{ REPLICATION_INTERFACE|default(ansible_default_ipv4.interface) }}"

- name: Set the variable for the IP address of the replication interface
set_fact:
replication_interface_ip_address: "{{ vars['ansible_' + replication_interface]['ipv4']['address'] }}"

- name: Add mysql config snippet for replication
template:
src: mysql.replication.cnf.j2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ log-bin = /var/log/mysql/mysql-bin.log
binlog_do_db = domjudge

# Host specific replication configuration
server_id = {{ ansible_default_ipv4.address | ipaddr('int') }}
server_id = {{ replication_interface_ip_address | ipaddr('int') }}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ service mysql start

echo "Starting replication locally..."
mysql -e "
CHANGE MASTER TO MASTER_HOST='{{ SERVER_IP_PREFIX }}.${PRIMARY_SERVER_ID}',
CHANGE MASTER TO MASTER_HOST='${PRIMARY}',
MASTER_USER='replication',
MASTER_PASSWORD='{{ REPLICATION_PASSWORD }}',
MASTER_LOG_FILE='${PRIMARY_BINLOG}',
Expand Down Expand Up @@ -217,7 +217,7 @@ OUR_LOGPOS=$(get_field 'Position' "$OUR_STATUS")
if [ "$SETUP_MASTER_MASTER" -eq 1 ]; then
echo "Starting replication on $PRIMARY..."
ssh "$PRIMARY" "mysql -e '
CHANGE MASTER TO MASTER_HOST=\"{{ SERVER_IP_PREFIX }}.${OUR_SERVER_ID}\",
CHANGE MASTER TO MASTER_HOST=\"{{ replication_interface_ip_address }}\",
MASTER_USER=\"replication\",
MASTER_PASSWORD=\"{{ REPLICATION_PASSWORD }}\",
MASTER_LOG_FILE=\"${OUR_BINLOG}\",
Expand Down

0 comments on commit b9f1051

Please sign in to comment.