使用 REST API 在 apache atlas 中添加实体之间的关系的正确方法是什么?查看 REST API 的文档,我发现很难说出某些字段的含义,哪些是必需的(以及如果不输入会发生什么),或者应该是什么默认值(因为示例使用什么似乎是占位符值(例如,什么是provenanceType
或propagateTags
字段似乎期望某种枚举值,但从不指定有效选项))。
有人可以提供任何例子来说明这在实际/有效值中会是什么样子吗?例如。如果已经将 2 个实体 E1 和 E2 添加到 Atlas 并希望在两者之间建立关系,则想做类似...
curl -X POST --header 'Content-Type: application/json;charset=UTF-8' --header 'Accept: application/json' -d '{<simplified json>}' 'https://atlas-server-hostname:21000/v2/relationship'
试
[hph_etl@HW03 ~]$ curl -vv -u admin:admin -X POST --header 'Content-Type: application/json;charset=UTF-8' --header 'Accept: application/json' -d '{ \
"createTime": 1565135406, \
"createdBy": "hph_etl", \
"end1": { \
"guid": "2ddcda5b-2489-4636-a9ab-12b199c02422", \
"typeName": "hdfs_path" \
}, \
"end2": { \
"guid": "a33f45de-13d0-4a30-9df7-b0e02eb0dfd5", \
"typeName": "hdfs_path" \
}, \
"guid": "2ddcda5b-2489-4636-a9ab-12b199c02422", \
"propagateTags": "TWO_TO_ONE", \
"status": "ACTIVE", \
"typeName": "hdfs_path" \
}' 'http://HW03.co.local:21000/api/atlas/v2/relationship'
* About to connect() to HW03.co.local port 21000 (#0)
* Trying 172.18.4.48...
* Connected to HW03.co.local (172.18.4.48) port 21000 (#0)
* Server auth using Basic with user 'admin'
> POST /v2/relationship HTTP/1.1
> Authorization: Basic xxxxxx
> User-Agent: curl/7.29.0
> Host: HW03.co.local:21000
> Content-Type: application/json;charset=UTF-8
> Accept: application/json
> Content-Length: 442
>
* upload completely sent off: 442 out of 442 bytes
< HTTP/1.1 404 Not Found
< Date: Wed, 07 Aug 2019 01:07:44 GMT
< Set-Cookie: ATLASSESSIONID=xxxxxx;Path=/;HttpOnly
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Content-Type: text/html;charset=utf-8
< Content-Length: 2265
< Server: Jetty(9.3.14.v20161028)
<
<!doctype html>
<!--
....
*
* http://www.apache.org/licenses/LICENSE-2.0
....
-->
<!--[if gt IE 8]>
<script type="text/javascript">
function Redirect() {
window.location.assign("login.jsp");
}
Redirect();
</script>
<![endif]-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if gt IE 7]>
<script src="js/external_lib/es5-shim.min.js"></script>
<script src="js/external_lib/respond.min.js"></script>
<![endif]-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Atlas</title>
....
</head>
<body>
<div id="wrapper">
<!-- Page Content Begin -->
<div id="page-content-wrapper">
<div class="page-title clearfix">
<h3>Looking for something?</h3>
<p>We're sorry. The web address you're looking for is not a functioning page in Apache Atlas. Please try navigating from <a href="index.html">Apache Atlas Home</a></p>
</div>
</div>
<!-- Page Content End -->
</div>
</body>
</html>
* Connection #0 to host HW03.co.local left intact
不起作用,并且不确定如何处理错误消息。即使是简单的例子
curl -vv -u admin:admin -X POST --header 'Content-Type: application/json;charset=UTF-8' --header 'Accept: application/json' -d '{ \
"end1": { \
"guid": "2ddcda5b-2489-4636-a9ab-12b199c02422" \
}, \
"end2": { \
"guid": "a33f45de-13d0-4a30-9df7-b0e02eb0dfd5" \
}, \
"typeName": "AtlasRelationshipDef" \
}' 'http://HW03.ucera.local:21000/api/atlas/v2/relationship'
引发类似的无信息错误
* upload completely sent off: 211 out of 211 bytes
< HTTP/1.1 500 Internal Server Error
< Date: Mon, 12 Aug 2019 19:57:44 GMT
< Set-Cookie: ATLASSESSIONID=xxxxxx;Path=/;HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Server: Jetty(9.3.14.v20161028)
<
* Connection #0 to host HW03.co.local left intact
There was an error processing your request. It has been logged (ID 6d64bc3a1a910e46)
检查 atlas 主机服务器上的登录/var/logs/atlas/application.log
,我可以看到另一个无信息的错误消息......
[hph_etl@HW03 atlas]$ cat application.log | grep -C 2 6d64bc3a1a910e46
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2019-08-12 09:57:44,880 ERROR - [pool-2-thread-10 - 8a5535b1-6544-4f9b-b3ad-8bec5e8d6fcd:] ~ Error handling a request: 6d64bc3a1a910e46 (ExceptionMapperUtil:32)
javax.ws.rs.WebApplicationException
at com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66)
请注意,为了获得关系链接所需的 guid,即使 Hortonworks 似乎也只能提供一个糟糕的解决方案。
这里可能出了什么问题?有没有比那些链接到的更好的文档来理解 API?