背景

电脑强制重启后,docker里的mongo不能正常使用,索引不能位置被破坏,错误log是这样的: error: WT_ERROR: non-specific WiredTiger error”}

解决方法

  1. 简历另外一个容器,volume挂载和上一个容器一样的位置:
1
2
3
4
5
6
7
8
9
docker run -it -d --name="mongofix" \
-p 27017:27017 \
-p 27018:27018 \
-p 27019:27019 \
-e TIMEZONE="Australia/Brisbane" \
-e TZ="Australia/Brisbane" \
-v {本地挂载目录}/configdb:/data/configdb \
-v {本地挂载目录}/db:/data/db \
mongo:latest /bin/bash
  1. 删除几个lock文件

    1
    2
    3
    $ rm -r journal
    $ rm -r mongod.lock
    $ rm -r WiredTiger.lock
  2. 进入mongofix容器

1
2
docker exec -it mongo /bin/sh
# mongod --repair

总结

这也提供了一条思路,如果因为挂载文件损坏,容器不能正常启动,所以不能进入容器运行修复命令,可以先创建其它容器,进入容器后进行修复。然后restart老的容器。

引用

https://gist.github.com/mtrunkat/203c33347cc96db51a754a45bb902669?permalink_comment_id=2693735

Comment and share

  1. 常用团队规范,包含Git 使用原则、分支设计、单线分支原则、开发规范
    https://blog.meathill.com/git/git-1-team-sop.html

  2. 常见问题解决,包含处理 hotfix、git rebase dev -i、git reset –hard COMMIT
    https://blog.meathill.com/git/2023-git-2-faq.html

  3. Git推荐配置与小技巧,包含
    https://blog.meathill.com/git/2023-git-3-tips.html

  4. Mac用户使用Item2+zsh中的主题自带了Git的常见alias,可以使用 alias |grep git进行查看:

    常用的有:

    1
    2
    3
    4
    5
    gup = git  pull --rebase
    gp = git push
    gl = git pull
    gcam = git commit -a -m
    gca! = git commit -v -a --amend

Comment and share

  • page 1 of 1
Author's picture

Topsion

Fullstack Developer


Coder


Xi'an China