Skip to content

Commit

Permalink
Add mysql-slave
Browse files Browse the repository at this point in the history
  • Loading branch information
a-h-abid committed Oct 18, 2024
1 parent 1457a97 commit 779ae3b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mysql-slave/.example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://github.com/bitnami/containers/blob/main/bitnami/mysql/README.md#environment-variables

MYSQL_ROOT_PASSWORD=secret
MYSQL_REPLICATION_USER=slaveuser
MYSQL_REPLICATION_PASSWORD=slavepass
MYSQL_REPLICATION_MODE=slave
MYSQL_CHARACTER_SET=utf8mb4
MYSQL_COLLATE=utf8mb4_0900_ai_ci
MYSQL_ENABLE_SLOW_QUERY=0
MYSQL_LONG_QUERY_TIME=2
# MYSQL_EXTRA_FLAGS=
# MYSQL_SQL_MODE=

MYSQL_MASTER_HOST=common-mysql
MYSQL_MASTER_PORT_NUMBER=3306
MYSQL_MASTER_ROOT_PASSWORD=secret
2 changes: 2 additions & 0 deletions mysql-slave/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/data
/my_custom.cnf
20 changes: 20 additions & 0 deletions mysql-slave/compose.mysql-slave.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
volumes:
common-mysql-slave:
name: 'common-mysql-slave'

services:
mysql-slave:
image: 'bitnami/mysql:${MYSQL_IMAGE_TAG:-8.4.3}'
depends_on:
- mysql
env_file:
- .env
networks:
common-net:
aliases:
- common-mysql-slave
# ports:
# - 127.0.0.1:${MYSQL_SLAVE_PUBLISH_PORT:-3307}:3306
volumes:
- common-mysql-slave:/var/lib/mysql
- ./my_custom.cnf:/opt/bitnami/mysql/conf/my_custom.cnf:ro
5 changes: 5 additions & 0 deletions mysql-slave/my_custom.example.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[mysql]
local-infile=1

[mysqld]
secure-file-priv=""
7 changes: 7 additions & 0 deletions mysql-slave/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# MySQL (Slave)

This service is used to replicate the slave instance of MySQL.

<u>Reference:</u>
* [Official MySQL Documentation](https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-3.html)
* [Bitnami MySQL](https://github.com/bitnami/containers/blob/main/bitnami/mysql/README.md)

0 comments on commit 779ae3b

Please sign in to comment.