ERROR 1017 (HY000): Can't find file: 'name' (errno: 2) 报错解决方法

今天开着负载发生器一直在往mysql-cluster里面灌输数据,突然就报错ERROR 1017 (HY000): Can't find file: 'name' (errno: 2) 然后数据就insert不进去了。

网上找了下都说是权限问题或者表数据文件损坏等。但发现并不是这么回事,以下是解决的方法:

因为我用的是mysql cluster,表数据虽然存储在磁盘上,但表的主键、索引、每条表记录有8个字节 都是存在数据节点的内存中的,以前数据插入不了时都跟数据节点内存有关系,于是我查看数据节点的内存,发现四台数据节点的内存都快消耗完了。

[root@sg206 mysql-cluster]# free -m
total used free shared buffers cached
Mem: 32178 29214 2963 0 813 3153
-/+ buffers/cache: 25247 6930
Swap: 34175 0 34175

然后用 ps aux  命令查看进程情况,发现libexec/ndbd进行占用了77%的内存

root 7468 28.4 77.3 25548588 25481832 ? Sl 11:23 59:25 libexec/ndbd

但是我的节点内存是32G的,现在数据量才到20G,内存不会消耗这么快啊

继续找原因,才发现是mysql cluster的配置文件 config.ini里的Datamemory  和  Indexmemory配置过高,占用了数据节点的大量内存,于是调整Datamemory 由16G变为4G,Indexmemory由8G变为2G,

这时问题解决了,可以 继续插入数据,这时查看数据节点的内存使用情况:

[root@sg206 mysql-cluster]# free -m
total used free shared buffers cached
Mem: 32178 10627 21550 0 820 3051
-/+ buffers/cache: 6755 25422
Swap: 34175 0 34175

libexec/ndbd进行占用内存情况

root 7549 38.8 19.9 6649644 6583112 ? Sl 23:28 10:33 libexec/ndbd

管理节点上各节点report memory

ndb_mgm> all report memory;
Node 2: Data usage is 53%(70098 32K pages of total 131072)
Node 2: Index usage is 27%(72923 8K pages of total 262176)
Node 3: Data usage is 53%(70098 32K pages of total 131072)
Node 3: Index usage is 27%(72923 8K pages of total 262176)
Node 6: Data usage is 53%(70082 32K pages of total 131072)
Node 6: Index usage is 27%(72901 8K pages of total 262176)
Node 7: Data usage is 53%(70082 32K pages of total 131072)
Node 7: Index usage is 27%(72901 8K pages of total 262176)

总结:配置文件config.ini里Datamemory 和 Indexmemory的值要根据数据节点的内存和数据库数据量来设置,过大或者过小都会导致内存不足而不能插入数据。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值