Question: I am using **Hadoop 2.6.0 version** and trying to run Hive insert into table where i got the JAVA Heap error.

Is there any way I can increase the heap size in hadoop through out the cluster?

Thanks in advance

Answer: 
For that you may execute the following before executing hadoop command:

```
export HADOOP_HEAPSIZE=4096

```

Alternatively, you can achieve the same thing by adding the following permanent setting in your mapred-site.xml file, this file lies in HADOOP\_HOME/conf/ :

```
<property>
    <name>mapred.child.java.opts</name>
    <value>-Xmx4096m</value>
</property>

```

Look also here:
<https://www.mapr.com/blog/how-to-avoid-java-heap-space-errors-understanding-and-managing-task-attempt-memory>
There'll be instances where any such `export` statements will be overwritten. 

Whatever value I assigned to any such variable from command line, it used to pick up the same old property defined in the environment file.

For me to make it work, I had to edit the statement:
`export HADOOP_HEAPSIZE="[size in MB]"` in the file `hadoop-env.sh`

However, remember that it is akin to hardcoding and its effect will reflect globally, unless is overridden.