当我通过 Supervisord 运行 MariaDB 时,它总是退出

当我通过 Supervisord 运行 MariaDB 时,它总是退出

我正在尝试在 rkt 中设置 LEMP 堆栈(使用 Docker 文件),因此我使用 Supervisord 让所有内容在同一个容器中运行。当我单独构建并启动 Mariadb 容器时,它运行良好。当我尝试通过 Supervisord 运行它时,MariaDB 会立即退出。我做错了什么?

我也想将 Supervisord 用于其他用途,因此每次运行时我都会发送此信息: RUN printf "\n[program:mysqld]\ncommand=sleep 5; mysqld_safe --skip-syslog\nstartretries=10\n" >> /etc/supervisor/conf.d/supervisord.conf

我为了测试目的添加了 Sleep 5 和 startretries。

错误日志如下:

161130  9:32:25 [Note] InnoDB: Using mutexes to ref count buffer pool pages
161130  9:32:25 [Note] InnoDB: The InnoDB memory heap is disabled
161130  9:32:25 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
161130  9:32:25 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
161130  9:32:25 [Note] InnoDB: Compressed tables use zlib 1.2.8
161130  9:32:25 [Note] InnoDB: Using Linux native AIO
161130  9:32:25 [Note] InnoDB: Using CPU crc32 instructions
161130  9:32:25 [Note] InnoDB: Initializing buffer pool, size = 128.0M
161130  9:32:25 [Note] InnoDB: Completed initialization of buffer pool
161130  9:32:25 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
161130  9:32:25 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
161130  9:32:25 [Note] InnoDB: Database physically writes the file full: wait...
161130  9:32:25 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
161130  9:32:25 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
161130  9:32:26 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
161130  9:32:26 [Warning] InnoDB: New log files created, LSN=45781
161130  9:32:26 [Note] InnoDB: Doublewrite buffer not found: creating new
161130  9:32:26 [Note] InnoDB: Doublewrite buffer created
161130  9:32:26 [Note] InnoDB: 128 rollback segment(s) are active.
161130  9:32:26 [Warning] InnoDB: Creating foreign key constraint system tables.
161130  9:32:26 [Note] InnoDB: Foreign key constraint system tables created
161130  9:32:26 [Note] InnoDB: Creating tablespace and datafile system tables.
161130  9:32:26 [Note] InnoDB: Tablespace and datafile system tables created.
161130  9:32:26 [Note] InnoDB: Creating zip_dict and zip_dict_cols system tables.
161130  9:32:26 [Note] InnoDB: zip_dict and zip_dict_cols system tables created.
161130  9:32:26 [Note] InnoDB: Waiting for purge to start
161130  9:32:26 [Note] InnoDB:  Percona XtraDB (link removed) 5.6.32-79.0 started; log sequence number 0

[这里有很多重复]

161130  9:32:44 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
161130  9:32:45 [Note] InnoDB: Shutdown completed; log sequence number         1623609
161130  9:32:45 [Note] InnoDB: Using mutexes to ref count buffer pool pages
161130  9:32:45 [Note] InnoDB: The InnoDB memory heap is disabled
161130  9:32:45 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
161130  9:32:45 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
161130  9:32:45 [Note] InnoDB: Compressed tables use zlib 1.2.8
161130  9:32:45 [Note] InnoDB: Using Linux native AIO
161130  9:32:45 [Note] InnoDB: Using CPU crc32 instructions
161130  9:32:45 [Note] InnoDB: Initializing buffer pool, size = 128.0M
161130  9:32:45 [Note] InnoDB: Completed initialization of buffer pool
161130  9:32:45 [Note] InnoDB: Highest supported file format is Barracuda.
161130  9:32:45 [Note] InnoDB: 128 rollback segment(s) are active.
161130  9:32:45 [Note] InnoDB: Waiting for purge to start
161130  9:32:46 [Note] InnoDB:  Percona XtraDB (link removed) 5.6.32-79.0 started; log sequence number 1623609
161130  9:32:46 [Note] Plugin 'FEEDBACK' is disabled.
161130  9:32:46 [Note] InnoDB: FTS optimize thread exiting.
161130  9:32:46 [Note] InnoDB: Starting shutdown...
161130  9:32:47 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
161130  9:32:48 [Note] InnoDB: Shutdown completed; log sequence number 1623619

没有任何错误,它只是开始关闭。

有想法吗?

答案1

好的,最终我让它运行了。我添加了在这里找到的两件事:https://github.com/Kloadut/dokku-md-dockerfiles/tree/469a32ed0696803808cd07413f13ee22c7b0e6e2

# prevent apt from starting mariadb right after the installation RUN printf '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d; chmod +x /usr/sbin/policy-rc.d

搭配:

# allow autostart again RUN rm /usr/sbin/policy-rc.d

然后另一件事是我正在运行一个脚本文件,执行一些安全安装数据库的操作,它以以下内容结束:

tail -f /var/log/mysql.log /var/log/mysql.err /var/log/mysql/mariadb-slow.log

就是这样。真的不知道为什么没有这些会导致 MariaDB 停止,因为我没见过它们在其他地方使用。tail -f 的事情特别奇怪,因为我认为 Supervisord 会处理它。

无论如何,如果其他人也遇到这种情况,请查看上面链接中的 Dockerfile 和脚本文件。对我来说这就是全部了。

相关内容