Gremlin Client Connecting to Gremlin / JanusGraph Server via URL-based Load Balancers

395 Views Asked by At

Due to security policies, I have a cluster of JanusGraph servers (running in an internal Kubernetes network) that can be accessed by external Gremlin clients via the below network route:

clients --> global load balancer (URL-based) --> third-party firewall --> internal load balancer --> graph servers

The endpoint exposed by the global load balancer is something like e.g. https://myhost.com/mypath1/mypath2/

This approach works fine for HTTP(S) based requests, as I am able to receive a response from the gremlin server when firing a curl command to the above global load balancer endpoint.

However, I have 2 other gremlin client usage patterns:

  1. using gremlin.sh console
  2. using gremlin-python client (or more generally, WebSocket clients)

Hence my questions are:

  1. In the remote.yaml file used by gremlin.sh client, how do I specify the global load balancer endpoint in the hosts and port parameters?

    • I have tried a few combinations (e.g. hosts = ['myhost.com']/['myhost.com/mypath1/mypath2'], port = 8182/443) but they all don't work
  2. In gremlin-python client, I am using a WebSocket-based connection. How do I specify the websocket connection string with the above endpoint?

    • I have tried various connection strings (e.g. ws(s)://myhost.com/mypath1/mypath2/gremlin) but they don't work too
1

There are 1 best solutions below

1
On

In the remote.yaml file used by gremlin.sh client, how do I specify the global load balancer endpoint in the hosts and port parameters?

For hosts you should just supply the host name (no path) and for port, it should just be 443 assuming that is the port you've exposed on your load balancer. Of course you also need to enable SSL - as an example note the settings provided in the packaged remote-secure.yaml file and see additional configuration options in https://tinkerpop.apache.org/docs/current/reference/#_configuration.

As for your custom path of mypath1/mypath2/gremlin, that is not configurable at this time. It expects that path to be /gremlin. I've created TINKERPOP-2379 in response.

In gremlin-python client, I am using a WebSocket-based connection. How do I specify the websocket connection string with the above endpoint?

I would expect this to work for Python: wss://myhost.com:443/mypath1/mypath2/gremlin