Reputation: 10720
I'm building custom image from official mariadb docker image using the following Dockerfile
FROM mariadb:10.1
COPY custom-docker-entrypoint.sh /custom-docker-entrypoint.sh
ENV MYSQL_ROOT_PASSWORD test
ENV MYSQL_DATABASE scheduler
ENV MYSQL_USER scheduler_user
ENTRYPOINT ["/custom-docker-entrypoint.sh"]
While custom-docker-entrypoint.sh contains
sleep 3600
exec docker-entrypoint.sh mysqld --wsrep-new-cluster
After image is built and run as container, i enter the container, kill the sleep process and mysqld process starts. The problem is that cluster is not bootstrapped.
SHOW GLOBAL STATUS LIKE 'wsrep_%';
returns
Variable_name | Value |
+--------------------------+----------------------+
| wsrep_cluster_conf_id | 18446744073709551615 |
| wsrep_cluster_size | 0 |
| wsrep_cluster_state_uuid | |
| wsrep_cluster_status | Disconnected |
| wsrep_connected | OFF |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 18446744073709551615 |
| wsrep_provider_name | |
| wsrep_provider_vendor | |
| wsrep_provider_version | |
| wsrep_ready | OFF |
| wsrep_thread_count | 0
How to run the Galera cluster correctly using this image? Thanks in advance.
Upvotes: 0
Views: 917
Reputation: 11
I added the following sections to my.cnf that is imported into the container, I'm not sure but it seems that some parameters aren't inserted correctly via enviroment variables ( wsrep_on worked , wsrep_provider didn't ).
node1
[galera]
# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://172.x.x.211,172.x.x.210
wsrep-cluster-name=local-test
wsrep_sst_method=rsync
wsrep_node_address="172.x.x.210"
wsrep_sst_auth=wsrep_user:wsrep_passwd
node2
[galera]
# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://172.x.x.211,172.x.x.210
wsrep-cluster-name=local-test
wsrep_sst_method=rsync
wsrep_node_address="172.x.x.211"
wsrep_sst_auth=wsrep_user:wsrep_passwd
Upvotes: 1