荣耀彩票代理

IT技术互动交流平台

MYSQL经常挂 怀疑内存不够 加SWAP优化

来源:IT165收集  发布日期:2016-12-26 20:23:12

RUTI,ZUIJINhttp://www.12reads.cn/ DEMYSQLJINGCHANGGUA,ZUIJINGUADELOG:

 

At time: Wed Dec  7 09:15:01 CST 2016 :MySQL error stop .
At time: Wed Dec  7 09:30:01 CST 2016 :MySQL error stop .
At time: Wed Dec  7 10:00:02 CST 2016 :MySQL error stop .
At time: Mon Dec 19 04:30:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 04:45:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 05:00:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 05:15:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 05:30:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 05:45:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 06:00:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 06:15:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 06:30:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 06:45:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 07:00:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 07:15:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 07:30:02 CST 2016 :MySQL error stop .
At time: Mon Dec 19 07:45:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 08:00:02 CST 2016 :MySQL error stop .
At time: Mon Dec 19 08:15:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 08:30:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 08:45:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 09:00:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 09:15:02 CST 2016 :MySQL error stop .
At time: Mon Dec 19 09:30:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 09:45:01 CST 2016 :MySQL error stop .
At time: Mon Dec 19 10:00:01 CST 2016 :MySQL error stop .
At time: Tue Dec 20 23:15:02 CST 2016 :MySQL error stop .
At time: Tue Dec 20 23:30:01 CST 2016 :MySQL error stop .
At time: Tue Dec 20 23:45:01 CST 2016 :MySQL error stop .
At time: Thu Dec 22 11:56:04 CST 2016 :MySQL error stop .
At time: Thu Dec 22 21:26:14 CST 2016 :MySQL error stop .
At time: Thu Dec 22 21:56:12 CST 2016 :MySQL error stop .
At time: Sat Dec 24 12:02:17 CST 2016 :MySQL error stop .
At time: Sat Dec 24 12:08:01 CST 2016 :MySQL error stop .
At time: Sat Dec 24 12:10:01 CST 2016 :MySQL error stop .

而查看MYSQL错误日志,有提示:

 

 

[ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error: 11

 


error 11在mysql中是资源临时不可用。

ZHAOLEYIDUIYUANYINWEIGUO,ZUIHAOXIANGSHIBUSHINEICUNPINGJINGLE?

CHAKANLEXIAFUWUQIYIZHIMEIKAIFANGSWAP,SUOYIDAKAILEXIALE,GUANCHAKANKANSHIBUSHIQINGKUANGYOUSUOGAIBIAN。

荣耀彩票代理YIXIASHIKAIQISWAPDEJUTIBUZHOU:(http://www.12reads.cn/MUQIAN2GNEICUN,SUOYIWOXUANZELEbs=1m,count=2048,YEJIUSHIFENPEI2GJISWAPLAIYONG。)

 

1、CHUANGJIANYONGYUJIAOHUANFENQUDEWENJIAN:

dd if=/dev/zero of=/mnt/swap bs=block_size count=number_of_block  

:block_size、number_of_block 大小可以自定义,比如 bs=1M count=1024 代表设置 1G 大小 SWAP 分区。

荣耀彩票代理2、SHEZHIJIAOHUANFENQUWENJIAN:

mkswap /mnt/swap

3、LIJIQIYONGJIAOHUANFENQUWENJIAN

swapon /mnt/swap

:如果在 /etc/rc.local 中有 swapoff a 需要修改为 swapon a

4、SHEZHIKAIJISHIZIQIYONG SWAP FENQU:

XUYAOXIUGAIWENJIAN /etc/fstab ZHONGDE SWAP XING,TIANJIA

/mnt/swap swap swap defaults 0 0

:/mnt/swap 路径可以修改,可以根据创建的 SWAP 文件具体路径来配置。

5、XIUGAI swpapiness CANSHU

Linux荣耀彩票代理 系统中,可以通过查看 /proc/sys/vm/swappiness 内容的值来确定系统对 SWAP 分区的使用原则。当 swappiness 内容的值为 0 时,表示最大限度地使用物理内存,物理内存使用完毕后,才会使用 SWAP 分区。当 swappiness 内容的值为 100 时,表示积极地使用 SWAP 分区,并且把内存中的数据及时地置换到 SWAP 分区。

CHAKANXIUGAIQIANWEI 0,XUYAOZAIWULINEICUNSHIYONGWANBIHOUCAIHUISHIYONG SWAP FENQU:

KEYISHIYONGXIASHUFANGFALINSHIXIUGAICICANSHU,JIASHEWOMENPEIZHIWEIKONGXIANNEICUNSHAOYU 10% SHICAISHIYONG SWAP FENQU:

echo 10 >/proc/sys/vm/swappiness

RUOXUYAOYONGJIUXIUGAICIPEIZHI,ZAIXITONGZHONGQIZHIHOUYESHENGXIAODEHUA,KEYIXIUGAI /etc/sysctl.conf WENJIAN,BINGZENGJIAYIXIANEIRONG:

# vim /etc/sysctl.confvm.swappiness=10# sysctl p

关闭 SWAP

DANGXITONGCHUXIANNEICUNBUZUSHI,KAIQI SWAP KENENGHUIYINPINFANHUANYECAOZUO,DAOZHI IO XINGNENGXIAJIANG。RUGUOYAOGUANBI SWAP,KEYICAIYONGRUXIAFANGFA。

1、free m 查询 SWAP 分区设置:

2、SHIYONGMINGLING swapoff GUANBI SWAP,BIRU:

swapoff /mnt/swap  

3、XIUGAI /etc/fstab WENJIAN,SHANCHUHUOZHUSHIXIANGGUANPEIZHI,QUXIAO SWAP DEZIDONGGUAZAI:

4、 通过 free m 确认 SWAP 已经关闭。

5、 swappiness CANSHUDIAOZHENG:

KEYISHIYONGXIASHUFANGFALINSHIXIUGAICICANSHU,ZHEILIPEIZHIWEI 0%:

echo 0 >/proc/sys/vm/swappiness    

荣耀彩票代理RUOXUYAOYONGJIUXIUGAICIPEIZHI,ZAIXITONGZHONGQIZHIHOUYESHENGXIAODEHUA,KEYIXIUGAI /etc/sysctl.conf WENJIAN,BINGZENGJIAYIXIANEIRONG:

# vim /etc/sysctl.confvm.swappiness=0# sysctl p
Tag标签:      
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规