Configure DataStax Graph to run QuickStart.
To use DSG, a graph must be created. Using DataStax Studio, either a pre-populated notebook, DataStax Graph 6.8 QuickStart, can be used, or a new notebook can be created. Instructions for both are provided. In addition, if Gremlin console is used for this QuickStart, a graph must be created, and an alias to set a graph traversal source must be executed in order for the code examples to work. The set alias identifies the graph in which all schema and queries are executed.
Should Gremlin console be exited, you must set the alias configuration again before proceeding.
DataStax Studio is a visual browser-based tool that provides a better understanding of the interconnectedness of the graph data. The Gremlin console is a command-line interface that is better suited to automation of checking and verifying query results and scripting. For initial exploration and development, Studio is highly recommended, whereas greater familiarity with DSG will make Gremlin console handy for automated verification.
Create a Studio notebook and configure a graph for the QuickStart. If you are using Gremlin console, skip to the instructions for set up..
This tutorial exists as a Studio notebook, DataStax Graph 6.8 QuickStart, so that you do not have to create a notebook. However, in Studio, creating a notebook is simple. If running Studio on a Graph node, the default connection of
localhostworks, otherwise create a connection for the node desired. Each notebook is connected to a particular graph. Multiple notebooks can be connected to the same graph, or multiple notebooks can be created to connect to different graphs.
Studio can create a graph from a number of different places. You can create the graph as the last step during notebook creation, or open a notebook and add a graph. Either way, several choices must be configured. The graph must be given a name, graph type designated, and replication factor settings selected.
Graph type: Core is the default and preferred graph engine for DataStax Graph 6.8. It allows users to access their graph data via CQL as well as Gremlin. The schemas for storing Core and Classic graphs are different, so Classic should be chosen only if a notebook will use graph data created using DataStax Graph 6.7 or earlier.
Replication factor: The default is set to 1. Production clusters and multi-datacenter clusters need a higher replication factor.
Replication strategy: The default is NetworkTopologyStrategy. In general, this default is the good option.
Create a graph in Gremlin console and configure the graph for the QuickStart.
Create a graph to hold the data. The system commands are used to run commands that affect graphs in DSG.
system.graph('food_qs'). ifNotExists(). create()
Once a graph exists, a graph traversal g is configured that will allow graph traversals to be executed. Graph traversals are used to query the graph data and return results. The graph traversal can be bound to either the standard OLTP engine or the OLAP engine. In order to execute any schemas or other queries in the Gremlin console, a graph traversal must be executed first. Configure a graph traversal
gto use the default graph traversal setting, which is
:remote config alias g food_qs.g
As with all queries in Graph, if you are using Gremlin console, alias the graph traversal g to a graph with
:remote config alias g food_qs.gbefore running any commands.
When creating a new graph, to check what graphs already exist, use: