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,
gsql_client.jar located in the folder
<TigerGraph_root_dir>/dev/gdk/gsql/lib/ . 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.
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 three 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.
If a SSL/TLS encrypted connection (e.g., HTTPS) is used, then it must provide the certificate chain.
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 gsql_server_ip_config containing the ip address of the GSQL server. This file needs to be in the same directory where you run GSQL.
Method 2 : Every time you run the client jar, provide the ip address on the command line, e.g., " gsql -ip 192.168.55.46 "
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.
If SSL/TLS is enabled for TigerGraph, to connect a GSQL remote client to the GSQL server, each GSQL command line should provide the certificate chain file via the -cacert option. This certificate file should be exactly the same as the file of entry Nginx.SSL.Cert setting SSL for Nginx. See Encrypting Connections: Step 2. Configure SSL with Gadmin. For example:
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.
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:
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 ~/gsql_client/gsql_client.jar (e.g,, /home/tigergraph/gsql_client/ gsql_client.jar )
Create a file called gsql_server_ip_config containing the GSQL server's IP address, and store it a standard location, say ~/gsql_client/gsql_server_ip_config .
3. 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 definition 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.