MySQL 8.0.0和Docker构成问题

时间:2019-06-25 11:23:28

标签: mysql docker

我在docker-compose.yml中指定了MySql 8.0.0的版本,但是遇到了一些问题(我没有指定版本)。怎么了?

下面您可以找到我的docker-compose.yml和错误日志:

version: '3.7'
services:
db:
    image: mysql:8.0.0
    command: ["--default-authentication-plugin=mysql_native_password"]
    ports:
        - "3306:3306"
    environment:
        MYSQL_ROOT_PASSWORD: root
        MYSQL_USER: symfony
        MYSQL_PASSWORD: symfony
php:
    build: ./php-fpm
    ports:
        - "9000:9001"
    volumes:
        - ./symfony:/var/www/symfony:cached
        - ./logs/symfony:/var/www/symfony/var/log:cached
    links:
        - db
    extra_hosts:
        - "docker-host.localhost:127.0.0.1"
        - "symfony.localhost:172.24.0.5"
nginx:
    build: ./nginx
    ports:
        - "80:80"
    links:
        - php
    volumes:
        - ./logs/nginx:/var/log/nginx:cached
        - ./symfony:/var/www/symfony:cached

elk:
    image: willdurand/elk
    ports:
        - "81:80"
    volumes:
        - ./elk/logstash:/etc/logstash:cached
        - ./elk/logstash/patterns:/opt/logstash/patterns:cached
        - ./logs/symfony:/var/www/symfony/var/log:cached
        - ./logs/nginx:/var/log/nginx:cached

并记录:

db_1     | 2019-06-25T11:12:28.129419Z 0 [Warning] TIMESTAMP with 
implicit DEFAULT value is deprecated. Please use -- 
explicit_defaults_for_timestamp server option (see documentation for 
more details).
db_1     | 2019-06-25T11:12:28.130523Z 0 [Note] mysqld (mysqld 8.0.0- 
dmr) starting as process 1 ...
db_1     | 2019-06-25T11:12:28.134864Z 0 [Note] InnoDB: Using Linux 
native AIO
db_1     | 2019-06-25T11:12:28.135137Z 0 [Note] Plugin 'FEDERATED' is 
disabled.
db_1     | 2019-06-25T11:12:28.136567Z 1 [Note] InnoDB: PUNCH HOLE 
support available
db_1     | 2019-06-25T11:12:28.136614Z 1 [Note] InnoDB: Mutexes and 
rw_locks use GCC atomic builtins
db_1     | 2019-06-25T11:12:28.136620Z 1 [Note] InnoDB: Uses event 
mutexes
db_1     | 2019-06-25T11:12:28.136623Z 1 [Note] InnoDB: GCC builtin 
__atomic_thread_fence() is used for memory barrier
db_1     | 2019-06-25T11:12:28.136626Z 1 [Note] InnoDB: Compressed 
tables use zlib 1.2.3
db_1     | 2019-06-25T11:12:28.137151Z 1 [Note] InnoDB: Number of 
pools: 1
db_1     | 2019-06-25T11:12:28.137390Z 1 [Note] InnoDB: Using CPU 
crc32 instructions
db_1     | 2019-06-25T11:12:28.139057Z 1 [Note] InnoDB: Initializing 
buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1     | libnuma: Warning: /sys not mounted or invalid. Assuming one 
node: No such file or directory
db_1     | mbind: Operation not permitted
db_1     | mbind: Operation not permitted
db_1     | mbind: Operation not permitted
db_1     | mbind: Operation not permitted
db_1     | 2019-06-25T11:12:28.150384Z 1 [Note] InnoDB: Completed 
initialization of buffer pool
db_1     | 2019-06-25T11:12:28.152938Z 0 [Note] InnoDB: If the mysqld 
execution user is authorized, page cleaner thread priority can be 
changed. See the man page of setpriority().
db_1     | 2019-06-25T11:12:28.169513Z 1 [ERROR] InnoDB: Unsupported 
redo log format. The redo log was created with MySQL 8.0.15. Please 
follow the instructions at 
http://dev.mysql.com/doc/refman/8.0/en/upgrading-downgrading.html
db_1     | 2019-06-25T11:12:28.169587Z 1 [ERROR] InnoDB: Plugin 
initialization aborted with error Generic error
db_1     | 2019-06-25T11:12:28.774335Z 1 [ERROR] Failed to initialize 
DD Storage Engine
db_1     | 2019-06-25T11:12:28.774965Z 0 [ERROR] Data Dictionary 
initialization failed.
db_1     | 2019-06-25T11:12:28.775132Z 0 [ERROR] Aborting
db_1     |
db_1     | 2019-06-25T11:12:28.775198Z 0 [Note] Binlog end
db_1     | 2019-06-25T11:12:28.775614Z 0 [Note] Shutting down plugin 
'InnoDB'
db_1     | 2019-06-25T11:12:28.775986Z 0 [Note] Shutting down plugin 
'MyISAM'
 db_1     | 2019-06-25T11:12:28.776099Z 0 [Note] Shutting down plugin 
'CSV'
db_1     | 2019-06-25T11:12:28.779905Z 0 [Note] mysqld: Shutdown 
complete
db_1     |
docker-symfony4-udggui_db_1 exited with code 1

1 个答案:

答案 0 :(得分:2)

未将版本指定为image: mysql时,它将使用最新版本。此时,提出的问题是8.0.16,请参阅this

当您将版本指定为image: mysql:8.0.0时,您仅使用旧版本的mysql。

不幸的是,此版本与下一个新的docker不兼容:

  

服务器将mbind用于NUMA(非统一内存访问)操作,但是Docker默认情况下会阻止此访问。可以提供一个允许它的自定义配置文件,但是配置文件的语法在Docker版本之间有所变化,因此有点混乱。

这意味着,该映像在较早的时候可以工作,但是现在docker升级了,mysql映像应该进行相应的更改。而且,8.0.16(当前是最新的)已经进行了此修复,因此可以。详细信息请参见下一个讨论:

https://github.com/docker-library/mysql/issues/303

https://github.com/docker-library/mysql/issues/422