mysql 启动失败 详情_mysql启动失败一例

操作系统版本:Ubuntu 13.04

mysql 版本:mysql-server-5.5

现象:突然之前接到报告说数据库启不来了。第一时间查看硬盘空间,看是否硬盘满了。发现空间使用正常。

root@ns-xxzx-svr:~# df -h

Filesystem Size Used Avail Use%Mounted on/dev/sda1 19G 16G 2.3G 88% /none4.0K 0 4.0K 0% /sys/fs/cgroup

udev 494M4.0K 494M 1% /dev

tmpfs 101M 820K 100M1% /run

none5.0M 0 5.0M 0% /run/lock

none 502M 72K 502M1% /run/shm

none 100M 276K 100M1% /run/user/dev/sdb1 197G 59G 129G 32% /hos_media/dev/sdc1 197G 42G 146G 23% /root/sdc1

然后查看mysql的出错日志。

root@ns-xxzx-svr:/var/log/mysql# caterror.log181109 9:10:09 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed ina future release. Please use the full name instead.181109 9:10:09 [Note] Plugin 'FEDERATED'is disabled.181109 9:10:09InnoDB: The InnoDB memory heap is disabled181109 9:10:09InnoDB: Mutexes and rw_locks use GCC atomic builtins181109 9:10:09 InnoDB: Compressed tables use zlib 1.2.7

181109 9:10:09InnoDB: Using Linux native AIO181109 9:10:09 InnoDB: Initializing buffer pool, size = 128.0MInnoDB: mmap(135987200 bytes) failed; errno 12

181109 9:10:09InnoDB: Completed initialization of buffer pool181109 9:10:09 InnoDB: Fatal error: cannot allocate memory forthe buffer pool181109 9:10:09 [ERROR] Plugin 'InnoDB' init functionreturned error.181109 9:10:09 [ERROR] Plugin 'InnoDB'registration as a STORAGE ENGINE failed.181109 9:10:09 [ERROR] Unknown/unsupported storage engine: InnoDB181109 9:10:09[ERROR] Aborting181109 9:10:09 [Note] /usr/sbin/mysqld: Shutdown complete

从报错上查看有点像 InnoDB的数据引擎的问题,顺着这个方向会越走越远。通过关键字搜索也都是搜的无关的内容。一时没有头绪。

将报错信息一条条的在google里搜索。当以”InnoDB: mmap(135987200 bytes) failed“为关键字搜索时出现一条有用信息。

e6bd34b254c49406621608764378bece.png

会不会也是因为内存过低?这台服务器内存只有1G,有可能造成mysql服务启动不了或宕机。

root@ns-xxzx-svr:/var/log/mysql# free -m

total usedfreeshared buffers cached

Mem:1002 930 72 0 1 8

-/+ buffers/cache: 919 82Swap:1021 1021 0

有人建议多加点swap空间。

c7d01a9f244059d6f73dd63c22241fac.png

我查了下服务器中swap空间使用情况:

root@ns-xxzx-svr:/var/log/mysql# sudo swapon -s

Filename Type Size Used Priority/dev/sda5 partition 1046524 1046524 -1

果真,swap分区已用完。这可能就是导致mysql崩溃的原因。内存不够,虚拟内存也不够。不崩才怪。

果断加swap空间。

root@ns-xxzx-svr:/var/log/mysql# parted /dev/sdd

(parted) print

Model: HUAWEI XSG1 (scsi)

Disk/dev/sdd: 1100GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number Start End Size File system Name Flags

(parted) mkpart primary10244G

(parted) print

Model: HUAWEI XSG1 (scsi)

Disk/dev/sdd: 1100GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number Start End Size File system Name Flags11024MB 4000MB 2976MB primary

(parted) mkpart primary 4G 500G

(parted) mkpart primary 500G-1(parted) print

Model: HUAWEI XSG1 (scsi)

Disk/dev/sdd: 1100GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number Start End Size File system Name Flags11024MB 4000MB 2976MB primary24000MB 500GB 496GB primary3500GB 1100GB 600GB primary

(parted) quit

root@ns-xxzx-svr:/var/log/mysql# mkswap /dev/sdd1

Setting up swapspace version1, size = 2906108KiB

no label, UUID=10628693-bcda-471f-8a17-7d4f150752d6

root@ns-xxzx-svr:/var/log/mysql# sudo swapon /dev/sdd1

root@ns-xxzx-svr:/var/log/mysql# sudo swapon -s

Filename Type Size Used Priority/dev/sda5 partition 1046524 1046524 -1

/dev/sdd1 partition 2906108 102636 -2

加好了之后,查看swap分区使用情况,还有剩余。下面开始尝试启动mysql服务,看能否启动。

root@ns-xxzx-svr:/var/log/mysql# /etc/init.d/mysql start

Rather than invoking init scripts through/etc/init.d, use the service(8)

utility, e.g. service mysql start

Since the script you are attempting to invoke has been converted to an

Upstart job, you may also use the start(8) utility, e.g. start mysql

mysql start/running, process 11805

终于活过来了。

参考:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值