zoukankan      html  css  js  c++  java
  • 数据库的关闭方法

    背景

    搭建了mysql的主从环境,然后在从上面kill -9杀死了mysql进程。之后在slave上面重启mysql服务,端口起来后无法登陆数据库。过了好一会才能登陆上去。

    查看mysql.err错误日志发现如下信息

    2020-04-22T10:27:16.091165Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 78607991370

    之后打印

    [Note] InnoDB: Database was not shutdown normally!

    [Note] InnoDB: Starting crash recovery.

    提示说mysql没有正常关闭。那么怎么才算正常关闭呢,正常关闭和非正常关闭有啥区别呢?

    带着这些疑问,去查一下资料。

    资料

    (1)mysql正常关闭方法: bin/mysqladmin   -u ${user} -p ${password}  -S  ${mysql.sock}  shutdown  

    举例:

    /kingdb/usr/local/nestdb_master/bin/mysqladmin -uroot -p123456 -S /kingdb/usr/local/nestdb_master/tmp/mysql.sock shutdown 

    查看mysql.err日志,发现记录了shutdown之后都干了什么事:

    [Note] Giving 0 client threads a chance to die gracefully    ---gracefully,应该就表示是温和不失礼貌的关闭方式

    Shutting down slave threads

    Forcefully disconnecting 0 remaining clients

    Binlog end

    Shutting down plugin 'ngram'   

    InnoDB: FTS optimize thread exiting.

    InnoDB: Starting shutdown...

    InnoDB: Dumping buffer pool(s) to /kingdb/usr/local/nestdb_master/var/ib_buffer_pool

    InnoDB: Buffer pool(s) dump completed at 200422 20:59:40

    InnoDB: shut down release done

    InnoDB: shut down all bg threads

    [Warning] InnoDB: Some (1) threads are still active

    [Note] InnoDB: Shutdown completed; log sequence number 4522278

    [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"

    [Note] Shutting down plugin 'binlog'

    [Note] /kingdb/usr/local/nestdb_master/bin/mysqld: Shutdown complete

    上面的日志,大致看出流程为: 关闭插件-->dumping buffer pool--->杀掉进程--->删掉了临时表空间文件ibtmp1---->关闭binlog插件等

  • 相关阅读:
    散户如何战胜专业投资机构
    机器学习总结
    进程线程及堆栈关系的总结
    线程堆栈是如何增长的
    Ubuntu下CodeBlocks控制台程序中文显示乱码解决问题
    jdk 安装
    python文件运行报错:Error: Please select a valid Python interpreter
    python 解释器安装
    allure在pycharm下运行出现以下乱码的提示 解决方案
    pytest 测试环境框架搭建
  • 原文地址:https://www.cnblogs.com/liurong07/p/12754889.html
Copyright © 2011-2022 走看看