This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# replica_bootstrap.sh – quick (re)bootstrap of a MySQL replica in Docker | |
# Author: [email protected] | |
# ---------------------------------------------------------------------- | |
set -euo pipefail | |
IFS=$'\n\t' | |
############################################################################## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timestamp=$(date +%Y-%m-%d_%H-%M-%S) | |
link="https://"$1"/?health=" | |
link+=$timestamp | |
echo $link | |
echo "Checking health ..." | |
if [ "$(curl --write-out "%{http_code}\n" --silent --output /dev/null $link )" == "200" ]; then | |
echo "All Good." | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mysqld] | |
relay-log = mysql-relay-bin.log | |
binlog_do_db = DB_NAME | |
log_bin = mysql-bin.log | |
server-id = 2 | |
tmpdir = /tmp | |
binlog_format = ROW | |
max_binlog_size = 500M | |
sync_binlog = 1 | |
expire-logs-days = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mysqld] | |
server-id = 1 | |
log-bin = mysql-bin-1.log | |
binlog_format = ROW | |
binlog_do_db = DB_NAME | |
tmpdir = /tmp | |
max_binlog_size = 500M | |
sync_binlog = 1 | |
expire-logs-days = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
db: | |
image: mysql:8.0 | |
container_name: db | |
restart: always | |
ports: | |
- $DB_PORT:3306 | |
command: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB_PORT= | |
DB_DATABASE= | |
DB_USERNAME= | |
DB_PASSWORD= |