Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AWS Keyspaces #2370

Closed
adric-work opened this issue Jan 21, 2021 · 16 comments · Fixed by #2644
Closed

Add support for AWS Keyspaces #2370

adric-work opened this issue Jan 21, 2021 · 16 comments · Fixed by #2644

Comments

@adric-work
Copy link

Describe the feature:
Add support for AWS Keyspaces' "DefaultPartitioner"

https://stackoverflow.com/questions/62220244/run-janusgraph-with-aws-keyspace-storage-backend

At the moment it looks like there is only support for
"RandomPartitioner" and "Murmur3Partitioner"

Describe a specific use case for the feature:
I would like to use AWS's managed Cassandra DB "Keyspaces" as my database for The Hive 4. I was able to connect via cqlsh from my The Hive instance, but was unable to get Janusgraph to connect.

Older issue where people are asking for the same feature in the comments:
TheHive-Project/TheHive#1286

@farodin91
Copy link
Contributor

I could think we could easily add an option to force usage one of three support partitioner.

@li-boxuan
Copy link
Member

Seems duplicate of #2291

Not sure but I suspect the DataStax driver we are using does not support AWS's DefaultPartitioner. https://community.datastax.com/questions/2989/trying-to-connect-to-aws-cassandra-with-datastaxsp.html

@bezalel
Copy link

bezalel commented Jan 28, 2021

I could think we could easily add an option to force usage one of three support partitioner.

I hope to use AWS managed Cassandra (Keyspaces) as JanusGraph storage backend!

is it simple issue to be fixed by adding "com.amazonaws.cassandra.DefaultPartitioner" support on CQLStoreManager.java?
https://github.com/JanusGraph/janusgraph/blob/master/janusgraph-cql/src/main/java/org/janusgraph/diskstorage/cql/CQLStoreManager.java#L217-L235

@li-boxuan
Copy link
Member

It would be helpful if someone can confirm that the DataStax driver can be used to connect to AWS managed Cassandra first. Otherwise, there is not much JanusGraph can do at the moment.

@andreacardaropoli
Copy link

It would be helpful if someone can confirm that the DataStax driver can be used to connect to AWS managed Cassandra first. Otherwise, there is not much JanusGraph can do at the moment.

By the looks of it, it should be possible according to AWS documentation: https://docs.aws.amazon.com/keyspaces/latest/devguide/using_java_driver.html#java_tutorial

@li-boxuan
Copy link
Member

li-boxuan commented Mar 1, 2021

I tested today by building a custom janusgraph version. No luck yet. I encountered the same problems reported at https://forums.aws.amazon.com/thread.jspa?messageID=942152 which seems to be a general problem with using Datastax Driver. Unfortunately, the solution on that thread seems to be switching to other drivers.

UPDATE: I overcame the previous problem. Now I got this error: "com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: TOKEN is not yet supported". According to https://forums.aws.amazon.com/thread.jspa?messageID=942371 and https://forums.aws.amazon.com/thread.jspa?messageID=947841 seems AWS keyspace does not support token keyword. Thus, JanusGraph cannot be used on top of Amazon keyspace before they add token support.

UPDATE2: I overcame the previous problem by modifying the janusgraph code further. I Will continue testing and come back later

UPDATE3 (Mar 20, 2021): I was able to connect to AWS keyspace and load the GraphOfTheGods toy graph. Basic graph operations worked:

gremlin> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[cql:[cassandra.ap-east-1.amazonaws.com]], standard]
gremlin> g.V().valueMap()
12:24:00 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query requires iterating over all vertices [()]. For better performance, use indexes
==>[name:[tartarus]]
==>[name:[cerberus]]
==>[name:[sky]]
==>[name:[jupiter],age:[5000]]
==>[name:[nemean]]
==>[name:[hercules],age:[30]]
==>[name:[alcmene],age:[45]]
==>[name:[hydra]]
==>[name:[neptune],age:[4500]]
==>[name:[saturn],age:[10000]]
==>[name:[pluto],age:[4000]]
==>[name:[sea]]

There are some changes needed in the JanusGraph source code which I will clean up when I have some time. In case anyone wants to try now, apply this patch and do a janusgraph build.

Below are the configs needed:

storage.hostname=cassandra.<your-datacenter, e.g. ap-east-1>.amazonaws.com
storage.port=9142
storage.username=<your-service-username>
storage.password=<your-service-password>

storage.cql.keyspace=janusgraph
storage.cql.local-datacenter=<your-datacenter, e.g. ap-east-1>
storage.cql.ssl.enabled=true
storage.cql.ssl.truststore.location=<your-trust-store-location>
storage.cql.ssl.truststore.password=<your-trust-store-password>

storage.cql.only-use-local-consistency-for-system-operations=true
storage.cql.read-consistency-level=LOCAL_QUORUM
storage.cql.write-consistency-level=LOCAL_QUORUM

log.janusgraph.key-consistent=true
log.tx.key-consistent=true

li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Apr 4, 2021
Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Apr 5, 2021
Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Apr 5, 2021
Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Apr 5, 2021
Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Apr 5, 2021
Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit that referenced this issue Apr 10, 2021
Part of #2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue May 16, 2021
For backends that support client-side generated timestamps, JanusGraph
uses its internal time provider to generate transaction timestamps.
In some scenarios, this is not only unnecessary but also discouraged
(e.g. Amazon Keyspace does not support USING TIMESTAMP clause). This
commit provides a configuration option with which users can disable
this timestamp generation mechanism and let the drivers/servers decide.

Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue May 16, 2021
For backends that support client-side generated timestamps, JanusGraph
uses its internal time provider to generate transaction timestamps.
In some scenarios, this is not only unnecessary but also discouraged
(e.g. Amazon Keyspace does not support USING TIMESTAMP clause). This
commit provides a configuration option with which users can disable
this timestamp generation mechanism and let the drivers/servers decide.

Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
@gvassallo
Copy link

Hi, @li-boxuan! I see there has been several commits/PRs mentioning this issue. Do you know if as of now it would be possible to use AWS Keyspaces with janusgraph? I saw the patch you linked in your comment and I was wondering if those code changes were still required or if it would be enough to set up the correct configuration now that more options (e.g. selecting a partitioner) are available

@porunov
Copy link
Member

porunov commented May 28, 2021

@gvassallo as far as I understand this PR should also be merged #2618 to support Amazon Keyspace but @li-boxuan can answer this question better.

@li-boxuan
Copy link
Member

#2618 is required to be merged. Likely one more small PR is needed as demonstrated here, because Amazon keyspace does not support token.

@gvassallo
Copy link

Thank you for your answers and for the work you're doing! Some weeks ago I tried to run one of the latest versions of janusgraph with AWS keyspaces and among the things that were not working, I had an issue when selecting the partitioner via configuration. i.e. if you set a partitioner, e.g. DefaultPartitioner, the switch case here will still throw an exception. Is it something that needs to be adapted as well?

@li-boxuan
Copy link
Member

li-boxuan commented May 31, 2021

@gvassallo Yeah you are right... That adds one more small piece onto my plate 😉 This is needed to make it work. I think when I made the PR #2556 I forgot to make that change.

@gvassallo
Copy link

Yes exactly, good that you have that covered :)

li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue May 31, 2021
For backends that support client-side generated timestamps, JanusGraph
uses its internal time provider to generate transaction timestamps.
In some scenarios, this is not only unnecessary but also discouraged
(e.g. Amazon Keyspace does not support USING TIMESTAMP clause). This
commit provides a configuration option with which users can disable
this timestamp generation mechanism and let the drivers/servers decide.

Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Jun 2, 2021
For backends that support client-side generated timestamps, JanusGraph
uses its internal time provider to generate transaction timestamps.
In some scenarios, this is not only unnecessary but also discouraged
(e.g. Amazon Keyspace does not support USING TIMESTAMP clause). This
commit provides a configuration option with which users can disable
this timestamp generation mechanism and let the drivers/servers decide.

Part of JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit that referenced this issue Jun 4, 2021
For backends that support client-side generated timestamps, JanusGraph
uses its internal time provider to generate transaction timestamps.
In some scenarios, this is not only unnecessary but also discouraged
(e.g. Amazon Keyspace does not support USING TIMESTAMP clause). This
commit provides a configuration option with which users can disable
this timestamp generation mechanism and let the drivers/servers decide.

Part of #2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Jun 5, 2021
Closes JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Jun 5, 2021
Closes JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
li-boxuan added a commit to li-boxuan/janusgraph that referenced this issue Jun 6, 2021
Closes JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
@porunov porunov added this to the Release v0.6.0 milestone Jun 7, 2021
li-boxuan added a commit that referenced this issue Jun 12, 2021
Closes #2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
liamn pushed a commit to liamn/janusgraph that referenced this issue Nov 11, 2021
Closes JanusGraph#2370

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
@aziv2010
Copy link

aziv2010 commented Apr 5, 2022

@li-boxuan Hi Li. As of today, April 5'th 2022, can Janus be used with AWS Keyspaces? Thanks.

@aziv2010
Copy link

aziv2010 commented Apr 5, 2022 via email

@li-boxuan
Copy link
Member

@aziv2010 Yes, it's an experimental feature. You are more than welcome to try it and let us know if there is any issue. https://docs.janusgraph.org/storage-backend/cassandra/#deploying-on-amazon-keyspaces-experimental

@nadouani
Copy link

nadouani commented Apr 5, 2022

@adric-work you've got the answer :) The PR is in JG 0.6.0 which is used by TheHive 5. Good testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants