V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
magicdu
V2EX  ›  MySQL

docker 下的 mariadb 10.4.8 断电后崩了,求个恢复的方式

  •  
  •   magicdu ·
    magicdu · 2020-04-15 10:19:09 +08:00 · 4211 次点击
    这是一个创建于 1443 天前的主题,其中的信息可能已经有所发展或是发生改变。

    报错如下:

    [ERROR] Found 1 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.
    
    

    配置文件加了:innodb_force_recovery = 1 Google 了下都让使用如下命令,恢复不成功

    mysqld_safe --tc-heuristic-recover=COMMIT
    
    
    
    16 条回复    2020-05-28 14:41:52 +08:00
    defunct9
        1
    defunct9  
       2020-04-15 11:04:33 +08:00
    开 ssh,让我上去看看
    magicdu
        2
    magicdu  
    OP
       2020-04-15 11:14:07 +08:00
    @defunct9 老哥,你每个帖子都是这么回的,我都看到你好几回了
    defunct9
        3
    defunct9  
       2020-04-15 11:18:36 +08:00
    @magicdu 是的,你要继续翻会看到更多的。
    sprite82
        4
    sprite82  
       2020-04-15 12:48:11 +08:00 via Android
    不是很理解为什么数据库也要放 docker 中
    littlewing
        5
    littlewing  
       2020-04-15 12:49:34 +08:00
    恢复不成功报什么错?
    gz911122
        6
    gz911122  
       2020-04-15 13:36:49 +08:00
    @defunct9 那你这样的意义是啥?
    gz911122
        7
    gz911122  
       2020-04-15 13:37:11 +08:00
    @defunct9 顺便说句你头像也太丑了...不能换个好看的么
    gz911122
        8
    gz911122  
       2020-04-15 13:38:06 +08:00
    @defunct9 当然如果是亲人当我没说.
    magicdu
        9
    magicdu  
    OP
       2020-04-15 13:41:39 +08:00
    @littlewing 感谢回复,数据已经恢复了,把 data 数据文件拷出来了在本地恢复的,容器里不好搞,报了个这样的错 [ERROR] Fatal error: Can't open and lock privilege tables: 'mysql.user' is not of type 'TABLE'。
    之后用下面的命令启动起来了
    ```
    /usr/sbin/mysqld --skip-grant-tables --general-log &
    ```
    然后把数据搞出来了,感觉稀里糊涂的还是。
    xfriday
        10
    xfriday  
       2020-04-15 13:41:50 +08:00
    手动删掉那个 prepared transaction
    defunct9
        11
    defunct9  
       2020-04-15 13:45:47 +08:00   ❤️ 3
    @gz911122 猜测没有意义,上去看了才知道真正原因。头像么,小娃照片,话说你小时候也是一样丑。
    gz911122
        12
    gz911122  
       2020-04-15 14:15:47 +08:00
    @defunct9 这倒没有.
    neroxps
        13
    neroxps  
       2020-04-15 14:51:42 +08:00
    楼主 docker -v 没用???数据库文件直接在容器内部???勇气可嘉

    docker rm -f 不就 GG 了?
    idealhs
        14
    idealhs  
       2020-04-15 17:15:34 +08:00   ❤️ 1
    这楼里互动属实给我看笑了😂
    magicdu
        15
    magicdu  
    OP
       2020-04-15 17:19:35 +08:00
    @neroxps 当然 得 -v 了
    kljsandjb
        16
    kljsandjb  
       2020-05-28 14:41:52 +08:00 via iPhone
    @magicdu 已经把这货屏蔽了 头像太🐔儿丑+评论太烦人
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4810 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 09:57 · PVG 17:57 · LAX 02:57 · JFK 05:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.