Skip to content

Instantly share code, notes, and snippets.

@mazdel
Created June 20, 2025 18:44
Show Gist options
  • Select an option

  • Save mazdel/798a3db35a5e8e21ee4fe646ae1b56c2 to your computer and use it in GitHub Desktop.

Select an option

Save mazdel/798a3db35a5e8e21ee4fe646ae1b56c2 to your computer and use it in GitHub Desktop.
services:
# Manager
ndb-manager11:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: ndb_mgmd --ndb-nodeid=11
restart: unless-stopped
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- ndb-manager11:/var/lib/mysql
healthcheck:
test: ['CMD', 'ndb_mgm', '-e', 'SHOW']
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
ndb-network:
ipv4_address: 172.16.3.11
ndb-manager12:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: ndb_mgmd --ndb-nodeid=12
restart: unless-stopped
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- ndb-manager12:/var/lib/mysql
healthcheck:
test: ['CMD', 'ndb_mgm', '-e', 'SHOW']
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
ndb-network:
ipv4_address: 172.16.3.12
# Data Node
## Group 0
ndb-node31:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: ndbd --ndb-nodeid=31
restart: unless-stopped
healthcheck:
test: ['CMD', 'ndb_waiter']
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
depends_on:
ndb-manager11:
condition: service_healthy
ndb-manager12:
condition: service_healthy
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- ndb-node31:/var/lib/mysql
networks:
ndb-network:
ipv4_address: 172.16.3.31
ndb-node32:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: ndbd --ndb-nodeid=32
restart: unless-stopped
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- ndb-node32:/var/lib/mysql
healthcheck:
test: ['CMD', 'ndb_waiter']
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
depends_on:
ndb-manager11:
condition: service_healthy
ndb-manager12:
condition: service_healthy
networks:
ndb-network:
ipv4_address: 172.16.3.32
## Group 1
ndb-node41:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: ndbd --ndb-nodeid=41
restart: unless-stopped
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- ndb-node41:/var/lib/mysql
healthcheck:
test: ['CMD', 'ndb_waiter']
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
depends_on:
ndb-manager11:
condition: service_healthy
ndb-manager12:
condition: service_healthy
networks:
ndb-network:
ipv4_address: 172.16.3.41
ndb-node42:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: ndbd --ndb-nodeid=42
restart: unless-stopped
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- ndb-node42:/var/lib/mysql
healthcheck:
test: ['CMD', 'ndb_waiter']
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
depends_on:
ndb-manager11:
condition: service_healthy
ndb-manager12:
condition: service_healthy
networks:
ndb-network:
ipv4_address: 172.16.3.42
# mysql-interface
## mysqld-20
mysql-node20:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: mysqld --user=mysql --server-id=20
restart: unless-stopped
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- mysql-node20:/var/lib/mysql
depends_on:
- ndb-node31
- ndb-node32
- ndb-node41
- ndb-node42
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
TZ: Asia/Jakarta
healthcheck:
test:
[
'CMD',
'mysqladmin',
'ping',
'-h',
'localhost',
'-uroot',
'-p${MYSQL_ROOT_PASSWORD}',
]
interval: 10s
timeout: 10s
retries: 5
start_period: 60s
networks:
ndb-network:
ipv4_address: 172.16.3.20
## mysqld-21
mysql-node21:
image: container-registry.oracle.com/mysql/community-cluster:latest
command: mysqld --user=mysql --server-id=21
restart: unless-stopped
volumes:
- ./configs/mysql/my.cnf:/etc/my.cnf
- ./configs/mysql/mysql-cluster.cnf:/etc/mysql-cluster.cnf
- mysql-node21:/var/lib/mysql
depends_on:
- ndb-node31
- ndb-node32
- ndb-node41
- ndb-node42
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
TZ: Asia/Jakarta
healthcheck:
test:
[
'CMD',
'mysqladmin',
'ping',
'-h',
'localhost',
'-uroot',
'-p${MYSQL_ROOT_PASSWORD}',
]
interval: 10s
timeout: 10s
retries: 5
start_period: 60s
networks:
ndb-network:
ipv4_address: 172.16.3.21
mysql-haproxy:
image: haproxytech/haproxy-ubuntu:latest
restart: unless-stopped
depends_on:
mysql-node20:
condition: service_healthy
mysql-node21:
condition: service_healthy
ports:
- ${HAP_MYSQL_PUBLIC_PORT}:3306
volumes:
- ./configs/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
networks:
ndb-network:
ipv4_address: 172.16.3.254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment