我正在使用以下 Dockerfile
从official mariadb docker image构建自定义图像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
构建映像并作为容器运行后,我进入容器,终止睡眠过程并启动 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群集? 提前谢谢。
答案 0 :(得分:1)
我将以下部分添加到导入容器的my.cnf中,我不确定,但似乎某些参数未通过环境变量正确插入(wsrep_on有效,wsrep_provider没有&#39 ; t)。
节点1
[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
节点2
[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