2016-12-15 4 views
0

Problème:MySQL Redémarrage automatique

MySQL est en cours d'arrêt après le démarrage - même après des rapports mysqld "prêt pour les connexions". J'utilise simplement l'image mysql disponible publiquement.

Est-ce que quelqu'un sait s'il y a une sorte de réglage ou erreur qui causerait un redémarrage?

Les journaux ne comprennent pas d'erreurs qui indiqueraient un redémarrage se passerait-il. Après le redémarrage, la base de données semble fonctionner correctement, mais j'aimerais vraiment éviter ce redémarrage initial, car cela détraque l'automatisation.

Environnement:

MySQL Version: 05/06/33 Docker image

Plate-forme: Ubuntu Trusty

Docker-Compose Entrée:

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 

Journaux:

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 

Après cet arrêt normal, il démarre à nouveau et fera rapport « prêt pour les connexions » à nouveau, après quoi il semble rester.

+0

Les administrateurs de bases de données seraient mieux placés pour répondre à cette question que les développeurs de logiciels parce que cette question concerne les opérations et non le développement. – Shadow

+0

C'est bizarre, j'utilise l'image 'mysql: latest' et ça marche. Pouvez-vous essayer 'mysql' à la place? (si c'est la même chose que 'mysql: latest') faites-vous aussi quelque chose de plus sur ce conteneur comme importer une base de données ou autre chose? – ReynierPM

+0

J'ai essayé d'utiliser 5.7 mais j'ai aussi rencontré le même problème - je peux essayer le dernier en date, mais je voulais conserver une version 5.x pour des raisons de parité avec produtction. @ReynierPM J'ai remarqué que la première fois qu'il démarre, il signale "port: 0", la deuxième fois il signale "prêt pour les connexions", il montre le port que j'ai spécifié, "port: 3307" – sager89

Répondre

1

Apparemment, ce comportement est normal, bien qu'il soit pas facilement ressort clairement des journaux. Voir https://github.com/docker-library/mysql/issues/245

La façon dont j'ai travaillé autour de cela était d'analyser les journaux à la recherche socket: '/var/run/mysqld/mysqld.sock' port: 3307 MySQL Community Server (GPL) d'être présent avant d'essayer de se connecter à la base de données.

+0

Notez que je spécifie 3307, mais par défaut mysql commence sur 3306, vous devrez donc utiliser cette valeur si vous allez avec cette approche. – sager89

0

Je faisais face à ce problème aussi. J'ai été en mesure de passer en choisissant un alternate image. Celui-ci ajoute un healthcheck à l'image et aussi une provision pour fournir un script qui sera exécuté quand mysql est prêt.