在Docker Container中正确关闭MySQL 4

时间:2017-04-19 10:42:17

标签: mysql docker

对于某些(非常)遗留应用程序,我需要安装MySQL 4。基于

我创建了一个docker容器,通常可以正常工作。粗略地说,他们做了以下事情

  • 从源代码
  • 编译MySQL 4.1.25
  • 添加一个大致完成以下内容的入口点

    if [ "$1" = 'mysqld_safe' ]; then
       # do some things to initialize database if required
    fi
    
    exec "$@"
    
  • 使用

    调用
    ENTRYPOINT ["/path/to/entrypoint.sh"]
    CMD ["mysqld_safe"]
    

但是,我有以下问题:停止docker容器时,似乎mysqld_safe没有正确关闭。当我重新启动容器时,我收到以下错误日志

170419 11:23:44  mysqld started
170419 11:23:44  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
170419 11:23:44  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 43684.
InnoDB: Doing recovery: scanned up to log sequence number 0 43684
InnoDB: Last MySQL binlog file position 0 79, file name ./09601db873a9-bin.000003
170419 11:23:44  InnoDB: Flushing modified pages from the buffer pool...
170419 11:23:44  InnoDB: Started; log sequence number 0 43684
/usr/local/mysql/libexec/mysqld: ready for connections.
Verion: '4.1.25-log'  ssocket: '/tmp/mysql.sock'  port: 3306  Source distribution

这似乎发生了,因为mysqld_safe基本上忽略了任何信号(/usr/local/myslq/bin/mysqld_safe的第16行):

trap '' 1 2 3 15            # we shouldn't let anyone kill us

这让我觉得mysqld_safe可能不是在容器中启动MySQL的正确方法吗?在docker容器中启动和停止MySQL 4的推荐方法是什么? (不幸的是,容器必须偶尔停止。)

0 个答案:

没有答案