2016-12-15 7 views
0

問題再起動:MySQLは自動的に

をMySQLは起動後にシャットダウンして - でもmysqldを報告した後、 "接続の準備"。私は単に公開されているmysqlイメージを使用しています。

再起動の原因となる何らかの設定やエラーがある場合は誰にも知られていますか?

ログには、再起動が発生したことを示すエラーは含まれません。再起動後、データベースはうまく動作しているように見えますが、この初期再起動を避けるのは本当にうまくいくでしょう。

環境

MySQLのバージョン:5.6.33ドッカーイメージ

プラットフォーム:Ubuntuのトラスティ

ドッカー-作曲エントリ:

myDatabase: 
    image: mysql:5.6 
    environment: 
     - MYSQL_DATABASE=myDatabase 
     - MYSQL_ROOT_PASSWORD=FakeyMcFakeFace 
    command: 
     - --port=3307 
     - --sql-mode=NO_ENGINE_SUBSTITUTION 
     - --max_allowed_packet=16M 

ログ:

Initializing database 
2016-09-12 16:17:39 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 36 ... 
2016-09-12 16:17:39 36 [Note] InnoDB: Using atomics to ref count buffer pool pages 
2016-09-12 16:17:39 36 [Note] InnoDB: The InnoDB memory heap is disabled 
2016-09-12 16:17:39 36 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2016-09-12 16:17:39 36 [Note] InnoDB: Memory barrier is not used 
2016-09-12 16:17:39 36 [Note] InnoDB: Compressed tables use zlib 1.2.8 
2016-09-12 16:17:39 36 [Note] InnoDB: Using Linux native AIO 
2016-09-12 16:17:39 36 [Note] InnoDB: Using CPU crc32 instructions 

2016-09-12 16:17:39 36 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2016-09-12 16:17:39 36 [Note] InnoDB: Completed initialization of buffer pool 
2016-09-12 16:17:39 36 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 
2016-09-12 16:17:39 36 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 
2016-09-12 16:17:39 36 [Note] InnoDB: Database physically writes the file full: wait... 

2016-09-12 16:17:39 36 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 

2016-09-12 16:17:39 36 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 

2016-09-12 16:17:40 36 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 
2016-09-12 16:17:40 36 [Warning] InnoDB: New log files created, LSN=45781 
2016-09-12 16:17:40 36 [Note] InnoDB: Doublewrite buffer not found: creating new 

2016-09-12 16:17:40 36 [Note] InnoDB: Doublewrite buffer created 
2016-09-12 16:17:40 36 [Note] InnoDB: 128 rollback segment(s) are active. 
2016-09-12 16:17:40 36 [Warning] InnoDB: Creating foreign key constraint system tables. 
2016-09-12 16:17:40 36 [Note] InnoDB: Foreign key constraint system tables created 
2016-09-12 16:17:40 36 [Note] InnoDB: Creating tablespace and datafile system tables. 

2016-09-12 16:17:40 36 [Note] InnoDB: Tablespace and datafile system tables created. 
2016-09-12 16:17:40 36 [Note] InnoDB: Waiting for purge to start 

2016-09-12 16:17:40 36 [Note] InnoDB: 5.6.33 started; log sequence number 0 

2016-09-12 16:17:42 36 [Note] Binlog end 
2016-09-12 16:17:42 36 [Note] InnoDB: FTS optimize thread exiting. 
2016-09-12 16:17:42 36 [Note] InnoDB: Starting shutdown... 
2016-09-12 16:17:45 36 [Note] InnoDB: Shutdown completed; log sequence number 1625977 
2016-09-12 16:17:45 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 59 ... 

2016-09-12 16:17:45 59 [Note] InnoDB: Using atomics to ref count buffer pool pages 
2016-09-12 16:17:45 59 [Note] InnoDB: The InnoDB memory heap is disabled 

2016-09-12 16:17:45 59 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2016-09-12 16:17:45 59 [Note] InnoDB: Memory barrier is not used 
2016-09-12 16:17:45 59 [Note] InnoDB: Compressed tables use zlib 1.2.8 

2016-09-12 16:17:45 59 [Note] InnoDB: Using Linux native AIO 

2016-09-12 16:17:45 59 [Note] InnoDB: Using CPU crc32 instructions 
2016-09-12 16:17:45 59 [Note] InnoDB: Initializing buffer pool, size = 128.0M 

2016-09-12 16:17:45 59 [Note] InnoDB: Completed initialization of buffer pool 
2016-09-12 16:17:45 59 [Note] InnoDB: Highest supported file format is Barracuda. 

2016-09-12 16:17:45 59 [Note] InnoDB: 128 rollback segment(s) are active. 
2016-09-12 16:17:45 59 [Note] InnoDB: Waiting for purge to start 

2016-09-12 16:17:46 59 [Note] InnoDB: 5.6.33 started; log sequence number 1625977 

2016-09-12 16:17:46 59 [Note] Binlog end 
2016-09-12 16:17:46 59 [Note] InnoDB: FTS optimize thread exiting. 
2016-09-12 16:17:46 59 [Note] InnoDB: Starting shutdown... 

2016-09-12 16:17:48 59 [Note] InnoDB: Shutdown completed; log sequence number 1625987 

WARNING: Default config file /etc/mysql/my.cnf exists on the system 
This file will be read by default by the MySQL server 
If you do not want to use this, either remove it, or use the 
--defaults-file argument to mysqld_safe when starting the server 

Database initialized 

MySQL init process in progress... 



    [Note] mysqld (mysqld 5.6.33) starting as process 82 ... [Note] Plugin 'FEDERATED' is disabled. [Note] InnoDB: Using atomics to ref count buffer pool pages [Note] InnoDB: The InnoDB memory heap is disabled [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins [Note] InnoDB: Memory barrier is not used [Note] InnoDB: Compressed tables use zlib 1.2.8 [Note] InnoDB: Using Linux native AIO [Note] InnoDB: Using CPU crc32 instructions [Note] InnoDB: Initializing buffer pool, size = 128.0M [Note] InnoDB: Completed initialization of buffer pool [Note] InnoDB: Highest supported file format is Barracuda. [Note] InnoDB: 128 rollback segment(s) are active. [Note] InnoDB: Waiting for purge to start [Note] InnoDB: 5.6.33 started; log sequence number 1625987 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 726b21ff-7904-11e6-a7fd-0242ac130006. stdout: [Note] Event Scheduler: Loaded 0 events [Note] mysqld: ready for connections. Version: '5.6.33' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL) Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. 2016-09-12 16:17:52 82 
[Note] mysqld: Normal shutdown 

この通常のシャットダウンの後、再び起動し、「接続準備完了」と表示され、その後は接続が維持されているように見えます。

+0

この質問はSW開発ではなく操作に関するものであるため、DBAはsw開発者よりもこの質問に答えやすいでしょう。 – Shadow

+0

それは変です、私は 'mysql:latest'イメージを使用しています。代わりに 'mysql'を試すことができますか? ( 'mysql:latest'と同じ場合)また、このコンテナにDBやその他のものをインポートするような何かをしていますか? – ReynierPM

+0

私は5.7を使用しようとしましたが、同じ問題をそこにも実行しました - 私は絶対最新の試みができますが、produtctionとパリティの理由のために5.xのバージョンを維持したい。 @ReynierPM私が気づいたのは、起動時に「ポート:0」と報告され、「接続準備ができました」と報告された2回目の時に指定したポート「3307」 – sager89

答えて

1

明らかにこれは予想される動作ですが、ログからは明らかではありません。 https://github.com/docker-library/mysql/issues/245

私がこれを回避する方法は、ログにデータベースを接続しようとする前に、socket: '/var/run/mysqld/mysqld.sock' port: 3307 MySQL Community Server (GPL)が存在するかどうかを調べることでした。

+0

私は3307を指定していますが、デフォルトでは3306で始まりますので、この方法を使用する場合はその値を使用する必要があります。 – sager89

0

私もこの問題に直面していました。私はalternate imageを選んでそれを越えることができました。これは、イメージに健康チェックを追加し、mysqlの準備が整うと実行されるスクリプトを提供するための規定も追加します。