Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 如何修复重新启动的Docker容器?_Mysql_Docker_Ubuntu - Fatal编程技术网

Mysql 如何修复重新启动的Docker容器?

Mysql 如何修复重新启动的Docker容器?,mysql,docker,ubuntu,Mysql,Docker,Ubuntu,这里是我的码头工人: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ********* easyengine/cron:v4.0.0

这里是我的码头工人:

CONTAINER ID   IMAGE                           COMMAND                  CREATED       STATUS                          PORTS                                                                      NAMES
*********   easyengine/cron:v4.0.0          "/usr/bin/ofelia dae…"   2 weeks ago   Up 10 minutes                                                                                              ee-cron-scheduler
*********   easyengine/nginx:v4.1.4         "/usr/bin/openresty …"   2 weeks ago   Up 10 minutes                   80/tcp                                                                     9to6livein_nginx_1
*********   easyengine/postfix:v4.1.5       "postfix start-fg"       2 weeks ago   Up 10 minutes                   25/tcp                                                                     9to6livein_postfix_1
*********   easyengine/php:v4.1.6           "docker-entrypoint.s…"   2 weeks ago   Up 10 minutes                   9000/tcp                                                                   9to6livein_php_1
*********   easyengine/mariadb:v4.1.3       "docker-entrypoint.s…"   2 weeks ago   Restarting (1) 37 seconds ago                                                                              services_global-db_1
*********   easyengine/nginx-proxy:v4.1.4   "/app/docker-entrypo…"   2 weeks ago   Up 6 minutes                    0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   services_global-nginx-proxy_1
正如您所看到的,mariadb容器(services_global-db_1)正在不断地重新启动。我该如何解决这个问题

这是docker logs services\u global-db\u 1的日志文件:

2021-04-16 11:09:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2021-04-16 11:09:29+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-04-16 11:09:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2021-04-16 11:09:29 0 [Note] mysqld (mysqld 10.5.4-MariaDB-1:10.5.4+maria~focal) starting as process 1 ...
2021-04-16 11:09:29 0 [Warning] You need to use --log-bin to make --binlog-format work.
2021-04-16 11:09:29 0 [Note] InnoDB: Using Linux native AIO
2021-04-16 11:09:29 0 [Note] InnoDB: Uses event mutexes
2021-04-16 11:09:29 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-04-16 11:09:29 0 [Note] InnoDB: Number of pools: 1
2021-04-16 11:09:29 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2021-04-16 11:09:29 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2021-04-16 11:09:30 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2021-04-16 11:09:30 0 [Note] InnoDB: Completed initialization of buffer pool
2021-04-16 11:09:30 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955232 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955166 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955167 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955173 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: 4 transaction(s) which must be rolled back or cleaned up in total 0 row operations to undo
2021-04-16 11:09:30 0 [Note] InnoDB: Trx id counter is 955233
2021-04-16 11:09:30 0 [Note] InnoDB: 128 rollback segments are active.
2021-04-16 11:09:30 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-04-16 11:09:30 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-04-16 11:09:30 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-04-16 11:09:30 0 [Note] InnoDB: 10.5.4 started; log sequence number 3046186820; transaction id 955235
2021-04-16 11:09:30 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-04-16 11:09:30 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-04-16 11:09:30 0 [Note] InnoDB: Buffer pool(s) load completed at 210416 11:09:30
2021-04-16 11:09:30 0 [Note] InnoDB: Starting in background the rollback of recovered transactions
2021-04-16 11:09:30 0 [Note] InnoDB: Starting recovery for XA transactions...
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955167 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955232 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955173 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955166 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: 4 transactions in prepared state after recovery
2021-04-16 11:09:30 0 [Note] Found 4 prepared transaction(s) in InnoDB
2021-04-16 11:09:30 0 [ERROR] Found 4 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions.
2021-04-16 11:09:30 0 [ERROR] Aborting
最后一行的第二行有错误

但是,当我试图用容器打开一个bash会话(docker exec-it services\u global-db\u 1 bash),以便运行SQL命令(mysqld\u safe--tc heuristic recover=COMMIT)时,我得到一条消息,容器。。。正在重新启动,请等待容器运行。


现在,我的头撞到了所有的墙上,但找不到解决办法。我该如何解决这个问题?如何停止容器重新启动?

使用下面的命令删除容器,然后再次尝试旋转容器

docker container rm CONTAINER_ID

按照最后一个条目上的提示,查看它是否有助于识别数据库中存储的数据是否存在错误。您是否尝试删除maria db卷并重新启动服务?只有在可以销毁DB卷的情况下才能执行此操作!!请帮助共享您的
docker compose.yml
文件它会重新启动,因为重新启动策略必须设置为NOB以外的内容,否则我将丢失数据库。