2016-12-15 71 views
0

問題MySQL的自動重新啓動

MySQL正在啓動後關閉 - 即使mysqld的報告 「準備連接」。我只是使用公共可用的mysql映像。

有誰知道是否有某種設置或錯誤會導致重新啓動?

日誌不包含任何可能表示重新啓動的錯誤。重新啓動後,數據庫看起來工作正常,但我真的很想避免這種初始重新啓動,因爲它會導致自動化很糟糕。

環境

的MySQL版本:33年6月5日泊塢圖片

平臺: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'相同),你是否還在這個容器上做了任何額外的事情,比如導入數據庫或其他東西? – ReynierPM

+0

我試過使用5.7,但遇到同樣的問題 - 我可以嘗試絕對最新的,但想要保留5.x版本的平價原因與產品。 @ReynierPM我注意到它第一次啓動時報告「port:0」,它第二次報告「準備好連接」,它顯示了我指定的端口「port: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,但默認情況下mysql啓動3306,所以你可能必須使用該值,如果你去這種方法。 – sager89

0

我也遇到過這個問題。我能夠通過選擇alternate image來克服它。這一個爲圖像添加健康檢查,並提供一個腳本,當mysql準備就緒時將運行該腳本。