请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

docker-compose up时 mysql异常退出

[vagrant@docker-host wordpress]$ docker-compose up

Creating network "wordpress_my-bridge" with driver "bridge"

Creating wordpress_mysql_1     ... done

Creating wordpress_wordpress_1 ... done

Attaching to wordpress_mysql_1, wordpress_wordpress_1

wordpress_1  | WordPress not found in /var/www/html - copying now...

mysql_1      | 2018-06-12T15:15:49.214408Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

mysql_1      | 2018-06-12T15:15:49.219883Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 1 ...

mysql_1      | 2018-06-12T15:15:49.228980Z 0 [Note] InnoDB: PUNCH HOLE support available

mysql_1      | 2018-06-12T15:15:49.228999Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

mysql_1      | 2018-06-12T15:15:49.229003Z 0 [Note] InnoDB: Uses event mutexes

mysql_1      | 2018-06-12T15:15:49.229007Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier

mysql_1      | 2018-06-12T15:15:49.229011Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3

mysql_1      | 2018-06-12T15:15:49.229015Z 0 [Note] InnoDB: Using Linux native AIO

mysql_1      | 2018-06-12T15:15:49.229554Z 0 [Note] InnoDB: Number of pools: 1

mysql_1      | 2018-06-12T15:15:49.229644Z 0 [Note] InnoDB: Using CPU crc32 instructions

mysql_1      | 2018-06-12T15:15:49.276262Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M

wordpress_1  | Complete! WordPress has been successfully copied to /var/www/html

mysql_1      | 2018-06-12T15:15:49.325437Z 0 [Note] InnoDB: Completed initialization of buffer pool

mysql_1      | 2018-06-12T15:15:49.326912Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

mysql_1      | 2018-06-12T15:15:49.338243Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!

mysql_1      | 2018-06-12 15:15:49 0x7f7ea6231740  InnoDB: Assertion failure in thread 140181929924416 in file ut0ut.cc line 942

mysql_1      | InnoDB: We intentionally generate a memory trap.

mysql_1      | InnoDB: Submit a detailed bug report to http://bugs.mysql.com.

mysql_1      | InnoDB: If you get repeated assertion failures or crashes, even

mysql_1      | InnoDB: immediately after the mysqld startup, there may be

mysql_1      | InnoDB: corruption in the InnoDB tablespace. Please refer to

mysql_1      | InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html

mysql_1      | InnoDB: about forcing recovery.

mysql_1      | 15:15:49 UTC - mysqld got signal 6 ;

mysql_1      | This could be because you hit a bug. It is also possible that this binary

mysql_1      | or one of the libraries it was linked against is corrupt, improperly built,

mysql_1      | or misconfigured. This error can also be caused by malfunctioning hardware.

mysql_1      | Attempting to collect some information that could help diagnose the problem.

mysql_1      | As this is a crash and something is definitely wrong, the information

mysql_1      | collection process might fail.

mysql_1      |

mysql_1      | key_buffer_size=8388608

mysql_1      | read_buffer_size=131072

mysql_1      | max_used_connections=0

mysql_1      | max_threads=151

mysql_1      | thread_count=0

mysql_1      | connection_count=0

mysql_1      | It is possible that mysqld could use up to

mysql_1      | key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68195 K  bytes of memory

mysql_1      | Hope that's ok; if not, decrease some variables in the equation.

mysql_1      |

mysql_1      | Thread pointer: 0x0

mysql_1      | Attempting backtrace. You can use the following information to find out

mysql_1      | where mysqld died. If you see no messages after this, something went

mysql_1      | terribly wrong...

mysql_1      | stack_bottom = 0 thread_stack 0x40000

mysql_1      | mysqld(my_print_stacktrace+0x2c)[0x55efebbf61ec]

mysql_1      | mysqld(handle_fatal_signal+0x479)[0x55efeb524e59]

mysql_1      | /lib/x86_64-linux-gnu/libpthread.so.0(+0x110c0)[0x7f7ea5e0f0c0]

mysql_1      | /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcf)[0x7f7ea459bfff]

mysql_1      | /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f7ea459d42a]

mysql_1      | mysqld(+0x628387)[0x55efeb4fb387]

mysql_1      | mysqld(_ZN2ib5fatalD1Ev+0x12d)[0x55efebdc4c8d]

mysql_1      | mysqld(+0xf9ead1)[0x55efebe71ad1]

mysql_1      | mysqld(+0xf9f108)[0x55efebe72108]

mysql_1      | mysqld(_Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_+0x2b0)[0x55efebe7b230]

mysql_1      | mysqld(_Z13buf_read_pageRK9page_id_tRK11page_size_t+0xce)[0x55efebe301ee]

mysql_1      | mysqld(_Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb+0x4aa)[0x55efebdff34a]

mysql_1      | mysqld(_Z31trx_rseg_get_n_undo_tablespacesPm+0x143)[0x55efebda2e23]

mysql_1      | mysqld(+0x6274fb)[0x55efeb4fa4fb]

mysql_1      | mysqld(_Z34innobase_start_or_create_for_mysqlv+0x2f3d)[0x55efebd6fcdd]

mysql_1      | mysqld(+0xd69f63)[0x55efebc3cf63]

mysql_1      | mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x4f)[0x55efeb56fbff]

mysql_1      | mysqld(+0xb138e6)[0x55efeb9e68e6]

mysql_1      | mysqld(_Z40plugin_register_builtin_and_init_core_sePiPPc+0x2f0)[0x55efeb9e9ad0]

mysql_1      | mysqld(+0x64a566)[0x55efeb51d566]

mysql_1      | mysqld(_Z11mysqld_mainiPPc+0xc71)[0x55efeb51f121]

mysql_1      | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f7ea45892e1]

mysql_1      | mysqld(_start+0x2a)[0x55efeb51580a]

mysql_1      | The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains

mysql_1      | information that should help you find out what is causing the crash.

wordpress_mysql_1 exited with code 2


报错如上贴出的,通常造成这个的原因是什么呢? yml文件就是用的第六章的wordpress下的,只是把mysql的版本换成了5.7,就是image那一行改成了image: mysql:5.7

正在回答 回答被采纳积分+3

4回答

麦兜搞IT 2018-06-13 12:59:10

services:


wordpress:

image: wordpress

ports:

- 8080:80

depends_on:

- mysql

environment:

WORDPRESS_DB_HOST: mysql:3306

WORDPRESS_DB_PASSWORD: root

networks:

- my-bridge


0 回复 有任何疑惑可以回复我~
麦兜搞IT 2018-06-13 12:55:33

我看了一下,我这边用你提供的compose yml文件是可以成功启动wordpress的,中间虽然也会报几次mysql连接错误,可能是因为当时mysql还没有完全启动成功,而这时间wordpress已经启动了。

这样,要不您试试在wordpress的service里增加depends on。例如, 这个是depends on redis,我们可以设置成depends on mysql, 就是等MySQL的container起来,再启动wordpress,您试试?

services:
 vote:
   image:
dockersamples
/examplevotingapp_vote:before
   depends_on:
     - redis
   deploy:
     replicas: 2


     update_config:
       parallelism: 2
       delay: 10s
       order: stop-first

0 回复 有任何疑惑可以回复我~
提问者 积木_0004 2018-06-12 23:51:59

补充一下,同样pull下来的镜像,像上一节那样执行docker run就可以

docker run -d --name mysql -v mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wordpress mysql:5.7

docker run -d -e WORDPRESS_DB_HOST=mysql:3306 --link mysql -p 8080:80 wordpress

正常访问wordpress的网页,但是执行docker-compose up就会有报错

0 回复 有任何疑惑可以回复我~
提问者 积木_0004 2018-06-12 23:50:25

贴一下docker-compose.yml


version: '3'


services:


  wordpress:

    image: wordpress

    ports:

      - 8080:80

    environment:

      WORDPRESS_DB_HOST: mysql:3306

      WORDPRESS_DB_PASSWORD: root

    networks:

      - my-bridge


  mysql:

    image: mysql:5.7

    environment:

      MYSQL_ROOT_PASSWORD: root

      MYSQL_DATABASE: wordpress

    volumes:

      - mysql-data:/var/lib/mysql

    networks:

      - my-bridge


volumes:

  mysql-data:


networks:

  my-bridge:

    driver: bridge


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信