Java Runtime Environment 内存不足,无法继续 hbase
There is insufficient memory for the Java Runtime Environment to continue hbase
我已经查看了与类似问题相关的所有答案,但我无法得出关于我的 Java 代码或 Hbase 配置中的问题的结论。所以我再次发布这个问题。我在 Hbase 中遇到以下错误。我有 3 个用于 Hadoop 集群的虚拟机。
主节点 - 3 GB RAM
数据节点 1 - 7 GB RAM
Datanode 2 - 7 GB RAM
我的 Java 程序在 Hbase 主节点上 运行,该工作人员将数据插入 Hbase table,大约在插入 100k 条记录后,我遇到了以下错误并且 Java 程序和 HMaster 停止工作。
Java 程序错误:-
OpenJDK 64-Bit Server VM warning: INFO:
os::commit_memory(0x00007fe05185c000, 12288, 0) failed; error='Cannot
allocate memory' (errno=12)
There is insufficient memory for the Java Runtime Environment to
continue. Native memory allocation (malloc) failed to allocate 12288
bytes for committing reserved memory.
An error report file with more information is saved as:
/var/data/HadoopOperations/javaOperations/hs_err_pid41813.log
登录 hs_err_pid41813.log
processor : 1
vendor_id : AuthenticAMD
cpu family : 16
model : 8
model name : AMD Opteron(tm) Processor 4171 HE
stepping : 1
microcode : 0xffffffff
cpu MHz : 2094.643
cache size : 512 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm
3dnowext 3dnow rep_good nopl extd_apicid pni cx16 popcnt hypervisor
lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw
vmmcall
bugs : tlb_mmatch apic_c1e fxsave_leak
bogomips : 4205.20
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual power management:
Memory: 4k page, physical 3523172k(135048k free), swap 0k(0k free)
vm_info: OpenJDK 64-Bit Server VM (24.79-b02) for linux-amd64 JRE
(1.7.0_79-b14), built on Jul 24 2015 08:15:54 by "buildd" with gcc
4.8.2
time: Fri Sep 4 06:43:48 2015
elapsed time: 63099 seconds
hbase-site.xml配置
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name><value>master,datanodeone,datanodetwo</value>
</property>
<property>
<name>hbase.client.scanner.caching</name>
<value>10000</value>
</property>
<property>
<name>hfile.block.cache.size</name>
<value>0.6</value>
</property>
<property>
<name>hbase.regionserver.global.memstore.size</name>
<value>0.2</value>
</property>
</configuration>
您几乎没有空闲内存,也没有交换空间。
physical 3523172k(135048k free), swap 0k(0k free)
最简单的解决方案是添加一些交换空间 space,我建议最少 4 GB,最多 16 GB。
创建一个2G的Swap文件
sudo dd if=/dev/zero of=/swapfile count=2048 bs=1MiB
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo nano /etc/fstab
添加这一行:
/swapfile swap swap sw 0 0
运行 swapon --show
和 free -h
验证
我已经查看了与类似问题相关的所有答案,但我无法得出关于我的 Java 代码或 Hbase 配置中的问题的结论。所以我再次发布这个问题。我在 Hbase 中遇到以下错误。我有 3 个用于 Hadoop 集群的虚拟机。
主节点 - 3 GB RAM
数据节点 1 - 7 GB RAM
Datanode 2 - 7 GB RAM
我的 Java 程序在 Hbase 主节点上 运行,该工作人员将数据插入 Hbase table,大约在插入 100k 条记录后,我遇到了以下错误并且 Java 程序和 HMaster 停止工作。
Java 程序错误:-
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007fe05185c000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)
There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (malloc) failed to allocate 12288 bytes for committing reserved memory.
An error report file with more information is saved as:
/var/data/HadoopOperations/javaOperations/hs_err_pid41813.log
登录 hs_err_pid41813.log
processor : 1
vendor_id : AuthenticAMD
cpu family : 16
model : 8
model name : AMD Opteron(tm) Processor 4171 HE
stepping : 1
microcode : 0xffffffff
cpu MHz : 2094.643
cache size : 512 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good nopl extd_apicid pni cx16 popcnt hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw vmmcall
bugs : tlb_mmatch apic_c1e fxsave_leak
bogomips : 4205.20
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual power management:
Memory: 4k page, physical 3523172k(135048k free), swap 0k(0k free)
vm_info: OpenJDK 64-Bit Server VM (24.79-b02) for linux-amd64 JRE (1.7.0_79-b14), built on Jul 24 2015 08:15:54 by "buildd" with gcc 4.8.2
time: Fri Sep 4 06:43:48 2015
elapsed time: 63099 seconds
hbase-site.xml配置
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name><value>master,datanodeone,datanodetwo</value>
</property>
<property>
<name>hbase.client.scanner.caching</name>
<value>10000</value>
</property>
<property>
<name>hfile.block.cache.size</name>
<value>0.6</value>
</property>
<property>
<name>hbase.regionserver.global.memstore.size</name>
<value>0.2</value>
</property>
</configuration>
您几乎没有空闲内存,也没有交换空间。
physical 3523172k(135048k free), swap 0k(0k free)
最简单的解决方案是添加一些交换空间 space,我建议最少 4 GB,最多 16 GB。
创建一个2G的Swap文件
sudo dd if=/dev/zero of=/swapfile count=2048 bs=1MiB
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo nano /etc/fstab
添加这一行:
/swapfile swap swap sw 0 0
运行 swapon --show
和 free -h
验证