Could not alias [g] to [g] as [g]

234 views
Skip to first unread message

Yamiteru XYZ

unread,
Jan 3, 2021, 5:56:20 PM1/3/21
to JanusGraph users
Hi, I have JanusGraph with Scylla and Elasticsearch in a docker. I'm connecting to JanusGraph on backend using gremlin.

I see this error only on my server and not on my local machine. What does it mean and more importantly how do I fix it? I'm a noob when it comes to backend and database stuff so please be kind. Thank you.


HadoopMarc

unread,
Jan 4, 2021, 11:37:37 AM1/4/21
to JanusGraph users
Hi,

Can you show the gremlin server yaml config file (part of janusgraph) as well as the groovy script file it refers to? The groovy script should define the GraphTraversalSource g that you want to bind to.

Best wishes,     Marc

Op zondag 3 januari 2021 om 23:56:20 UTC+1 schreef yamit...@gmail.com:

Yamiteru XYZ

unread,
Jan 5, 2021, 6:38:27 AM1/5/21
to JanusGraph users
I'm using the docker version and I haven't changed anything. Where do I find the yaml config? I've tested it on 2 PC's (ubuntu and windows) and it works without a problem. It doesn't work only on a server (ubuntu).

HadoopMarc

unread,
Jan 5, 2021, 8:33:55 AM1/5/21
to JanusGraph users
OK, I understand now what you mean with "I see this error only on my server ". What happens if you try to open a websocket connection with a test webscocket client, e.g. for firefox:


It might be that the server does not have an open 8182 port. For less wilder guesses, I really need more information (client stacktrace, server logs, etc).

Best wishes,     Marc
Op dinsdag 5 januari 2021 om 12:38:27 UTC+1 schreef yamit...@gmail.com:

Yamiteru XYZ

unread,
Jan 6, 2021, 6:02:22 AM1/6/21
to JanusGraph users
I cannot open a websocket connection even on my local instance. How do I get the info that would help you determine what's wrong?

Yamiteru XYZ

unread,
Jan 6, 2021, 6:02:26 AM1/6/21
to JanusGraph users
This is my docker-compose.yml

version: "3"

services:
graph:
image: janusgraph/janusgraph:0.5.2
environment:
JANUS_PROPS_TEMPLATE: cassandra-es
janusgraph.storage.backend: cql
janusgraph.storage.hostname: db
janusgraph.index.search.hostname: index
ports:
- "8182:8182"
- "8184:8184"
depends_on:
- db
- index
db:
image: scylladb/scylla:4.2.1
ports:
# REST API
- "10000:10000"
# CQL
- "9042:9042"
# Thrift
- "9160:9160"
# Internode
- "7000:7000"
- "7001:7001"
# JMX
- "7199:7199"
# Prometheus
- "9180:9180"
- "9100:9100"
volumes:
- ./data/db/data:/var/lib/db
index:
image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0
environment:
- discovery.type=single-node
- http.host=0.0.0.0
- transport.host=127.0.0.1
ports:
- "9200:9200"
- "9300:9300"
volumes:
- ./data/index/data:/usr/share/index/data

On Tuesday, January 5, 2021 at 2:33:55 PM UTC+1 HadoopMarc wrote:

Yamiteru XYZ

unread,
Jan 6, 2021, 6:02:29 AM1/6/21
to JanusGraph users
So it had to be something with a firewall blocking some of the ports.. I've disabled the firewall and it works. Thank you :)

On Tuesday, January 5, 2021 at 2:33:55 PM UTC+1 HadoopMarc wrote:

Yamiteru XYZ

unread,
Jan 6, 2021, 6:02:32 AM1/6/21
to JanusGraph users
Ok now it stopped working and I haven't done anything since it started working.. wtf..

On Tuesday, January 5, 2021 at 2:33:55 PM UTC+1 HadoopMarc wrote:

Yamiteru XYZ

unread,
Jan 6, 2021, 6:02:35 AM1/6/21
to JanusGraph users
The websocket is open. I forgot to put "/gremlin" at the end.

On Tuesday, January 5, 2021 at 2:33:55 PM UTC+1 HadoopMarc wrote:

Yamiteru XYZ

unread,
Jan 6, 2021, 6:02:38 AM1/6/21
to JanusGraph users
I use this code on my server:

import { process, driver } from "gremlin";


const url = 'ws://localhost:8182/gremlin';
const traversal = process.AnonymousTraversalSource.traversal;
const DriverRemoteConnection = driver.DriverRemoteConnection;
const DriverClientConnection = driver.Client;
const remote = new DriverRemoteConnection(url);
const client = new DriverClientConnection(url);


export const g = traversal().withRemote(remote);
export const c = client;
export const T = process.t;
export const __ = process.statics;

export default g;

On Tuesday, January 5, 2021 at 2:33:55 PM UTC+1 HadoopMarc wrote:

HadoopMarc

unread,
Jan 6, 2021, 9:27:08 AM1/6/21
to JanusGraph users
Thnaks for posting back that the issue was solved!

Op woensdag 6 januari 2021 om 12:02:38 UTC+1 schreef yamit...@gmail.com:

Yamiteru XYZ

unread,
Jan 6, 2021, 10:25:10 AM1/6/21
to JanusGraph users
It wasn't as stated in later posts..

Yamiteru XYZ

unread,
Jan 7, 2021, 9:50:02 AM1/7/21
to JanusGraph users
Can you help me? It's really frustrating and I cannot find a solution. I can even give you ssh access so you can try to find a solution. Anything. I'm desperate.

HadoopMarc

unread,
Jan 7, 2021, 11:02:44 AM1/7/21
to JanusGraph users
Hi

I am lost in the stream of messages. I gather that:
  • you can establish a ws connection to your server with a general ws test client
  • you can run a "const g = traversal().withRemote(remote);" in javascript without error (has g indeed a value unequal to null???)
  • you try to export the GraphTraversalSource g and use it in some other module: how do you it does not work?
Can you try and print some debug statement using g in the module where it is defined. Look here for inspiration for a query using g:

Best wishes,     Marc


Op donderdag 7 januari 2021 om 15:50:02 UTC+1 schreef yamit...@gmail.com:

HadoopMarc

unread,
Jan 7, 2021, 11:08:12 AM1/7/21
to JanusGraph users
OK, I see that you run gremlin-npm locally on your server. Are you sure that localhost is exposed in the gremlin server? What happens if you connect from your local machine towards the ip address of the sever?

Marc

Op donderdag 7 januari 2021 om 17:02:44 UTC+1 schreef HadoopMarc:

Yamiteru XYZ

unread,
Jan 10, 2021, 7:17:50 AM1/10/21
to JanusGraph users
Hi,

- yes I can estabilish ws connection to my server with a general ws test client.

- the g in javascript prints this value:
GraphTraversalSource {
  graph: Graph {},
  traversalStrategies: TraversalStrategies { strategies: [ [RemoteStrategy] ] },
  bytecode: Bytecode { sourceInstructions: [], stepInstructions: [] },
  graphTraversalSourceClass: [class GraphTraversalSource],
  graphTraversalClass: [class GraphTraversal extends Traversal]
}

- when I try to print count like this I get no value at all:
g.V().count().toList()
  .then(v => console.log("-- COUNT --", v))
  .catch(e => console.log("-- ERROR --", e));

When I use "ws://46.36.36.121:8182/gremlin" instead of "ws://localhost:8182/gremlin" from my local machine I get the same "Could not alias [g] to [g] as [g] not in the Graph or TraversalSource global bindings" error.

Miroslav.

HadoopMarc

unread,
Jan 10, 2021, 10:30:54 AM1/10/21
to JanusGraph users
Hi,

Can you also try with the tested docker-compose-cql-es.yml from:


It has subtle differences with the yml file you listed. If you have a working situation to compare with, it easier to find what is wrong. If this does not work, it is easy for others to reproduce the issue.

Best wishes,    Marc
Op zondag 10 januari 2021 om 13:17:50 UTC+1 schreef yamit...@gmail.com:

Yamiteru XYZ

unread,
Jan 11, 2021, 11:34:06 AM1/11/21
to JanusGraph users
So it looks like the docker-compose-cql-es.yml works without a problem.

Yamiteru XYZ

unread,
Jan 11, 2021, 11:53:15 AM1/11/21
to JanusGraph users
When I replaced Cassandra with ScyllaDB it stopped working. Could it be that ScyllaDB is not compatible with either JanusGraph or Elasticsearch?

HadoopMarc

unread,
Jan 12, 2021, 2:02:08 AM1/12/21
to JanusGraph users
Hi,

Unfortunately, the janusgraph ref docs do not have full documentation for using scylladb, but in order to use scylladb you have to make sure the janusgraph configs are similar to the janusgraph-cql-es-server.properties from the janusgraph distribution. When comparing janusgraph-cassandra-es-server.properties and janusgraph-cql-es-server.properties, you will see that in many places "cassandra" is replaces with "cql".

See also the scylla docs, which state that compatibility holds when using the cql protocol:


Best wishes,     Marc
Op maandag 11 januari 2021 om 17:53:15 UTC+1 schreef yamit...@gmail.com:
Reply all
Reply to author
Forward
0 new messages