今天一大早起来,zabbix报错了

我去查看了mysql的状态

MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

启动的时候发现

ERROR! The server quit without updating PID file (/data/mysql/pids/mysql.pid

单单搜上面的东西是不可能直接得出答案的,

最后我才想到要查看是不是磁盘满了,

才发现,磁盘已经百分百了!!!!!

下面是扩展已经挂载分区

111取消挂载 umount /data

[root@localhost /]# umount /data/
umount.nfs: /data: device is busy

因为文件正在给其他进程调用,所以

要查看所使用的进程

[root@ansz.quan.bbs ~]$fuser -m -v /data/
USER PID ACCESS COMMAND
/data/: zabbix 1154 F.... zabbix_server
zabbix 1183 F.... zabbix_agentd
zabbix 1185 F.... zabbix_agentd
zabbix 1186 F.... zabbix_agentd
zabbix 1187 F.... zabbix_agentd
zabbix 1188 F.... zabbix_agentd
zabbix 1189 F.... zabbix_agentd
mysql 2910 F.c.. mysqld
-v 表示 verbose 模式。进程以 ps 的方式显示,包括 PID、USER、COMMAND、ACCESS 字段

-m 表示指定文件所在的文件系统或者块设备(处于 mount 状态)

关闭这些进程即可 然后取消挂载就可以了

另外一种查看被使用的方法

lsof    [option]
lsof [选项]
参数选项 解释说明
-c<进程名> 显示指定的进程名所打开的文件
-p<进程号> 显示指定的进程号所打开的文件
-i 通过监听指定的协议、端-和主机等信息,显示符合条件的进程信息
-u 显示指定用户使用的文件
-U 显示所有socket文件
最小化安装没有这个命令
yum install -y lsof
[root@ansz.quan.bbs ~]$lsof |grep /data
zabbix_se 1154 zabbix 1w REG 8,17 146794 520522 /data/zabbix/logs/zabbix_server.log
zabbix_se 1154 zabbix 2w REG 8,17 146794 520522 /data/zabbix/logs/zabbix_server.log
zabbix_ag 1183 zabbix 1w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log
zabbix_ag 1183 zabbix 2w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log
zabbix_ag 1185 zabbix 1w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log
zabbix_ag 1185 zabbix 2w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log
zabbix_ag 1186 zabbix 1w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log
zabbix_ag 1186 zabbix 2w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log
zabbix_ag 1187 zabbix 1w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log
zabbix_ag 1187 zabbix 2w REG 8,17 16848 520701 /data/zabbix/logs/zabbix_agentd.log [root@ansz.quan.bbs ~]$lsof /var/log/messages
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rsyslogd 1197 root 1w REG 8,2 704049 533242 /var/log/messages
-COMMAND:命令,进程的名称。
-PID:进程号。
-USER:进程的所有者。
-FD:文件描述符,它又包含如下内容。
  0:表示标准输出。
  1:表示标准输入。
  2:表示标准错误。
  u:表示该文件被打开并处于读取/写人模式。
  r:表示该文件被打开并处于只读模式。
  w:表示该文件被打开并处于写人模式。
-TYPE:文件类型,REG(regular)为普通文件。
-DEVICE:指定磁盘的名称。
-SIZE/OFF:文件的大小。
-NODE:索引节点。
-NAME:文件名称。

2222扩展分区

fdisk /dev/sdb
d 删除你需要扩展的分区
Command (m for help): p #打印当前分区,发现分区已删除
Disk /dev/sdb: 1181.1 GB, 1181116006400 bytes
255 heads, 63 sectors/track, 143595 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc6e44e94
Device Boot Start End Blocks Id System
Command (m for help): n #新建分区
Command action
e extended
p primary partition (1-4)
p #新建主分区
Partition number (1-4): 1 #和扩容前的分区标号必须一样
First cylinder (1-143595, default 1): #默认是1,比如要和扩容前的分区其实点一样,扩容前的分区起始也是1,这个是扩容的重点地方。
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-143595, default 143595): #终止的位置是默认是硬盘柱体的尾部,即使最大值,这个是要扩容的点,回车。
Using default value 143595
Command (m for help): w #w保存,并退出。
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

上面重新建了分区,我们需要调整分区

[root@backup ~]# e2fsck -f /dev/sdb1    #由于磁盘容量很大,数据多的情况下需要等待一段时间
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 12/65536000 files (0.0% non-contiguous), 4164250/262142637 blocks
[root@backup ~]# resize2fs /dev/sdb1 #由于磁盘容量很大,数据多的情况下需要等待一段时间
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/sdb1 to 288356701 (4k) blocks.
The filesystem on /dev/sdb1 is now 288356701 blocks long.

扩充完之后

333

[root@ansz.quan.bbs ~]$e2fsck -f /dev/sdb1
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 116297/983488 files (0.2% non-contiguous), 3586821/3933909 blocks
[root@ansz.quan.bbs ~]$resize2fs /dev/sdb1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/sdb1 to 15727627 (4k) blocks.
The filesystem on /dev/sdb1 is now 15727627 blocks long.
[root@ansz.quan.bbs ~]$fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e0452 Device Boot Start End Blocks Id System
/dev/sda1 * 1 131 1048576 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 131 1437 10485760 83 Linux
/dev/sda3 1437 1698 2097152 82 Linux swap / Solaris
/dev/sda4 1698 3917 17824768 5 Extended
/dev/sda5 1698 3917 17823744 83 Linux Disk /dev/sdb: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x797f73e6 Device Boot Start End Blocks Id System
/dev/sdb1 1 1959 15735636 83 Linux
[root@ansz.quan.bbs ~]$fuser -m -v /data
USER PID ACCESS COMMAND
/data: zabbix 1154 F.... zabbix_server
zabbix 1183 F.... zabbix_agentd
zabbix 1185 F.... zabbix_agentd
zabbix 1186 F.... zabbix_agentd
zabbix 1187 F.... zabbix_agentd
zabbix 1188 F.... zabbix_agentd
zabbix 1189 F.... zabbix_agentd
mysql 2932 F.c.. mysqld
root 3010 F.... nginx
nginx 3012 F.... nginx
zabbix 3066 F.... zabbix_server
zabbix 3067 F.... zabbix_server
zabbix 3068 F.... zabbix_server
zabbix 3069 F.... zabbix_server
zabbix 3070 F.... zabbix_server
zabbix 3071 F.... zabbix_server
zabbix 3072 F.... zabbix_server
zabbix 3073 F.... zabbix_server
zabbix 3076 F.... zabbix_server
zabbix 3077 F.... zabbix_server
zabbix 3082 F.... zabbix_server
zabbix 3083 F.... zabbix_server
zabbix 3084 F.... zabbix_server
zabbix 3085 F.... zabbix_server
zabbix 3086 F.... zabbix_server
zabbix 3087 F.... zabbix_server
zabbix 3088 F.... zabbix_server
zabbix 3089 F.... zabbix_server
zabbix 3090 F.... zabbix_server
zabbix 3091 F.... zabbix_server
zabbix 3094 F.... zabbix_server
zabbix 3095 F.... zabbix_server
zabbix 3096 F.... zabbix_server
zabbix 3097 F.... zabbix_server
zabbix 3098 F.... zabbix_server
zabbix 3099 F.... zabbix_server
zabbix 3104 F.... zabbix_server
zabbix 3105 F.... zabbix_server
zabbix 3106 F.... zabbix_server
zabbix 3107 F.... zabbix_server
zabbix 3109 F.... zabbix_server
zabbix 3110 F.... zabbix_server
zabbix 3111 F.... zabbix_server
zabbix 3112 F.... zabbix_server
zabbix 3113 F.... zabbix_server
zabbix 3114 F.... zabbix_server
zabbix 3115 F.... zabbix_server
[root@ansz.quan.bbs ~]$service zabbix_server stop
Zabbix server terminated.
[root@ansz.quan.bbs ~]$service zabbix_agentd stop
Zabbix agent terminated.
[root@ansz.quan.bbs ~]$service nginx stop
Stopping nginx: [ OK ]
[root@ansz.quan.bbs ~]$service mysqld stop
Shutting down MySQL. SUCCESS! [root@ansz.quan.bbs ~]$fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u'). Command (m for help): p Disk /dev/sdb: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x797f73e6 Device Boot Start End Blocks Id System
/dev/sdb1 1 1959 15735636 83 Linux Command (m for help): d
Selected partition 1 Command (m for help): p Disk /dev/sdb: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x797f73e6 Device Boot Start End Blocks Id System Command (m for help): n
Command action
e extended
p primary partition (1-4)
1
Invalid partition number for type `1'
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-7832, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-7832, default 7832):
Using default value 7832 Command (m for help): p Disk /dev/sdb: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x797f73e6 Device Boot Start End Blocks Id System
/dev/sdb1 1 7832 62910508+ 83 Linux Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
[root@ansz.quan.bbs ~]$res
reset resizecons resolve_stack_dump restorecon
resize2fs resolveip restart restorecond
[root@ansz.quan.bbs ~]$resize2fs /dev/sdb1
resize2fs 1.41.12 (17-May-2010)
Please run 'e2fsck -f /dev/sdb1' first. [root@ansz.quan.bbs ~]$e2fsck -f /dev/sdb1
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 116297/983488 files (0.2% non-contiguous), 3586821/3933909 blocks
[root@ansz.quan.bbs ~]$resize2fs /dev/sdb1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/sdb1 to 15727627 (4k) blocks.
The filesystem on /dev/sdb1 is now 15727627 blocks long. [root@ansz.quan.bbs ~]$fdisk -l Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e0452 Device Boot Start End Blocks Id System
/dev/sda1 * 1 131 1048576 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 131 1437 10485760 83 Linux
/dev/sda3 1437 1698 2097152 82 Linux swap / Solaris
/dev/sda4 1698 3917 17824768 5 Extended
/dev/sda5 1698 3917 17823744 83 Linux Disk /dev/sdb: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x797f73e6 Device Boot Start End Blocks Id System
/dev/sdb1 1 7832 62910508+ 83 Linux
[root@ansz.quan.bbs ~]$mount /dev/sdb1 /data
[root@ansz.quan.bbs ~]$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 17G 12G 3.9G 76% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 976M 31M 894M 4% /boot
/dev/sda2 9.8G 747M 8.5G 8% /var
/dev/sdb1 59G 14G 43G 24% /data
[root@ansz.quan.bbs ~]$

就成功了,扩展分区

4444数据库还要进行下面曹祖

44.1

修改配置文件

innodb_force_recovery=3#表示不执行回滚
innodb_purge_thread=0

解析

参数innodb_force_recovery影响了整个Innodb存储引擎的恢复状况。该值默认为0,表示当需要恢复时执行所有的恢复操作。当不能进行有效恢复时,如数据页发生了corruption,Mysql数据库可能会宕机,并把错误写入错误日志中。
        但在某些情况下,可能不需要执行完整的恢复操作。例如在进行alter table操作时,这时发生意外,数据库重启时会对Innodb表执行回滚操作。对于一个大表,这需要很长时间,甚至可能是几个小时。这时可以自行恢复,例如将表删除,从备份中重新将数据导入表中,
这些操作可能要快于回滚操作。
       Innodb_force_recovery可以设置6个非零值:
1(SRV_FORCE_IGNORE_CORRUPT):忽略检查到的corrupt页。
2(SRV_FORCE_NO_BACKGROUND):阻止主线程的运行,如主线程需要执行full purge操作,会导致crash。
3(SRV_FORCE_NO_TRX_UNDO):不执行事务回滚操作。
4(SRV_FORCE_NO_IBUF_MERGE):不执行插入缓冲的合并操作。
5(SRV_FORCE_NO_UNDO_LOG_SCAN):不查看重做日志,InnoDB存储引擎会将未提交的事务视为已提交。
6(SRV_FORCE_NO_LOG_REDO):不执行前滚的操作。
purge thread
事物被提交后,其说使用的undolog可能不在使用,因此需要purge thread来回收已经使用并分配的undo page,在之前的版本中purge thread的工作是master thread完成的,为了减轻master thread的工作,提高cpu的使用率以及提升存储引擎的性能,
用户可以将参数innodb_purge_threads=1来启动单独的purge thread,最多可以启动4个。

  重启服务:

[root@ansz.quan.bbs ~]$service mysqld start
Starting MySQL.. SUCCESS!
mysqldump -u root -p123456 --all-databases > all.sql 将zabbix数据库删除
mysql>drop database zabbix; 将刚刚加入的两行注释掉
重启mysql
service mysqld restart 登陆数据库
建立zabbix 数据库(建立的必须是和之前建立的一模一样)
msyql>create database zabbix character set=utf8; 导入数据库
mysql -u root -p <all.sql 成功啦!!

总结,监控的重要性!!!!

最新文章

  1. js解决IE8、9下placeholder的兼容问题
  2. web 前端常用组件【01】Pagination 分页
  3. 推荐一些顶级的Android开发书籍(转)
  4. python的类和对象——进阶篇
  5. 第三章:模块加载系统(requirejs)
  6. 兼容加载Xml字符串
  7. Fuck Flyme Theme
  8. 关于Core Data的一些整理(三)
  9. jQuery多文件
  10. 【转载】JAVA基础复习与总结&lt;三&gt; Object类的常用方法
  11. day17
  12. java基础知识—变量、数据类型和运算符
  13. 简单选择排序算法的C++实现
  14. 解决在vue中axios请求超时的问题
  15. Sallen-Key Active Butterworth Low Pass Filter Calculator
  16. python 日期创建dir
  17. opengl导入obj模型
  18. N个苹果分给M个人,有多少种分法
  19. 绿色的宠物店cms后台管理系统模板——后台
  20. Test plan

热门文章

  1. MySQL:提高笔记-3
  2. GitHub Universe 2021|MS Reactor 邀你共聚年度盛会
  3. 无网络下,配置yum本地源
  4. 热身训练1 Game
  5. Android DataBinding使用详解
  6. Luogu P1084 疫情控制 | 二分答案 贪心
  7. DeWeb 简介
  8. 羽夏看Win系统内核——保护模式篇
  9. void * 是什么?
  10. git push超过100M文件处理方法