简体   繁体   English

您如何在Neptune上进行本地测试?

[英]How do you test locally with Neptune?

I am trying to test our neptune db using gremlin. 我正在尝试使用gremlin测试我们的neptune数据库。 I have come up short with way to test locally. 我想出了一种在本地测试的方法。 What are my options? 我有什么选择?

Currently just testing in real time. 目前只是实时测试。 This is obviously not very effecient. 这显然不是很有效。

If this is purely for testing purposes, then what you can do is resolve the DNS of your cluster writer endpoint to obtain its IP. 如果这仅是出于测试目的,那么您可以做的是解析群集编写器端点的DNS以获取其IP。

// From an EC2 instance that has connectivity to your DB:
dig +short cluster-writer-endpoint-here

Then, create an ALB that has target groups that forward requests to this IP. 然后,创建一个具有目标组的ALB,该目标组将请求转发到此IP。 Attach a security group to your ALB allowing it to be accessed via the internet or specifically via your local machine. 将安全组附加到您的ALB,以便可以通过Internet或专门通过本地计算机进行访问。

Now in your tests, point to the ALB endpoint as opposed to the DNS endpoint. 现在在您的测试中,指向ALB终结点而不是DNS终结点。

Why is this bad? 为什么这样不好?

IP address of your instances are not meant to be static. 您实例的IP地址不是静态的。 In the event of a failover or a host replacement, your IP of your endpoints would change. 如果发生故障转移或主机更换,则端点的IP将更改。 Your usecase of running some tests should be fine though. 不过,您运行一些测试的用例应该没问题。

Other gotchas? 其他陷阱?

If you have IAM Auth enabled on the cluster, then this technique will not work. 如果您在群集上启用了IAM Auth,则此技术将不起作用。 Also, if you are talking SSL, then your client would reject the request, since the cert returned by Neptune would not "trust" your ALB endpoint. 另外,如果您正在使用SSL,则客户端将拒绝该请求,因为Neptune返回的证书不会“信任”您的ALB端点。 You would either need to skip dns validation explicitly or set a Host header in your requests explicitly to point to the cluster endpoint itself. 您可能需要显式跳过dns验证,或者在请求中显式设置Host标头以指向群集端点本身。 Something like this: 像这样:

// To skip dns validation in curl
curl -k https://alb-endpoint:port/ 

// To set host head explicitly
curl -H 'Host: dns-endpoint' https://alb-endpoint:port/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM