Integrate Quine and Astra DB Serverless
Quine uses a graph to represent both your data model and computational model.
With the Quine Cassandra Persistor, you can visualize and explore data in your Astra DB Serverless databases.
Prerequisites
-
Familiarity with Quine
-
JDK 11 or later
Prepare Astra
-
Create an Astra DB Serverless database or use an existing one.
-
Generate an application token with the Database Administrator role.
-
Download your database’s Secure Connect Bundle (SCB).
For multi-region databases, download the SCB for the region closest to where you plan to run Quine.
-
Create a keyspace named
quine
in your database.
Configure Quine
The following steps set up a new Quine project with the Cassandra persistor. Modify them as needed if you want to add the Cassandra persistor to an existing Quine project.
-
Create a
quine
directory, and then copy the JAR file to that directory. For example:mkdir ~/local/quine cp ~/Downloads/quine-VERSION.jar ~/local/quine
-
In the
quine
directory, create aquine.conf
file:cd ~/local/quine touch quine.conf
-
Edit the
quine.conf
file to use the Cassandra persistor and connect to your Astra database. For more information, see Astra DB configuration for the Cassandra persistor.quine.confquine.store { # store data in an Apache Cassandra instance type = cassandra # the keyspace to use keyspace = quine should-create-keyspace = false should-create-tables = true replication-factor = 3 write-consistency = LOCAL_QUORUM read-consistency = LOCAL_QUORUM local-datacenter = "REGION" write-timeout = "10s" read-timeout = "10s" } # An earlier version of the Java driver is used here. # Check the Quine documentation for dependency updates. datastax-java-driver { advanced { auth-provider { class = PlainTextAuthProvider username = "token" password = "APPLICATION_TOKEN" } } basic { cloud { secure-connect-bundle = "PATH/TO/SCB.zip" } } }
Replace the following:
-
REGION
: The region where your database is located, such asus-east1
. For multi-region databases, use the same region as the SCB. -
APPLICATION_TOKEN
: A secure reference to your database’s application token (prefixed byAstraCS:
). -
PATH/TO/SCB.zip
: The path to your database’s SCB zip file.
-
Quine recommends automatic table creation for development and testing only.
Run Quine
-
Run Quine with
quine.conf
:java -Dconfig.file=quine.conf -jar quine-VERSION.jar
-
Wait for the
Quine app web server available
message before proceeding.A warning about valid table options is expected, and you can ignore it.
2022-06-15 15:11:52,666 WARN [NotFromActor] [s0-io-4] com.datastax.oss.driver.internal.core.cql.CqlRequestHandler - Query '[0 values] CREATE TABLE IF NOT EXISTS journals (quine_id blob,timestamp bigint,data blob,PRIMARY KEY(quine_id,timestamp)) WITH CLUSTERING ORDER BY (timestamp ASC) AND compaction={'class':'TimeWindowCompactionStrategy'}' generated server side warning(s): Ignoring provided values [compaction] as they are not supported for Table Properties (ignored values are: [additional_write_policy, bloom_filter_fp_chance, caching, cdc, compaction, compression, crc_check_chance, dclocal_read_repair_chance, extensions, gc_grace_seconds, id, max_index_interval, memtable_flush_period_in_ms, min_index_interval, nodesync, read_repair, read_repair_chance, speculative_retry]) Graph is ready! Application state loaded. Quine app web server available at http://localhost:8080
-
To use Quine’s visual graph explorer, open a web browser, and then navigate to your Quine app web server’s address. From here, you can create or traverse data with Gremlin or Cypher. You can navigate to the Quine API specification locally at
QUINE_WEB_SERVER/docs
.
Optional: Load sample data
Use these steps if you want to test some sample data with your Quine integration:
-
In a separate terminal, run the following command to gracefully shut down Quine:
curl -X "POST" "http://localhost:8080/api/v1/admin/shutdown"
-
Download
attempts.json
from the Quine Password Spraying Detection tutorial. -
Store the sample data file in the root of your
quine
directory alongside your Quine JAR file. -
Start Quine with your
quine.conf
and the sample data:java -Dconfig.file=quine.conf -jar quine-VERSION.jar -r passwordspraying
-
Wait while Quine starts and loads the data. Wait for output such as the following:
INGEST-1 status is completed and ingested 55000
-
Navigate to your Quine web server to explore the data.
Troubleshoot the Quine integration
If the Quine server doesn’t start, and the driver returns a clustering key error, do the following:
-
Use the
cqlsh
to check that thesnapshots
table exists:cqlsh> use quine; cqlsh> desc quine;
-
If the
snapshots
table doesn’t exist, run the following CQL statement to create it:CREATE TABLE quine.snapshots ( quine_id blob, timestamp bigint, multipart_index int, data blob, multipart_count int, PRIMARY KEY (quine_id, timestamp, multipart_index) ) WITH CLUSTERING ORDER BY (timestamp DESC, multipart_index ASC) AND additional_write_policy = '99PERCENTILE' AND bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.UnifiedCompactionStrategy'} AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND default_time_to_live = 0 AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair = 'BLOCKING' AND speculative_retry = '99PERCENTILE';