Version 1.0 to 2.1
Copyright Â© 2015-2017 TigerGraph. All Rights Reserved
For technical support on this topic, contact
with a subject line beginning with “GSQL”
In version 1.0 of the TigerGraph platform
, the GSQL shell has been split into a client and a server. Among the benefits are the ability to run one or more GSQL clients remotely. This document explains how to set up a GSQL client and how to operate it. No special action is need to run it locally. To the user, they behave as though they are one unit.
Table of Contents
When the TigerGraph platform is installed, the GSQL client and server are on the same machine. The client is packaged as a Java jar file,
located in the folder <
. Installation consists of copying the file gsql_client.jar to the client machine and storing in anywhere the user finds to be appropriate. The client machine needs to have Java 7.0 or higher.
Running the Client
To run the client, execute the jar file each time that you would run gsql if you were local to the GSQL server. That is, the command
takes the place of gsql. For example, the commands
Therefore, it may be useful to define a Unix alias:
The java operation alone is not sufficient, however, because it does not tell the client where to find the GSQL server. In addition, the client needs to satisfy two conditions:
- It must know the IP address of the GSQL server.
- It must have the authorization to access the server in general and to execute the requested GSQL commands in particular.
Specifying Server IP Address
There are two ways to provide the IP address of the GSQL Server.
Method 1: Store the address in a file. Create a one-line file called
containing the ip address of the GSQL server.
This file needs to be in the same directory where you run GSQL.
: Every time you run the client jar,
provide the ip address on the command line,
gsql -ip 192.168.55.46
Client Authorization and Authentication
The GSQL server applies the same user authentication procedures to remote GSQL users that it applies to local GSQL users. That is, if user authentication has been enabled, then each gsql command line must include valid user credentials.
The client addresses the server at server port 8123. You need to make sure your security policy allows the access to this port.
It is strongly recommended that you enable user authentication. See the document
Managing User Privileges and Authentication v2.1#GSQLAuthentication
for more details.
File Path Semantics
Data loading jobs always specify an input file location; logically the data should be on the server side, not on the client side. Because the command request comes from one machine and the target data file is on another machine, it no longer makes sense to use a relative path.
Rule: If a remote GSQL client invokes an instruction containing a relative path, the GSQL server considers the starting point of the path to be <tigergraph_root_dir>/dev/gdk/gsql on the GSQL server.
It is strongly recommended that remotely-run GSQL commands use absolute paths only.
For example, if the data file cf_data.csv is in the folder /home/tigergraph/example/cf/, then the command to run the loading job might look like this:
Example: Modifying a Bash Script for a Remote GSQL Client
The GSQL Tutorials employ both GSQL and bash scripts to run the examples. Typically, each example case contains 3 GSQL command files (for schema creation, data loading, and querying) and one bash script to run all the parts together and to display status information. Below is a simplified version of the Collaborative Filtering (cf) bash script:
The bash script will not run from a remote GSQL client unless a few changes are made: We need to invoke “java -jar gsql_client.jar” instead of “gsql”, and need to specify the server ip address. If we use the gsql_server_ip_config file, this file must be in the same folder as the command file. The GSQL Tutorial has several different folders, one for each example, so that suggests making several config files. Below is an approach that minimizes the changes required and maximizes standardization.
A. Do initial client setup. This is done only once.
Store gsql_client.jar in a standard location, say
Create a file called gsql_server_ip_config containing the GSQL server’s IP address, and store it a standard location, say
In the .bashrc file in your home directory, add an alias for gsql which points to the standard location:
B. Add a standard header to each bash script.
This header does the following:
Repeat the alias defiinition
for the gsql command. The definition in .bashrc may not be visible here.
- By default, bash scripts ignore aliases. Instruct the script to use aliases.
- Define softlinks from the current folder to the locations of the client jar and config file.
C. Change any relative paths to absolute paths. This is the only step that must be customized for each script.
Here is the resulting script. Four standard lines were added to the beginning, and one line was edited in the cf_load.gsql file.