Sqoop2 Rest API链接创建

时间:2016-09-28 09:10:22

标签: apache rest api hadoop sqoop2


我需要你的帮助!
3天我无法通过Sqoop Rest API创建链接。
Sqoop2 Server安装在克劳德拉的Hadoop集群上 我发送邮件请求与身体:

{
    "link" : {
        "id" : -1,
        "enabled" : true,
        "update-date" : 1415287846371,
        "creation-date" : 1415287846371,
        "update-user" : "user",
        "creation-user" : "user",
        "name" : "JDBCtest_table",
        "connector-id" : 4,
        "link-config-values" : [{
                "id" : 9,
                "inputs" : [{
                        "id" : 18,
                        "overrides" : "",
                        "name" : "linkConfig.jdbcDriver",
                        "value" : "com.postgresql.jdbc.Driver",
                        "type" : "STRING",
                        "size" : 128,
                        "sensitive" : false
                    }, {
                        "id" : 19,
                        "overrides" : "",
                        "name" : "linkConfig.connectionString",
                        "value" : "jdbc:postgresql:\/\/11.11.111.1111:5432\/database",
                        "type" : "STRING",
                        "size" : 128,
                        "sensitive" : false
                    }, {
                        "id" : 20,
                        "overrides" : "",
                        "name" : "linkConfig.username",
                        "value" : "username",
                        "type" : "STRING",
                        "size" : 40,
                        "sensitive" : false
                    }, {
                        "id" : 21,
                        "overrides" : "",
                        "name" : "linkConfig.password",
                        "value" : "pass",
                        "type" : "STRING",
                        "size" : 40,
                        "sensitive" : false
                    }, {
                        "id" : 22,
                        "overrides" : "",
                        "name" : "linkConfig.jdbcProperties",
                        "value" : {
                            "useUnicode" : true
                        },
                        "type" : "MAP",
                        "sensitive" : false
                    }
                ],
                "name" : "JDBC_test_table_Input",
                "type" : "LINK"
            }
        ]
    }
}

服务器返回错误:

{
  "message": "Detected incorrect link config structure",
  "error-code-class": "org.apache.sqoop.error.code.ServerError",
  "stack-trace": [
    {
      "file": "LinkRequestHandler.java",
      "line": 146,
      "class": "org.apache.sqoop.handler.LinkRequestHandler",
      "method": "createUpdateLink"
    },
    {
      "file": "LinkRequestHandler.java",
      "line": 68,
      "class": "org.apache.sqoop.handler.LinkRequestHandler",
      "method": "handleEvent"
    },
    {
      "file": "LinkServlet.java",
      "line": 72,
      "class": "org.apache.sqoop.server.v1.LinkServlet",
      "method": "handlePostRequest"
    },
    {
      "file": "SqoopProtocolServlet.java",
      "line": 63,
      "class": "org.apache.sqoop.server.SqoopProtocolServlet",
      "method": "doPost"
    },
    {
      "file": "HttpServlet.java",
      "line": 643,
      "class": "javax.servlet.http.HttpServlet",
      "method": "service"
    },
    {
      "file": "HttpServlet.java",
      "line": 723,
      "class": "javax.servlet.http.HttpServlet",
      "method": "service"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 290,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "internalDoFilter"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 206,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "doFilter"
    },
    {
      "file": "AuthenticationFilter.java",
      "line": 622,
      "class": "org.apache.hadoop.security.authentication.server.AuthenticationFilter",
      "method": "doFilter"
    },
    {
      "file": "DelegationTokenAuthenticationFilter.java",
      "line": 291,
      "class": "org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter",
      "method": "doFilter"
    },
    {
      "file": "AuthenticationFilter.java",
      "line": 574,
      "class": "org.apache.hadoop.security.authentication.server.AuthenticationFilter",
      "method": "doFilter"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 235,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "internalDoFilter"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 206,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "doFilter"
    },
    {
      "file": "StandardWrapperValve.java",
      "line": 233,
      "class": "org.apache.catalina.core.StandardWrapperValve",
      "method": "invoke"
    },
    {
      "file": "StandardContextValve.java",
      "line": 191,
      "class": "org.apache.catalina.core.StandardContextValve",
      "method": "invoke"
    },
    {
      "file": "StandardHostValve.java",
      "line": 127,
      "class": "org.apache.catalina.core.StandardHostValve",
      "method": "invoke"
    },
    {
      "file": "ErrorReportValve.java",
      "line": 103,
      "class": "org.apache.catalina.valves.ErrorReportValve",
      "method": "invoke"
    },
    {
      "file": "StandardEngineValve.java",
      "line": 109,
      "class": "org.apache.catalina.core.StandardEngineValve",
      "method": "invoke"
    },
    {
      "file": "CoyoteAdapter.java",
      "line": 293,
      "class": "org.apache.catalina.connector.CoyoteAdapter",
      "method": "service"
    },
    {
      "file": "Http11Processor.java",
      "line": 861,
      "class": "org.apache.coyote.http11.Http11Processor",
      "method": "process"
    },
    {
      "file": "Http11Protocol.java",
      "line": 620,
      "class": "org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler",
      "method": "process"
    },
    {
      "file": "JIoEndpoint.java",
      "line": 489,
      "class": "org.apache.tomcat.util.net.JIoEndpoint$Worker",
      "method": "run"
    },
    {
      "file": "Thread.java",
      "line": 745,
      "class": "java.lang.Thread",
      "method": "run"
    }
  ],
  "error-code": "SERVER_0003",
  "class": "org.apache.sqoop.common.SqoopException"
}

我阅读了文档,找不到json正确结构的解决方案。

1 个答案:

答案 0 :(得分:0)

我也有一些json问题,我发现这个解决方法非常有用: 转到sqoop2 shell(我在sqoop2服务器机器的提示符下键入sqoop2) 在shell中时,使用shell创建链接/作业等'create link'命令 完整的文档在这里sqoop2 command line shell

现在您可以使用其余的api - / v1 / link / [lid]

来获取链接