0


我需要你的帮助!
3 天我无法通过 Sqoop Rest API 创建链接。
安装在克劳德拉的 Hadoop 集群上的 Sqoop2 服务器
我发送带有正文的 post 请求:

{
    "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 结构的解决方案。

4

1 回答 1

0

我也遇到了一些 json 问题,我发现这个解决方法非常有用:在 shell 中转到 sqoop2 shell(我在 sqoop2 服务器机器的提示符中键入 sqoop2),使用 shell 创建链接/作业等例如“创建链接”命令完整文档在这里sqoop2 命令行 shell

现在您可以使用其余 api 获取链接 - /v1/link/[lid]

于 2017-04-06T07:48:09.390 回答