无法使用官方Docker MariaDB映像引导Galera群集

我正在使用以下Dockerfile从官方mariadb泊坞窗图像构build自定义图像

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"] 

而custom-docker-entrypoint.sh包含

 sleep 3600 exec docker-entrypoint.sh mysqld --wsrep-new-cluster 

在image创build并作为容器运行之后,我进入容器,杀死进程并启动mysqld进程。 问题是群集不是自举的。

 SHOW GLOBAL STATUS LIKE 'wsrep_%'; 

回报

 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 

如何正确使用这个图像运行Galera集群? 提前致谢。

我添加了以下部分my.cnf导入容器,我不知道,但似乎有些参数不能正确插入通过环境variables(wsrep_on工作,wsrep_provider没有)。

节点1

 [galera] # Mandatory settings wsrep_on=ON wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_cluster_address=gcomm://172.xx211,172.xx210 wsrep-cluster-name=local-test wsrep_sst_method=rsync wsrep_node_address="172.xx210" wsrep_sst_auth=wsrep_user:wsrep_passwd 

节点2

 [galera] # Mandatory settings wsrep_on=ON wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_cluster_address=gcomm://172.xx211,172.xx210 wsrep-cluster-name=local-test wsrep_sst_method=rsync wsrep_node_address="172.xx211" wsrep_sst_auth=wsrep_user:wsrep_passwd