错误:
exception “GC Overhead limit exceeded
原因:
Why Sqoop Import throws this exception?
The answer is – During the process, RDBMS database (NOT SQOOP) fetches all the rows at one shot and tries to load everything into memory. This causes memory spill out and throws error. To overcome this you need to tell RDBMS database to return the data in batches. The following parameters “?dontTrackOpenResources=true&defaultFetchSize=10000&useCursorFetch=true” following the jdbc connection string tells database to fetch 10000 rows per batch.
因为数据量较大,sqoop在导入hive的时候会将数据直接读到内存中,然后会导致内存溢出。
解决方案:
1、指定mappers的数量(默认为4个,数量最好不要超过节点的个数)
sqoop job --exec gp1813_user -- --num-mappers 8;
2、调整jvm的内存,直接加在sqoop的job中。
-Dmapreduce.map.memory.mb=6000 \
-Dmapreduce.map.java.opts=-Xmx1600m \
-Dma