How to Work With the GridGain CLI
Connect to a cluster, execute SQL, and manage cluster state using the GridGain 9 command-line interface.
Prerequisites
A running 3-node cluster (How to Start a Cluster with Docker Compose)
The GridGain CLI installed on your machine. Install it as described in Installing Using ZIP and add the
bin/directory to your PATH. Alternatively, use the CLI bundled inside the server Docker image viadocker exec.
Overview
This guide walks you through the GridGain CLI from first connection to cluster inspection. You will:
Connect to a running cluster from the REPL and in non-interactive mode.
Run SQL interactively and from files.
Check cluster health with management commands.
Format output for scripts and measure query timing.
Create and switch between CLI profiles.
By the end, you have a working command-line workflow for the tasks that come up every day during development: loading schemas, verifying data, and checking that your cluster is healthy.
Learn the Two-port Model
Before you type a single command, internalize this. The CLI talks to your cluster over two different ports, and every "connection failed" error you encounter comes down to using the wrong one.
10300
REST (HTTP)
--url
Cluster management: connect, cluster status, node version, configuration
10800
JDBC
--jdbc-url
SQL execution: queries, file loading, interactive sessions
Port 10300 handles administration. Port 10800 handles data. The CLI uses REST internally for every management command and opens a JDBC connection when you run SQL.
The good news: after you connect to a node's REST port, the CLI discovers the JDBC port automatically by calling the node info REST endpoint. You only need to remember one URL.
Connect to a Cluster
Interactive Mode (REPL)
Start the CLI with no arguments:
The CLI shows a startup banner. If you have connected before, it offers to reconnect to the last node. Connect to the first node in your cluster:
The prompt changes from red [disconnected]> to green [node1]>. That node name comes from the REST API: the CLI called GET /management/v1/node/info, retrieved the node name and JDBC port, and stored both for the session. If the connection drops later, the prompt turns yellow as a warning.
Non-interactive Mode
Pass the command directly to run it and exit:
The process exits after the command completes and returns the exit code to the calling shell, which makes it suitable for scripts and CI/CD pipelines.
Execute SQL Interactively
Now that you are connected, enter the SQL sub-REPL:
The prompt changes to sql-cli>. The sql command is only available after you connect to a node. If you see Unmatched arguments, you are either not connected or you tried to type a SQL statement directly at the [node1]> prompt without entering the SQL sub-REPL first.
This is a nested REPL inside the main one, dedicated to SQL. Type a query and terminate it with a semicolon:
Multiline statements work as you would expect. Lines without a trailing semicolon produce a > continuation prompt, and the CLI waits for the semicolon before executing:
This means you can paste multi-line SQL directly from your editor. The CLI collects the full statement and executes it as a single block.
Exit the SQL REPL to return to the main prompt:
For quick one-off queries, skip the SQL sub-REPL entirely. Pass the query as an argument to sql from the main prompt:
The result prints inline and you stay at the [node1]> prompt.
Execute SQL From Files
Loading SQL from a file is how you set up schemas and seed data. From the main REPL:
Or non-interactively, which is the pattern most tutorials in the GridGain 9 Tutorials use:
Each statement in the file produces its own output line. A file that creates a table, inserts two rows, and queries them produces:
Three output patterns appear in the result:
Updated 0 rows.appears for DDL statements likeCREATE TABLEandDROP TABLE.Updated N rows.appears forINSERT,UPDATE, andDELETE, whereNis the affected row count.A Unicode box-drawing table appears for
SELECTstatements.
Two things to know about file loading:
Errors stop execution. If statement 50 out of 200 fails, statements 51-200 never run. The error message includes a line and column number so you can find the problem in your file.
No progress indicator. The CLI reads the entire file into memory and passes it to the JDBC driver, which executes statements sequentially. A 15,000-line file takes about 10 seconds and the CLI is silent the entire time. This is normal.
Inspect Cluster State
The CLI wraps the REST management API for common cluster operations. Every command below has a curl equivalent, shown so you can use either approach or automate with scripts.
Cluster Status
cmgNodes are the Cluster Management Group nodes that manage membership. msNodes are the Meta Storage nodes that hold cluster metadata. In a typical development cluster, both lists are the same.
Cluster Topology
Port 3344 is the internal cluster communication port. The host column shows Docker-internal IPs; from outside the container you reach these nodes through the mapped ports (10300-10302).
cluster topology logical shows only nodes that have joined after initialization. In a healthy cluster, the physical and logical topologies are identical. A node that appears in physical but not logical has not yet joined or was removed.
Node Status and Version
The node info REST endpoint reveals the JDBC port, which is how the CLI auto-derives the JDBC URL after connect:
Format Output for Scripting
The default Unicode box-drawing tables are readable in a terminal but awkward to parse in scripts. Two flags change the output format.
--plain switches to tab-separated values, which pipes cleanly into awk, cut, or spreadsheet tools:
--timed appends client-side execution time, useful for measuring query performance during development:
Both flags work in interactive and non-interactive modes. The line above is what a one-shot sql command prints. The interactive SQL shell prints its own timing line, for example Query executed in 27 ms, 1 rows returned. Combine them: --plain --timed gives you parseable output with timing.
Configure CLI Profiles
If you work with more than one cluster, profiles let you switch connection settings without retyping URLs. The CLI stores configuration in two files: ~/.config/ignitecli/defaults for connection settings and ~/.config/ignitecli/secrets for SSL and credentials. Command history lives in ~/.local/state/ignitecli/.
Create a profile for a staging cluster:
Switch to it:
Profiles store six categories of settings:
Default cluster URL used by
connectand management commands.JDBC URL used for SQL execution.
Authentication credentials for clusters with security enabled.
SSL configuration for TLS-protected clusters.
Output and display preferences such as truncation, maximum column width, pager, color scheme, and syntax highlighting. The
--plainand--timedflags apply to a single command and cannot be stored in a profile.SQL page size controlling how many rows the CLI fetches per round trip.
Run cli config show to see all settings in the active profile.
Troubleshooting
Related
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

