[mysql@mysqlhq scripts]$ cat /etc/redhat-release
Kylin Linux release 3.3.1707 (Core)

mysql version

Server version: 5.6.15-log MySQL Community Server - (GPL)

1 初始情况

[root@mysqlhq scripts]# free -m
total used free shared buff/cache available
Mem: 15887 7373 215 117 8298 8033
Swap: 8063 8 8055
[root@mysqlhq scripts]# top
top - 10:09:44 up 85 days, 2 min, 3 users, load average: 0.00, 0.01, 0.05
Tasks: 157 total, 1 running, 156 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.3 us, 0.3 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 16268752 total, 220424 free, 7550344 used, 8497984 buff/cache
KiB Swap: 8257532 total, 8248616 free, 8916 used. 8225992 avail MemPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23103 root 20 0 157724 2296 1568 R 0.3 0.0 0:00.54 top
1 root 20 0 125340 3580 2092 S 0.0 0.0 7:19.82 systemd

2 启动mysql

[mysql@mysqlhq scripts]$ ./mysql_db_startup.sh
startup mysql service:localhost_3306
[mysql@mysqlhq scripts]$ 181225 10:55:19 mysqld_safe Logging to '/home/data/mysqldata/3306/log/mysql-error.log'.
181225 10:55:19 mysqld_safe Starting mysqld daemon with databases from /home/data/mysqldata/3306/data

然后一直卡主,查询errorlog,没有什么有用的信息

2018-12-21 10:11:13 4193 [Note] Shutting down plugin 'binlog'
2018-12-21 10:11:13 4193 [Note] /usr/sbin/mysqld: Shutdown complete

181221 10:11:16 mysqld_safe mysqld from pid file /home/data/mysqldata/3306/data/mysqlhq.pid ended
181225 10:11:29 mysqld_safe Starting mysqld daemon with databases from /home/data/mysqldata/3306/data
2018-12-25 10:27:18 24008 [Note] Plugin 'FEDERATED' is disabled.

3 top

24008 mysql     20   0 7810972 1.264g   3764 R 48.7  8.1  21:50.02 mysqld

4 查询其他相关信息

[root@mysqlhq scripts]# vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st3  0   8916 178104      0 7632784    0    0     6   104    3    4  0  0 99  0  04  0   8916 177608      0 7632784    0    0     0     0  123   94  0 100  0  0  03  0   8916 177112      0 7632784    0    0     0     0  113   67  0 100  0  0  02  1   8916 176492      0 7632784    0    0     0     0  122   82  0 100  0  0  04  0   8916 175996      0 7632784    0    0     0     0  134   93 10 90  0  0  04  1   8916 175376      0 7632784    0    0     0     0  137   71  8 92  0  0  0
sy 系统CPU时间,如果太高,表示系统调用时间长,例如是IO操作频繁[root@mysqlhq ~]# pidstat -w -u 1
Linux 3.10.0-514.ky3.kb3.x86_64 (mysqlhq)     12/25/2018     _x86_64_    (1 CPU)10:26:50 AM   UID       PID    %usr %system  %guest   %wait    %CPU   CPU  Command
10:27:02 AM     0        26    0.00   40.48    0.00   83.33   40.48     0  kswapd0
10:27:02 AM     0       654    0.00    0.79    0.00   19.84    0.79     0  vmtoolsd
10:27:02 AM    42      2276    0.79    0.00    0.00    2.38    0.79     0  gnome-shell
10:27:02 AM  1000     24008    1.59  100.00    0.00  100.00  100.00     0  mysqld
10:27:02 AM     0     24028    0.00    0.79    0.00    3.97    0.79     0  top
10:27:02 AM     0     24072    3.17  100.00    0.00  100.00  100.00     0  pidstat[root@mysqlhq ~]# pidstat -wt 1
Linux 3.10.0-514.ky3.kb3.x86_64 (mysqlhq)     12/25/2018     _x86_64_    (1 CPU)10:28:19 AM   UID      TGID       TID   cswch/s nvcswch/s  Command
10:28:44 AM     0         1         -      1.12      0.37  systemd
10:28:44 AM     0         -         1      1.12      0.37  |__systemd
10:28:44 AM     0         2         -      0.37      0.00  kthreadd
10:28:44 AM     0         -         2      0.37      0.00  |__kthreadd
10:28:44 AM     0         3         -    108.55      0.00  ksoftirqd/0
10:28:44 AM     0         -         3    108.92      0.00  |__ksoftirqd/0
10:28:44 AM     0         9         -    268.77      0.00  rcu_sched
10:28:44 AM     0         -         9    268.77      0.00  |__rcu_sched10:28:44 AM   UID      TGID       TID   cswch/s nvcswch/s  Command10:28:49 AM  1000     24008         -      0.00     77.97  mysqld
10:28:49 AM  1000         -     24008      0.00     77.97  |__mysqld10:28:50 AM     0         -     23104     16.67      0.00  |__kworker/0:1
10:28:50 AM  1000     24008         -      0.00    216.67  mysqld
10:28:50 AM  1000         -     24008      0.00    216.67  |__mysqld
10:40:39 AM   UID      TGID       TID   cswch/s nvcswch/s  Command
10:40:40 AM     0         3         -     57.14      0.00  ksoftirqd/0
10:40:40 AM     0         -         3     57.14      0.00  |__ksoftirqd/0
10:40:40 AM     0         9         -     78.57      0.00  rcu_sched
10:40:40 AM     0         -         9     78.57      0.00  |__rcu_sched
10:40:40 AM     0        26         -      0.00    192.86  kswapd0
10:40:40 AM     0         -        26      0.00    192.86  |__kswapd0
10:40:40 AM     0       401         -    114.29      0.00  xfsaild/dm-0
10:40:40 AM     0         -       401    114.29      0.00  |__xfsaild/dm-0
10:40:40 AM     0       654         -     78.57      0.00  vmtoolsd
10:40:40 AM     0         -       654     78.57      0.00  |__vmtoolsd
10:40:40 AM    26      6735         -     57.14      0.00  postgres
10:40:40 AM    26         -      6735     57.14      0.00  |__postgres
10:40:40 AM     0     23104         -     35.71      0.00  kworker/0:1
10:40:40 AM     0         -     23104     35.71      0.00  |__kworker/0:1
10:40:40 AM  1000     24008         -      0.00     92.86  mysqld
10:40:40 AM  1000         -     24008      0.00     92.86  |__mysqld
10:40:40 AM     0     24029         -      7.14      0.00  sshdEvery 2.0s: cat /proc/interrupts                                                                                                                                                            Tue Dec 25 10:31:54 2018CPU00:         24   IO-APIC-edge      timer1:         10   IO-APIC-edge      i80426:          2   IO-APIC-edge      floppy8:          1   IO-APIC-edge      rtc09:          0   IO-APIC-fasteoi   acpi12:         16   IO-APIC-edge      i804214:          0   IO-APIC-edge      ata_piix15:    7165685   IO-APIC-edge      ata_piix16:         10   IO-APIC-fasteoi   vmwgfx17:  107832584   IO-APIC-fasteoi   ioc024:          0   PCI-MSI-edge      PCIe PME, pciehp25:          0   PCI-MSI-edge      PCIe PME, pciehp26:          0   PCI-MSI-edge      PCIe PME, pciehp27:          0   PCI-MSI-edge      PCIe PME, pciehp28:          0   PCI-MSI-edge      PCIe PME, pciehp29:          0   PCI-MSI-edge      PCIe PME, pciehp30:          0   PCI-MSI-edge      PCIe PME, pciehp31:          0   PCI-MSI-edge      PCIe PME, pciehp32:          0   PCI-MSI-edge      PCIe PME, pciehp33:          0   PCI-MSI-edge      PCIe PME, pciehp34:          0   PCI-MSI-edge      PCIe PME, pciehp35:          0   PCI-MSI-edge      PCIe PME, pciehp36:          0   PCI-MSI-edge      PCIe PME, pciehp37:          0   PCI-MSI-edge      PCIe PME, pciehp38:          0   PCI-MSI-edge      PCIe PME, pciehp39:          0   PCI-MSI-edge      PCIe PME, pciehp40:          0   PCI-MSI-edge      PCIe PME, pciehp41:          0   PCI-MSI-edge      PCIe PME, pciehp42:          0   PCI-MSI-edge      PCIe PME, pciehp43:          0   PCI-MSI-edge      PCIe PME, pciehp44:          0   PCI-MSI-edge      PCIe PME, pciehp45:          0   PCI-MSI-edge      PCIe PME, pciehp46:          0   PCI-MSI-edge      PCIe PME, pciehp47:          0   PCI-MSI-edge      PCIe PME, pciehp48:          0   PCI-MSI-edge      PCIe PME, pciehp49:          0   PCI-MSI-edge      PCIe PME, pciehp50:          0   PCI-MSI-edge      PCIe PME, pciehp51:          0   PCI-MSI-edge      PCIe PME, pciehp52:          0   PCI-MSI-edge      PCIe PME, pciehp53:          0   PCI-MSI-edge      PCIe PME, pciehp54:          0   PCI-MSI-edge      PCIe PME, pciehp55:          0   PCI-MSI-edge      PCIe PME, pciehp56:  273909732   PCI-MSI-edge      ens160-rxtx-057:          0   PCI-MSI-edge      ens160-event-1[root@mysqlhq ~]# cat /proc/stat |grep ^cpu
cpu  3582623 1829 3424656 721469270 1429046 0 193839 0 0 0
cpu0 3582623 1829 3424656 721469270 1429046 0 193839 0 0 0[root@mysqlhq scripts]#  perf top

clear_page  /proc/kcore
Percent││││    Disassembly of section load0:││    ffffffff813250e0 <load0>:│      xor    %eax,%eax│      mov    $0x40,%ecx│      nop│10:   dec    %ecx
100.00 │      mov    %rax,(%rdi)│      mov    %rax,0x8(%rdi)│      mov    %rax,0x10(%rdi)│      mov    %rax,0x18(%rdi)│      mov    %rax,0x20(%rdi)│      mov    %rax,0x28(%rdi)│      mov    %rax,0x30(%rdi)│      mov    %rax,0x38(%rdi)│      lea    0x40(%rdi),%rdi                                                 │    ↑ jne    10                                                              │      nop                                                                    │    ← retq
Reading /proc/2243/task/2243/maps time out. You may want to increase the time limit by --proc-map-timeoutSamples: 14K of event 'cpu-clock', Event count (approx.): 58122788
Overhead  Shared Object                         Symbol                                                                                                                                                              69.91%  [kernel]                              [k] clear_page3.71%  [kernel]                              [k] copy_page1.17%  [kernel]                              [k] kallsyms_expand_symbol.constprop.11.08%  [kernel]                              [k] module_get_kallsym0.83%  perf                                  [.] __symbols__insert0.77%  [kernel]                              [k] __do_softirq0.77%  ld-2.17.so                            [.] _dl_relocate_object0.76%  [kernel]                              [k] strlcpy0.66%  [kernel]                              [k] _raw_spin_unlock_irqrestore0.58%  [kernel]                              [k] finish_task_switch0.55%  libelf-0.166.so                       [.] gelf_getsym0.52%  libc-2.17.so                          [.] _IO_vfscanf0.44%  [kernel]                              [k] __do_page_fault

[root@mysqlhq ~]# top
top - 10:37:02 up 85 days, 29 min,  4 users,  load average: 2.25, 1.78, 1.38
Tasks: 158 total,   5 running, 153 sleeping,   0 stopped,   0 zombie
%Cpu(s): 10.0 us, 90.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 16268752 total,   171688 free,  8890204 used,  7206860 buff/cache
KiB Swap:  8257532 total,  8248616 free,     8916 used.  6885876 avail Mem PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
24181 root      20   0  213132  20072   3752 R 49.0  0.1   0:26.26 perf
24008 mysql     20   0 7810972 1.264g   3764 R 48.7  8.1  21:50.02 mysqld                                                                                                                                          401 root      20   0       0      0      0 S  1.7  0.0  27:49.84 xfsaild/dm-0                                                                                                                                    2276 gdm       20   0 1374896  66280   8652 S  0.7  0.4  31:39.73 gnome-shell                                                                                                                                     654 root      20   0  323576  25444   3304 S  0.3  0.2  80:59.69 vmtoolsd  

这时候找不到原因,只好kill -9 mysql

然后又启动mysql,发现秒启

情况不能复现。

在上面情况下, 忘记使用iostatifstat查看磁盘和网络的情况。。-----

转载于:https://www.cnblogs.com/yhq1314/p/10173033.html

mysql 启动卡主,cpu 100%相关推荐

  1. mysql编译卡主_mysql 编译安装以及主从设定

    1. 下载MYSQL源码包至/home/mysql_home. 我下载下来的源码包文件名为:mysql-5.0.45.tar.gz 2. 在/home/mysql_home下,解压. tar zxvf ...

  2. php mysql cpu100_MySQL服务器进程CPU占用100%的解决方法

    早上帮朋友一台服务器解决了 Mysql cpu 占用 100% 的问题.稍整理了一下,将经验记录在这篇文章里. 朋友主机(Windows 2003 + IIS + PHP + MYSQL )近来 My ...

  3. mysql心得体会一百字_MYSQL CPU 100%实例详解

    MYSQL CPU 100%实例详解 2011/7/2 11:19:19作者:xy我要评论(0) 自己的一台主机(Windows 2003 + IIS + PHP + MYSQL )近来 MySQL ...

  4. mysql hang and srv_error_monitor_thread using 100% cpu(已解决)

    昨天晚上,运维过来说有台生产服务器的mysql cpu一直100%,新的客户端登录不了,但是已经在运行的应用都正常可用. 登录服务器后,top -H看了下,其中一个线程的cpu 一直100%,其他的几 ...

  5. 数据库周刊54丨2020 年度报告:PingCAP、腾讯云数据库、人大金仓、GoldenDB ;CPU 100% SQL优化案例;Mysql内存溢出处理;避免删库跑路黑天鹅……

    热门资讯 [1.PingCAP 2020 年度报告|相信开放的力量 [摘要]本文为PingCAP 2020年度报告.盘点了PingCAP里程碑大事件:完成D轮2.7亿美元融资,创造全球数据库历史新的里 ...

  6. mysql启动参数(/etc/my.cnf)详解汇总

    mysql启动参数(/etc/my.cnf)详解汇总 MYSQL–my.cnf配置中文详解 basedir = path 使用给定目录作为根目录(安装目录). character-sets-dir = ...

  7. RedHat4找不到网卡和mysql启动不了解决方案

    本文记录了一次RedHat AS release4上出现找不到网卡和mysql启动不了解决方案并解决问题的过程 0.机器环境: [root@xxhost ~]# lsb_release -a LSB ...

  8. 系统运行缓慢,CPU 100%,以及Full GC次数过多问题的排查思路

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试资料 来源:http://h5ip.cn/uWWR 处理过线上问题的同学 ...

  9. mysql设置keepalived_MySQL高可用性之Keepalived+MySQL(双主热备)

    环境描述: OS:CentOS6.5_X64 MASTER:192.168.0.202 BACKUP:192.168.0.203 VIP:192.168.0.204 1.配置两台MySQL主主同步 [ ...

最新文章

  1. Remoting和Webservice有什么区别
  2. java中var是什么意思_js中的var是什么意思
  3. 免费和开源世界里面有很多好的邮件服务器
  4. 数据库中case when condition then else end的理解
  5. 如何为JBoss Developer Studio 8设置BPM和规则工具
  6. php dio获取串口数据,flutter通过dio读取二进制数据,比如通过api接口读取图片
  7. AS3 BitmapData中获取非透明区域对应矩阵
  8. Silverlight与微软技术:微软抛弃Silverlight了吗?
  9. MATLAB基本介绍(1)
  10. 你有想过如何合适地给 JavaScript 变量命名吗?
  11. 解决java.lang.ClassCastException class java.lang.Integer cannot be cast to class java.lang.Long异常
  12. ML01 -- KNN算法
  13. 杂谈 之 闲来无事 (一)
  14. NOIP2011 瑞士轮 题解
  15. Flutter开发之JSON解析
  16. C 语言程序的执行流程
  17. 移动app测试的多样性_web测试与移动App测试的常见测试要点
  18. 基于MATLAB的道路缺陷自动识别
  19. 比较分子动力学模拟中Verlet算法、Speed Verlet算法及辛算法的精度
  20. 英特尔Mooly Eden:力压Jeff Bezos的《财富》科技创想家

热门文章

  1. python ioc di_PHP的依赖注入(DI) 和 控制反转(IoC)
  2. 电脑没有ps怎么改照片dpi_PS入门笔记!新手必备
  3. b树删除节点每次只能删一个吗_深入理解数据库系统之存储存引擎(B树)
  4. iis php 假死 nginx,网站假死 重启NGINX无效 必须重启PHP 原因分析
  5. django 开发中数据库可以怎样优化
  6. C# 连接MySQL错误给定关键字不在字典中”,下载最新mysql.dll文件即可
  7. 什么是localStorage?
  8. Kubernetes的Device Plugin机制源码解析
  9. 几点基于Web日志的Webshell检测思路
  10. 《数据库SQL实战》查找当前薪水详情以及部门编号dept_no