用kolla部署的带有高可用的openstack环境中,如果重启控制节点,经常出现mariadb容器无法启动的问题,解决方法如下:
1.ssh到无法启动mariadb容器的控制节点,停止mariadb容器。docker stop mariadb.
2.备份mariadb的配置文件。cp /etc/kolla/mariadb/config.json /etc/kolla/mariadb/config.json.bck
3.vim /etc/kolla/mariadb/config,将“command”:"/usr/bin/mysqld_safe"改为“command”:“sleep 3600”
4.启动mariadb容器。docker start mariadb
5.进入mariadb容器。docker exec -it mariadb bash
6.执行mysqld_safe,验证是否出现Found 1 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file)
was manually deleted after a crash.You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions的错误。
7.若出现此错误,执行mysqld_safe --tc-heuristic-revocer rollback.
8.数据库回滚完成后,将/etc/kolla/mariadb/config.json恢复为原来配置,重启docker,问题解决! |