Command Reference
We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.
You can use the Dgraph command-line interface (CLI) to deploy and manage Dgraph. You use it in self-managed deployment scenarios; such as running Dgraph on on-premises servers hosted on your physical infrastructure, or running Dgraph in the cloud on your AWS, Google Cloud, or Azure infrastructure.
Dgraph has a root command used throughout its CLI: dgraph
. The dgraph
command is supported by multiple subcommands (such as alpha
or update
), some
of which are also supported by their own subcommands. For example, the
dgraph acl
command requires you to specify one of its subcommands: add
,
del
, info
or mod
. As with other CLIs, you provide command options using
flags like --help
or --telemetry
.
The term command is used instead of subcommand throughout this document,
except when clarifying relationships in the CLI command hierarchy. The term
command is also used for combinations of commands and their subcommands, such
as dgraph alpha debug
.
Dgraph CLI superflags in release v21.03
Some flags are deprecated and replaced in release v21.03. In previous Dgraph
releases, multiple related flags are often used in a command, causing some
commands to be very long. Starting in release v21.03, Dgraph uses superflags
for some flags used by the most complex commands: alpha
, backup
, bulk
,
debug
, live
and zero
. Superflags are compound flags: they contain one or
more options that let you define multiple settings in a semicolon-delimited
list. Semicolons are required between superflag options, but a semicolon after
the last superflag option is optional.
The general syntax for superflags is as follows:
--<super-flag-name> option-a=value; option-b=value
"
) if any of those option values include spaces. You can
encapsulate options in double-quotes to improve readability. You can also use
the following syntax for superflags:
--<super-flag-name> "option-a=value; option-b=value"
. Release v21.03 includes the following superflags:
--acl
--badger
--cache
--encryption
--graphql
--limit
--raft
--security
--telemetry
--tls
--trace
--vault
The following table maps Dgraph CLI flags from release v20.11 and earlier that have been replaced by superflags (and their options) in release v21.03. Any flags not shown here are unchanged in release v21.03.
ACL superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--acl | Access Control List superflag | ||||
--acl_secret_file | string | secret-file | string | alpha | File that stores the HMAC secret that is used for signing the JWT |
--acl_access_ttl | time.Duration | access-ttl | string | alpha | TTL for the access JWT |
--acl_refresh_ttl | time.Duration | refresh-ttl | string | alpha | The TTL for the refresh JWT |
Badger superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--badger | Badger superflag | ||||
--badger.compression | string | compression | string | alpha , bulk , backup | Specifies the compression level and algorithm |
numgoroutines | int | alpha , bulk , backup | Number of Go routines used by Dgraph |
The --badger
superflag allows you to set many advanced Badger
options,
including: dir
, valuedir
, syncwrites
, numversionstokeep
, readonly
,
inmemory
, metricsenabled
, memtablesize
, basetablesize
,
baselevelsize
, levelsizemultiplier
, tablesizemultiplier
, maxlevels
,
vlogpercentile
, valuethreshold
, nummemtables
, blocksize
,
bloomfalsepositive
, blockcachesize
, indexcachesize
,
numlevelzerotables
, numlevelzerotablesstall
, valuelogfilesize
,
valuelogmaxentries
, numcompactors
, compactl0onclose
, lmaxcompaction
,
zstdcompressionlevel
, verifyvaluechecksum
,
encryptionkeyrotationduration
, bypasslockguard
,
checksumverificationmode
, detectconflicts
, namespaceoffset
.
Cache superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--cache | Cache superflag | ||||
cache_mb | string | size-mb | string | alpha | Total size of cache (in MB) per shard in the reducer |
cache_percentage | string | percentage | string | alpha | Cache percentages for block cache and index cache |
Encryption superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--encryption | Encryption superflag | ||||
--encryption_key_file | string | key-file | string | alpha , bulk , live , restore , debug , decrypt , export_backup | The file that stores the symmetric key |
GraphQL superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--graphql | GraphQL superflag | ||||
--graphql_introspection | bool | introspection | bool | alpha | Enables GraphQL schema introspection |
--graphql_debug | bool | debug | bool | alpha | Enables debug mode in GraphQL |
--graphql_extensions | bool | extensions | bool | alpha | Enables extensions in GraphQL response body |
--graphql_poll_interval | time.Duration | poll-interval | string | alpha | The polling interval for GraphQL subscriptions |
--graphql_lambda_url | string | lambda-url | string | alpha | The URL of a lambda server that implements custom GraphQL JavaScript resolvers |
Limit superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--limit | Limit-setting superflag for Dgraph Alpha | ||||
--abort_older_than | string | txn-abort-after | string | alpha | Abort any pending transactions older than this duration |
--disable_admin_http | string | disable-admin-http | string | zero | Turn on/off the administrative endpoints |
--max_retries | int | max-retries | int | alpha | Maximum number of retries |
--mutations | string | mutations | string | alpha | Mutation mode: allow , disallow , or strict |
--query_edge_limit | uint64 | query-edge | uint64 | alpha | Maximum number of edges that can be returned in a query |
--normalize_node_limit | int | normalize-node | int | alpha | Maximum number of nodes that can be returned in a query that uses the normalize directive |
--mutations_nquad_limit | int | mutations-nquad | int | alpha | Maximum number of nquads that can be inserted in a mutation request |
--max-pending-queries | int | max-pending-queries | int | alpha | Maximum number of concurrently processing requests allowed before requests are rejected with 429 Too Many Requests |
Raft superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--raft | Raft superflag | ||||
--pending_proposals | int | pending-proposals | int | alpha | Maximum number of pending mutation proposals; useful for rate limiting |
--idx | int | idx | int | alpha , zero | Provides an optional Raft ID that an Alpha node can use to join Raft groups |
--group | int | group | int | alpha | Provides an optional Raft group ID that an Alpha node can use to request group membership from a Zero node |
(new)learner | bool | alpha , zero | Make this Alpha a learner node (used for read-only replicas) | ||
(new)snapshot-after-duration | int | alpha | Frequency at which Raft snapshots are created | ||
--snapshot-after | int | snapshot-after-entries | int | alpha | Create a new Raft snapshot after the specified number of Raft entries |
Security superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--security | Security superflag | ||||
--auth_token | string | token | string | alpha | Authentication token |
--whitelist | string | whitelist | string | alpha | A comma separated list of IP addresses, IP ranges, CIDR blocks, or hostnames for administration |
--telemetry | Telemetry superflag | ||||
--telemetry | bool | reports | bool | alpha and zero | Sends anonymous telemetry data to Dgraph |
--enable_sentry | bool | sentry | bool | alpha and zero | Enable sending crash events to Sentry |
TLS superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--tls | TLS superflag | ||||
--tls_cacert | string | ca-cert | string | alpha , zero , bulk , backup , live | The CA cert file used to verify server certificates |
--tls_use_system_ca | bool | use-system-ca | bool | alpha , zero , bulk , backup , live | Include System CA with Dgraph Root CA |
--tls_server_name | string | server-name | string | alpha , zero , bulk , backup , live | Server name, used for validating the server’s TLS host name |
--tls_client_auth | string | client-auth-type | string | alpha , zero | TLS client authentication used to validate client connections from external ports |
--tls_node_cert | string | server-cert | string | alpha and zero | Path and filename of the node certificate (for example, node.crt ) |
--tls_node_key | string | server-key | string | alpha and zero | Path and filename of the node certificate private key (for example, node.key ) |
--tls_internal_port_enabled | bool | internal-port | bool | alpha , zero , bulk , backup , live | Makes internal ports (by default, 5080 and 7080) use the REQUIREANDVERIFY setting. |
--tls_cert | string | client-cert | string | alpha , zero , bulk , backup , live | User cert file provided by the client to the Alpha node |
--tls_key | string | client-key | string | alpha , zero , bulk , backup , live | User private key file provided by the client to the Alpha node |
Trace superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--trace | Tracing superflag | ||||
--trace | float64 | ratio | float64 | alpha , zero | The ratio of queries to trace |
--jaeger.collector | string | jaeger | string | alpha , zero | URL of Jaeger to send OpenCensus traces |
--datadog.collector | string | datadog | string | alpha , zero | URL of Datadog to send OpenCensus traces |
Vault superflag
Old flag | Old type | New superflag and options | New type | Applies to | Notes |
---|---|---|---|---|---|
--vault | Vault superflag | ||||
--vault_addr | string | addr | string | alpha , bulk , backup , live , debug | Vault server address, formatted as of http://ip-address:port |
--vault_roleid_file | string | role-id-file | string | alpha , bulk , backup , live , debug | File containing Vault role-id used for AppRole authentication |
--vault_secretid_file | string | secret-id-file | string | alpha , bulk , backup , live , debug | File containing Vault secret-id used for AppRole authentication |
--vault_path | string | path | string | alpha , bulk , backup , live , debug | Vault key=value store path (example: secret/data/dgraph for kv-v2, kv/dgraph for kv-v1) |
--vault_field | string | field | string | alpha , bulk , backup , live , debug | Vault key=value store field whose value is the base64 encoded encryption key |
--vault_format | string | format | string | alpha , bulk , backup , live , debug | Vault field format (raw or base64 ) |
To learn more about each superflag and its options, see the --help
output of
the Dgraph CLI commands listed in the following section.
Dgraph CLI command help listing
The Dgraph CLI includes the root dgraph
command and its subcommands. The CLI
help for these commands is replicated inline below for your reference, or you
can find help by calling these commands (or their subcommands) using the
--help
flag.
Although many of the commands listed below have subcommands, only dgraph
and
subcommands of dgraph
are included in this listing.
The Dgraph CLI has several commands, which are organized into the following groups:
The commands in these groups are shown in the following table:
Group | Command | Note |
---|---|---|
(root) | dgraph | Root command for Dgraph CLI |
Dgraph core | alpha | Dgraph Alpha database node commands |
Dgraph core | zero | Dgraph Zero management node commands |
Data loading | bulk | Dgraph Bulk Loader commands |
Data loading | live | Dgraph Live Loader commands |
Data loading | restore | Command used to restore backups created using Dgraph Enterprise Edition |
Dgraph security | acl | Dgraph Access Control List (ACL) commands |
Dgraph security | audit | Decrypt audit files |
Dgraph security | cert | Configure TLS and manage TLS certificates |
Dgraph debug | debug | Used to debug issues with Dgraph |
Dgraph debug | debuginfo | Generates information about the current node for use in debugging issues with Dgraph clusters |
Dgraph tools | completion | Generates shell completion scripts for bash and zsh |
Dgraph tools | conv | Converts geographic files into RDF so that they can be consumed by Dgraph |
Dgraph tools | decrypt | Decrypts an export file created by an encrypted Dgraph Cluster |
Dgraph tools | export_backup | Converts a binary backup created using Dgraph Enterprise Edition into an exported folder. |
Dgraph tools | increment | Increments a counter transactionally to confirm that a Dgraph Alpha node can handle query and mutation requests |
Dgraph tools | lsbackup | Lists information on backups in a given location |
Dgraph tools | migrate | Migrates data from a MySQL database to Dgraph |
Dgraph tools | raftmigrate | Dgraph Raft migration tool |
Dgraph tools | upgrade | Upgrades Dgraph to a newer version |
dgraph
root command
This command is the root for all commands in the Dgraph CLI. Key information
from the help listing for dgraph --help
is shown below:
Dgraph core commands
Dgraph core commands provide core deployment and management functionality for the Dgraph Alpha database nodes and Dgraph Zero management nodes in your deployment.
dgraph alpha
This command is used to configure and run the Dgraph Alpha database nodes in
your deployment. The following replicates the help listing for
dgraph alpha --help
:
dgraph zero
This command is used to configure and run the Dgraph Zero management nodes in
your deployment. The following replicates the help listing shown when you run
dgraph zero --help
:
Data loading commands
dgraph bulk
This command is used to bulk load data with the Dgraph
Bulk Loader tool. The following replicates the help
listing shown when you run dgraph bulk --help
:
dgraph live
This command is used to load live data with the Dgraph
Live Loader tool. The following replicates the help
listing shown when you run dgraph live --help
:
dgraph restore
This command loads objects from available backups. The following replicates the
help listing shown when you run dgraph restore --help
:
Dgraph security commands
Dgraph security commands let you manage access control lists (ACLs), manage certificates, and audit database usage.
dgraph acl
This command runs the Dgraph Enterprise Edition ACL tool. The following
replicates the help listing shown when you run dgraph acl --help
:
dgraph audit
This command decrypts audit files. These files are created using the --audit
when you run the dgraph alpha
command. The following replicates the help
listing shown when you run dgraph audit --help
:
dgraph cert
This command lets you manage
TLS certificates. The following
replicates the help listing shown when you run dgraph cert --help
:
Dgraph debug commands
Dgraph debug commands provide support for debugging issues with Dgraph deployments. To learn more, see Using the Debug Tool.
dgraph debug
This command is used to debug issues with a Dgraph database instance. The
following replicates the help listing shown when you run dgraph debug --help
:
dgraph debuginfo
This command generates information about the current node that is useful for
debugging. The following replicates the help listing shown when you run
dgraph debuginfo --help
:
Dgraph tools commands
Dgraph tools provide a variety of tools to make it easier for you to deploy and manage Dgraph.
dgraph completion
This command generates shell completion scripts for bash
and zsh
CLIs. The
following replicates the help listing shown when you run
dgraph completion --help
:
dgraph conv
This command runs the Dgraph geographic file converter, which converts
geographic files into RDF so that they can be consumed by Dgraph. The following
replicates the help listing shown when you run dgraph conv --help
:
dgraph decrypt
This command lets you decrypt an export file created by an encrypted Dgraph
Cluster. The following replicates the help listing shown when you run
dgraph decrypt --help
:
dgraph export_backup
This command is used to convert a
binary backup created using Dgraph
Enterprise Edition into an exported folder. The following replicates key
information from the help listing shown when you run
dgraph export_backup --help
:
dgraph increment
This command increments a counter transactionally, so that you can confirm that
an Alpha node is able to handle both query and mutation requests. To learn more,
see Using the Increment Tool. The following
replicates the help listing shown when you run dgraph increment --help
:
dgraph lsbackup
This command lists information on backups in a given location for Dgraph
Enterprise Edition. To learn more, see
Backup List Tool. The following replicates the
help listing shown when you run dgraph lsbackup --help
:
dgraph migrate
This command runs the Dgraph migration tool to
move data from a MySQL database to Dgraph. The following replicates the help
listing shown when you run dgraph migrate --help
:
dgraph upgrade
This command helps you to upgrade from an earlier Dgraph release to a newer
release. The following replicates the help listing shown when you run
dgraph upgrade --help
:
Was this page helpful?