在sqoop中指定多个通用参数的正确方法是什么

时间:2018-03-07 08:34:10

标签: hadoop hive hortonworks-data-platform sqoop

检查文档,我读到可用的通用参数列表:

mapred.job.queuename=batch 
mapred.child.java.opts="\-Djava.security.egd=file:///dev/urandom" 

我想在sqoop命令中指定以下两个属性:

sqoop import -Dmapred.job.queuename=batch \
        mapred.child.java.opts="\-Djava.security.egd=file:///dev/urandom" \
        --connect $connection \
        --username $username\
        --password $password \
        --table $sourceTable \
        --columns "$columns"\
        --hive-import \
        --hive-overwrite \
        --hive-table $targetTable \
        --compression-codec org.apache.hadoop.io.compress.SnappyCodec \
        --hive-delims-replacement "SPECIAL" \
        --null-string '\\N' \
        --null-non-string '\\N' \
        -m 1

所以我写了这样的import sqoop脚本:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.6.4.0-91/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.6.4.0-91/accumulo/lib/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
18/03/07 08:00:04 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.6.4.0-91
18/03/07 08:00:04 ERROR tool.BaseSqoopTool: Error parsing arguments for import:
18/03/07 08:00:04 ERROR tool.BaseSqoopTool: Unrecognized argument: mapred.child.java.opts=\-Djava.security.egd=file:///dev/urandom
18/03/07 08:00:04 ERROR tool.BaseSqoopTool: Unrecognized argument: --connect

但它不起作用......

sqoop import \
        -D mapred.job.queuename=batch \
        -D mapred.child.java.opts="\-Djava.security.egd=file:///dev/urandom" \
        --connect $connection \
        --username $username \
        --password $password \
        --table $sourceTable \
        --columns "$columns"\
        --hive-import \
        --hive-overwrite \
        --hive-table $targetTable \
        --compression-codec org.apache.hadoop.io.compress.SnappyCodec \
        --hive-delims-replacement "SPECIAL" \
        --null-string '\\N' \
        --null-non-string '\\N' \
        -m 1

我还考虑过以下

onClick: function(oEvent) {
                var base64 = "JVBERi0xLjUNCi...." //shortend

                var sDecodedFile = window.atob(base64);
                var sFileName = "test.pdf"

                var saveData = (function() {
                    var a = document.createElement("a");
                    document.body.appendChild(a);
                    a.style = "display: none";

                    return function(data, fileName) {
                        var json = JSON.stringify(data),
                            blob = new Blob([json], {
                                type: "data:application/pdf;base64"
                            }),
                            url = window.URL.createObjectURL(blob);
                        a.href = url;
                        a.download = fileName;
                        a.click();
                        window.URL.revokeObjectURL(url);
                    };
                }());

                var data = sDecodedFile,
                    fileName = sFileName;

                saveData(data, fileName);

            }

但我担心只会解析两个-D泛型参数中的一个。

这是正确的方法吗?

1 个答案:

答案 0 :(得分:0)

Java D标志在属性

之后不需要空格
sqoop import \
    -Dmapred.child.java.opts="-Djava.security.egd=file:///dev/urandom" \
    -Dmapred.job.queue.name=batch \

还修复了队列名称属性