首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MySQL:8.0用了不寻常的时间在Docker中初始化

MySQL:8.0用了不寻常的时间在Docker中初始化
EN

Stack Overflow用户
提问于 2018-04-09 11:24:52
回答 1查看 1.8K关注 0票数 0

正式的mysql:8.0 (又名8.0.4)图像花费了不寻常的时间(大约10+分钟)来初始化停靠(本地机器)中的数据库。

如果仔细查看日志的时间,最后一行执行时间为7分钟。

代码语言:javascript
复制
Initializing database
2018-04-09T10:00:29.926078Z 0 [Warning] [MY-011070] Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it is deprecated and will be removed in a future release.
2018-04-09T10:00:29.926165Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc) starting as process 30 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
2018-04-09T10:00:46.842725Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:00:46.903128Z 5 [Warning] [MY-010453] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2018-04-09T10:07:28.643932Z 5 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.

对于您的信息,在同一台计算机中,mysql:8.0.3根本不需要花费太多时间来初始化数据库。

这是我的配置:

操作系统:ubuntu16.04

代码语言:javascript
复制
$ docker version
Client:
 Version:   17.12.1-ce
 API version:   1.35
 Go version:    go1.9.4
 Git commit:    7390fc6
 Built: Tue Feb 27 22:17:40 2018
 OS/Arch:   linux/amd64

Server:
 Engine:
  Version:  17.12.1-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   7390fc6
  Built:    Tue Feb 27 22:16:13 2018
  OS/Arch:  linux/amd64
  Experimental: false

重新创建完整日志的进程:

代码语言:javascript
复制
$ docker pull mysql:8.0
8.0: Pulling from library/mysql
2a72cbf407d6: Pull complete 
38680a9b47a8: Pull complete 
4c732aa0eb1b: Pull complete 
c5317a34eddd: Pull complete 
f92be680366c: Pull complete 
e8ecd8bec5ab: Pull complete 
2a650284a6a8: Pull complete 
5127cdce4b46: Pull complete 
e20139ed3159: Pull complete 
4c9ba8a8a3da: Pull complete 
16cd0f3afb27: Pull complete 
0e4872d58e1f: Pull complete 
Digest: sha256:7004063f8bd0c7bade8d1c526b9b8f5188c8288f411d76ee4ba83131e00c6f02
Status: Downloaded newer image for mysql:8.0

$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:8.0
b9c5d67233743dc085c50244526f5b12bd862cd50cdc0cb889b2dc549c4a396d

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
b9c5d6723374        mysql:8.0           "docker-entrypoint.s…"   5 seconds ago       Up 3 seconds        3306/tcp            some-mysql

$ docker logs -f b9c5d6723374
Initializing database
2018-04-09T10:00:29.926078Z 0 [Warning] [MY-011070] Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it is deprecated and will be removed in a future release.
2018-04-09T10:00:29.926165Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc) starting as process 30 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
2018-04-09T10:00:46.842725Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:00:46.903128Z 5 [Warning] [MY-010453] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2018-04-09T10:07:28.643932Z 5 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644008Z 5 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644033Z 5 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644051Z 5 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644082Z 5 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644094Z 5 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644112Z 5 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644240Z 5 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:28.644257Z 5 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
Database initialized
MySQL init process in progress...
2018-04-09T10:07:44.797619Z 0 [Warning] [MY-011070] Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it is deprecated and will be removed in a future release.
2018-04-09T10:07:44.797712Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc-log) starting as process 64 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
MySQL init process in progress...
2018-04-09T10:07:45.990317Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:07:46.040103Z 0 [Warning] [MY-000000] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-04-09T10:07:46.046970Z 0 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047013Z 0 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047029Z 0 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047046Z 0 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047078Z 0 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047091Z 0 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.047107Z 0 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.050079Z 0 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.050115Z 0 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:46.058044Z 0 [System] [MY-010931] /usr/sbin/mysqld: ready for connections. Version: '8.0.4-rc-log'  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.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2018-04-09T10:07:50.304129Z 9 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304156Z 9 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304166Z 9 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304175Z 9 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304197Z 9 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304207Z 9 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304218Z 9 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304321Z 9 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:50.304332Z 9 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.

2018-04-09T10:07:53.074527Z 0 [System] [MY-010910] /usr/sbin/mysqld: Shutdown complete.

MySQL init process done. Ready for start up.

2018-04-09T10:07:53.336773Z 0 [Warning] [MY-011070] Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it is deprecated and will be removed in a future release.
2018-04-09T10:07:53.336883Z 0 [System] [MY-010116] /usr/sbin/mysqld (mysqld 8.0.4-rc-log) starting as process 1 ...
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
2018-04-09T10:07:54.704270Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
2018-04-09T10:07:54.833645Z 0 [Warning] [MY-000000] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-04-09T10:07:54.841847Z 0 [Warning] [MY-010315] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841879Z 0 [Warning] [MY-010315] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841894Z 0 [Warning] [MY-010315] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841908Z 0 [Warning] [MY-010315] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841931Z 0 [Warning] [MY-010323] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841940Z 0 [Warning] [MY-010323] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.841953Z 0 [Warning] [MY-010311] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.844864Z 0 [Warning] [MY-010330] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.844947Z 0 [Warning] [MY-010330] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-04-09T10:07:54.850382Z 0 [System] [MY-010931] /usr/sbin/mysqld: ready for connections. Version: '8.0.4-rc-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL).

此外,这个图像需要超过25分钟在微型库贝初始化数据库。

Minikube的配置:

环境

  • Minikube版本:v0.25.2
  • OS:Ubuntu16.04.4LTS
  • VM驱动程序:virtualbox
  • ISO版本:minkube-v0.25.1.iso

我使用的yaml文件:

代码语言:javascript
复制
apiVersion: v1
kind: Namespace
metadata:
  name: demo
spec:
  finalizers:
  - kubernetes
---
apiVersion: v1
kind: Service
metadata:
  name: mysql-gvr
  namespace: demo
spec:
  clusterIP: None
  sessionAffinity: None
  type: ClusterIP

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: mysql
  name: mysql-8
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  serviceName: mysql-gvr
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - env:
        - name: MYSQL_ROOT_PASSWORD
          value : "test"
        image: mysql:8.0
        name: mysql
        ports:
        - containerPort: 3306
          name: db
          protocol: TCP
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: data
  volumeClaimTemplates:
  - metadata:
      annotations:
        volume.beta.kubernetes.io/storage-class: standard
      name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: standard
---
apiVersion: v1
kind: Service
metadata:
  name: mysql
  namespace: demo
  labels:
    name: mysql
spec:
  ports:
    - port: 3306
  selector:
    name: mysql

这是因为mysql:8.0.4正在使用新的基本图像debian:stretch吗?如有任何指导方针,将不胜感激。

我还在github docker-库/mysql存储库中创建了一个问题,以跟踪该问题。这是问题链接

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-02-05 06:35:12

看起来,这是一个缓慢存储的问题。将我的磁盘升级到SSD之后,等待时间大大缩短。

我的迷你内存是4GB在我以前和现在的设置。但是,SSD带来了巨大的变化。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49731798

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档