Failed to connect to a Cassandra cluster's all nodes without default port
zhouyu74748585@...
only one node's is correct, the others' port change to 9042, the default one. so I can only connect to one node. I try to fix this, but it only useful when all nodes' port are the same.if different node has different port.it will not work. So I hope someone will have a good solution. |
|
|
|
Boxuan Li
Hi, Can you check your cassandra nodes’ configurations? It looks like some of your nodes are still using 9042 for native transport port. Cheers, Boxuan 「<zhouyu74748585@...>」在 2021年6月17日 週四,下午4:39 寫道:
|
|
|
|
zhouyu74748585@...
hi, the cluster builder has a default port 9042,and finally return a cluster with port 9042, the port in configurations will not be use. |
|
|
|
Boxuan Li
Hi,
toggle quoted message
Show quoted text
I am not sure what code you think is problematic. Can you provide 1) your JanusGraph version, and 2) the specific line(s) that you believe a bug exists? What happens if you only provide only ONE host:port in the “storage.hostname”? Do you still see the same log? I am asking because the log you provided comes from DataStax Driver, not JanusGraph. The DataStax driver tries to connect to the cluster via the entry points you provide, even though the entry points are not a complete or correct set of all hosts. The driver then fetches meta data from the cluster and prints logs like “New Cassandra host XX added”. Thus, I suspect not every host in your Cassandra cluster uses 9042 port.
|
|
|
|
zhouyu74748585@...
Hi,
the version is 0.53,and the line is line 220 in org.janusgraph.diskstorage.cql.CQLStoreManager
The cluster builder's port is default 9042.
when I set one host,the logs are the same.if I set three hosts,janusgraph only chose one to connect to cassandra cluster。
janusgraph gets other ips from cluster's metadata.but use the default port 9042 in the local
cluster object,then the local cluster try to connect to the host with correct ip and default port.
|
|
|
|
Boxuan Li
What happens when you only use “192.168.223.3” as your storage.hostname, and don’t set storage.port? I am also not sure about what version of line 220 you are looking at. What is the commit hash? You can also just copy the code snippet here. 「<zhouyu74748585@...>」在 2021年6月22日 週二,上午9:42 寫道:
|
|
|
|
zhouyu74748585@...
The janusgraph will try to connect with 192.168.223.3:9042 I find the codes in janusgraph-cql-0.5.3.jar, the codes is:
final Builder builder = Cluster.builder() .addContactPointsWithPorts(contactPoints) .withClusterName(configuration.get(CLUSTER_NAME)); //.withPort(configuration.get(CLUSTER_PORT));
in branch V0.5 fed8439 I append the last line to solve this problem,but it only work when all the host have same port; |
|
|
|
Ronnie
Yes. We face same issue when using custom ports with C* backend. The first host:port in storage.hostname is processed correctly. For the remainder of comma separated host:port, JanusGraph tried to connect to those servers with the default port of 9042. We had this problem since JanusGraph 0.4.x was hoping this would be fixed by 0.5.3, but this issue still exist.
|
|
|
|
Boxuan Li
I am a bit confused here. In fed8439, CQLStoreManager.java#L220 (https://github.com/JanusGraph/janusgraph/blob/fed8439/janusgraph-cql/src/main/java/org/janusgraph/diskstorage/cql/CQLStoreManager.java#L220) is
Are we looking at the same line here?
|
|
|
|
zhouyu74748585@...
Hi,
I am sorry to make you confused. I get the line number 220 from a .class file, not a .java file. the line number in java file is 246. you can read it from the screenshot but I don't mean this line case the issue,just because I this is a good position to set the port to replace the default port. |
|
|
|
Boxuan Li
Got it. It does not seem to be a JanusGraph problem. I didn’t dig deep into it but seems it’s a limitation of Cassandra. See https://datastax-oss.atlassian.net/browse/JAVA-1388#icft=JAVA-1388 and other tickets mentioned there.
toggle quoted message
Show quoted text
Right now I would suggest you avoid using different native transport ports in the same Cassandra cluster.
|
|
|
|
Boxuan Li
Sorry I misunderstood your problem. I thought you have a cluster with different transport ports, which is not supported prior to Cassandra 4.
toggle quoted message
Show quoted text
Turns out your cluster is using a uniform non-default transport port for every host. I am not 100% sure but seems this is fixed in Datastax java driver 4, which is included in JanusGraph 0.6.0. Can you try the master version of JanusGraph and see if you still have this problem?
|
|
|
|
zhouyu74748585@...
It works well with version 0.6.0-SNAPSHOT.
hope the realease version come soon |
|
|