Node administration CLI

This CLI tool is a command line interface for administering EventStoreDB nodes. It allows you to run tasks similar to those available in the web admin interface and SDKs, including administrating users, projections and configuration.

Download

EventStoreDB CLI 1.7.0 for WindowsEventStoreDB CLI 1.7.0 for macOSEventStoreDB CLI 1.7.0 for Linux

Usage

es-cli [options] <command> <sub-command> [args]
1

Where <command> is equal to the section, and <sub-command> the operation. For example, to shutdown a node:

es-cli admin shutdown
1

Connecting and authentication

Using the CLI tool requires specifying an EventStoreDB node by passing the URL with the --serveurl option, and your admin credentials with the --username and --password options:

es-cli --serverurl="http://localhost:2113" --username=admin --password=changeit
1

Configuration

You can also create a file with configuration values at the correct file path for your operating system.

%AppData%/eventstore.rc
1

The configuration file may contain any of the following values:

serverurl="http://127.0.0.1:2113"
username="admin"
password="changeit"
output="json" # Or XML
verbose=true # Or false
1
2
3
4
5

Commands

Usage:

es-cli [<options>] <command> [<args>]
1

Options

OptionDescription
--versionGet the version of EventStoreDB CLI
--helpDisplay help
--outputHow output should be formatted (text or json)
--passwordThe admin password
--serverurlThe url of the EventStoreDB server
--usernameThe admin username
--verboseVerbose output of requests sent to the EventStoreDB node

Commands summary

CommandSub commands
adminscavenge, shutdown, merge_indexes, calculate_stream_size, backup, restore, s3_backup, s3_restore, azure_backup, azure_restore, verify_db, clear_scavenge_streams, delete_streams
useradd, change_password, delete, disable, update, enable, list, reset_password
projectionsdelete, disable, enable, list, new, result, state, status, restore_checkpoint, has_stalled
competinglist, create, update
config_generatorcreate_config

Command details

admin

es-cli admin [--version] [--help] <command> [<args>]
1
CommandDescription
azure_backupBacks up the EventStoreDB database to the specified container in Azure Blob Storage
azure_restoreRestores an EventStoreDB database from a specified container in Azure Blob Storage
backupBacks up the EventStoreDB database to the destination directory
calculate_stream_sizeCalculates the size on disk of the give stream
clear_scavenge_streamsDeletes all the scavenge history streams
delete_streamsDeletes streams matching the specified regular expression
merge_indexesManually merge indexes of EventStoreDB
restoreRestores the EventStoreDB database from the provided location to the destination directory
s3_backupBacks up the EventStoreDB to an S3 bucket
s3_restoreRestores EventStoreDB from an S3 bucket
scavengeSchedule a scavenge on EventStoreDB
shutdownShutdown the EventStoreDB instance
verify_dbVerify the integrity of an EventStore database

admin azure_backup

es-cli admin azure_backup [options]
1

Backs up the EventStoreDB database to the specified container in Azure Blob Storage.

OptionDescription
-databasesourceThe location of the EventStoreDB database
-indexsourceThe location of the EventStoreDB index (default: databasesource/index)
-differentialBackup only new or changed files
-deleteextraDelete extraneous files from the destination (with -differential only)
-storageaccountnameThe name of the storage account
-storageaccountkeyThe account key of the storage account (found in security > access keys on azure)
-databasecontainerThe destination container of the database backup
-indexcontainerThe destination container of the index backup (default: databasecontainer-index)
-maxretrycountThe number of times to retry an upload before cancelling the backup (default: 3)
-yAutomatically confirm prompt to delete files from the destination directory

admin azure_restore

es-cli admin azure_restore [options]
1

Restores an EventStoreDB database from a specified container in Azure Blob Storage.

OptionDescription
-databasesourceThe location of the EventStoreDB database
-indexsourceThe location of the EventStoreDB index (default: databasesource/index)
-storageaccountnameThe name of the storage account
-storageaccountkeyThe account key of the storage account (found in security > access keys on azure)
-databasecontainerThe container of the database backup
-indexcontainerThe container of the index backup (default: databasecontainer-index)
-maxretrycountThe number of times to retry a download before cancelling the restore (default: 3)
-yAutomatically confirm prompt to delete the files in the destination folders if they exist

admin backup

es-cli admin backup [options]
1

Backs up the EventStoreDB database to the destination directory.

OptionDescription
-databasesourceThe location of the EventStoreDB database
-databasedestinationThe backup destination
-indexsourceThe location of the Index files (default: databasesource/index)
-indexdestinationThe index backup destination (default: databasedestination/index)
-differentialBackup only new or changed files
-deleteextraDelete extraneous files from the destination (with -differential only)
-yAutomatically confirm prompt to delete files from the destination directory

admin calculate_stream_size

es-cli admin calculate_stream_size [options]
1

Calculates the size on disk of the given stream.

OptionDescription
-streamnameStream Name

admin clear_scavenge_streams

no options

admin delete_streams

es-cli admin delete_streams [options]
1

Deletes streams matching the specified regular expression.

OptionDescription
-patternRegular expression that the streams must match
-listOnly list the streams matching the pattern, do not delete them
-fromallForce read stream names from $all
-fromstreamsForce read stream names from $streams
-noverifyDoes not verify if the stream exists (faster)
USE THE FOLLOWING OPTIONS WITH CAUTION!
-hardHard delete the streams (Default: soft delete)
-systemInclude system streams (starting with $) for deletion
-yAutomatically confirm prompt to delete a stream

admin merge_indexes

No options.

admin restore

es-cli admin restore [options]
1

Restores the EventStoreDB database from the provided location to the destination directory.

OptionDescription
-databasesourceThe location of the backup to restore
-databasedestinationThe destination of the restore
-indexsourceThe location of the index backup (default: databasesource/index)
-indexdestinationThe destination of the index restore (default: databasedestination/index)
-yAutomatic yes to prompts to delete files from destination directory

admin s3_backup

es-cli admin s3_backup [options]
1

Backs up an EventStoreDB database to the destination S3 bucket.

OptionDescription
-databasesourceThe location of the EventStoreDB database
-databasedestinationThe backup destination in the s3 bucket
-s3bucketThe name of the S3 bucket
-indexsourceThe location of the Index files (default: databasesource/index)
-indexdestinationThe index backup destination (default: databasedestination/index)
-differentialBackup only new or changed files
-deleteextraDelete extraneous files from the destination (with -differential only)
-awsregionThe AWS region of the bucket
-awsaccesskeyidThe AWS access key to use (if not provided, use environment variables)
-awssecretkeyThe AWS secret key to use (if not provided, use environment variables)
-awstokenThe AWS token to use
-yAutomatically confirm prompt to delete files from the destination directory

admin s3_restore

es-cli admin s3_restore [options]
1

Restores an EventStoreDB database from an S3 bucket.

OptionDescription
-databasesourceThe location in the S3 bucket of the backup to restore
-databasedestinationThe destination of the restore
-s3bucketThe name of the S3 bucket
-indexsourceThe location in the S3 bucket of the index backup (default: databasesource/index)
-indexdestinationThe destination of the index restore (default: databasedestination/index)
-awsregionThe AWS region of the bucket
-awsaccesskeyidThe AWS access key to use (if not provided, use environment variables)
-awssecretkeyThe AWS secret key to use (if not provided, use environment variables)
-awstokenThe AWS token to use
-yAutomatically confirm prompt to delete all files from the destination folder

admin scavenge

No options.

admin shutdown

No options.

admin verify_db

es-cli admin verify_db [options]
1

Verify the integrity of an EventStoreDB database.

OptionDescription
-databasepathThe path to the EventStoreDB database directory on disk
-indexpathThe path to the EventStoreDB index directory on disk (default: databasepath/index)
-skipdbverifySkip database verification (default: false)
-skipindexverifySkip index verification (default: false)

An output file called 'verify_db.error.log' will be written to the current working directory.

user

es-cli user [--version] [--help] <command> [<args>]
1
CommandDescription
addAdd a user
change_passwordChange the user password
deleteDelete a user
disableDisable a user
enableEnable a user
listList all users
reset_passwordReset a user's password
updateUpdate a user

user add

es-cli useradd [options]
1

Add a user.

OptionDescription
-loginnameLogin Name
-passwordPassword
-fullnameFull Name
-isadminIs Administrator
-isoperationsIs Operations

user change_password

es-cli user change_password [options]
1

Change the password for the given user.

OptionDescription
-loginnameThe login name of the user to update
-newpasswordThe new password for the given user
-currentpasswordThe current password for the given user

user delete

es-cli user delete [options]
1

Delete a user.

OptionDescription
-loginnameThe login name of the user to delete

user disable

es-cli user disable [options]
1

Disable a user.

OptionDescription
-loginnameThe login name of the user to disable

user update

es-cli user update [options]
1

Update a user.

OptionDescription
-loginnameLogin Name
-fullnameFull Name
-isadminIs Administrator
-isoperationsIs Operations

user enable

es-cli user enable [options]
1

Enable a user.

OptionDescription
-loginnameThe login name of the user to enable

user list

es-cli user list [options]
1

List all users.

user reset_password

es-cli user reset_password [options]
1

Reset a user's password.

OptionDescription
-loginnameThe login name of the user
-newpasswordThe new password for the given user

projections

es-cli projections [--version] [--help] <command> [<args>]
1
CommandDescription
deleteDelete a projection
disableDisable a projection
enableEnable a projection
has_stalledDetermines whether a projection has possibly stalled
listList all of the projections
newCreate a new projection
restore_checkpointRestore a previous checkpoint for a projection
resultGet the result of a projection
stateGet the state of a projection
statusGet the status of a projection

projections delete

es-cli projections delete [options]
1

Delete a projection.

OptionDescription
-nameThe projection name
-deletestatestreamDelete the State Stream
-deletecheckpointstreamDelete the Checkpoint Stream

projections disable

es-cli projections disable [options]
1

Disable a projection.

OptionDescription
-nameThe projection name

projections enable

es-cli projections enable [options]
1

Enable a projection.

OptionDescription
-nameThe projection name

projections list

es-cli projections list [options]
1

List all the projections.

projections new

es-cli projections new [options]
1

Create a new projection.

OptionDescription
-nameThe projection name
-typeType of projection ([o]netime, [c]ontinuous, [t]ransient)
-queryThe projection query (Prefix with @ to load from file. e.g. @projectionquery.json)

projections result

es-cli projections result [options]
1

Get the result of a projection.

OptionDescription
-nameThe projection name
-partitionThe partition of the result you are querying for

projections state

es-cli projections state [options]
1

Get the state of a projection.

OptionDescription
-nameThe projection name
-partitionThe partition of the state you are querying for

projections status

es-cli projections status [options]
1

Get the status of a projection.

OptionDescription
-nameThe projection name

projections restore_checkpoint

es-cli projections restore_checkpoint [options]
1

Restore a previous checkpoint for a projection.

OptionDescription
-nameThe projection name

projections has_stalled

es-cli projections has_stalled [options]
1

Determines whether a projection has stalled.

OptionDescription
-nameThe projection name

competing

es-cli competing [--version] [--help] <command> [<args>]
1
CommandDescription
createCreate a new subscription
deleteDelete an existing subscription
listList the subscriptions
updateUpdate an existing subscription

competing list

es-cli competing list [options]
1

List the subscriptions.

OptionDescription
-streamidThe name of the stream to list subscriptions for
-subscription_nameThe name of the subscription to list

competing create

es-cli competing create [options]
1

Create a new subscription.

OptionDescription
-streamidThe stream to subscribe to
-subscription_nameThe name of the subscription group
-configThe settings to create the subscription with (Prefix with @ to load from file. e.g. @subscriptionConfig.json)

competing update

es-cli competing update [options]
1

Update an existing subscription.

OptionDescription
-streamidThe stream to update the subscription on
-subscription_nameThe name of the subscription group to update
-configThe settings to update the subscription with (Prefix with @ to load from file. e.g. @subscriptionConfig.json)

config_generator

es-cli config_generator [--version] [--help] <command> [<args>]
1
CommandDescription
create_configGenerates config files with recommended settings based on the provided options.

config_generator create_config

es-cli config_generator createconfig [options]
1

Generates config files with recommended settings based on the provided options.

Output options:

OptionDescription
-outputThe destination for the generated config files (if nothing, just prints to STDOUT)

General options:

OptionDescription
-dbThe location of the EventStoreDB database
-indexThe location of the EventStoreDB index
-logThe location of the EventStoreDB logs
-run_projectionsThe level of projections to run (none, system, all)

Cluster options:

OptionDescription
-node_countThe number of database nodes in the cluster (default: 1)
-gossip_discoveryHow nodes in the cluster will discover each other (gossipseed, dns)
-dns_nameThe DNS name to use for gossip discovery

Network options:

OptionDescription
-network_typeThe type of network the nodes will be running in (lan, cloud)
-internal_ipsThe internal IP addresses of the nodes, separated by a comma (node order should be the same as other ip arguments
-external_ipsThe external IP addresses of the nodes, separated by a comma (node order should be the same as other ip arguments

Further help

For further information you can use the --help option at the es-cli top level, the section level, or for individual operations.

Troubleshooting

The CLI tools uses the HTTP API and you can output the requests and responses from the calls by setting the --verbose configuration value to true.

If you encounter any issues, please open a ticket on freshdesk.

Changelog

1.7.0

  • Added verify_db command under admin section to verify integrity of chunks, indexes and checkpoint files.

1.6.0

  • Added merge_indexes command under admin section to trigger manual index merges when setting MaxAutoMergeIndexLevel
  • Added db_stats command under admin section which processes chunk files locally and outputs stream statistics in CSV format

1.5.0

  • Added -deleteextra option to differential backup (for local, s3 and azure) to allow deleting of extraneous files from the destination (useful do delete previous versions of scavenged chunks from the destination)
  • Bugfix: Copy last chunk file to a temporary location before backing it up
  • Miscellaneous bug fixes

1.4.0

  • Added support for differential backup (for local, s3 and azure)
  • Improved backup UI

1.3.0

  • Added a command to calculate the size on disk of a stream
  • Added a command to delete streams matching a specific pattern
  • Fixed the name of one of the S3 backup command options
  • Added backup/restore commands for Microsoft Azure
  • Added a config generator command that generates sample configuration based on provided criteria

1.2.0

  • Added backup/restore commands for Amazon S3 as well as local disk
  • Added Restore Checkpoint for Projections
  • Added the ability for the CLI to check if a projection has potentially stalled

1.1.0

  • There was an issue with versions prior to 3.7.0 of EventStoreDB where bad events could be appended to $scavenge-{id} and the $scavenges streams.
  • With the release of version 1.1.0 of the CLI we have included a clear_scavenge_streams command under the admin section which will read through the $all stream and delete the $scavenges-{id} and $scavenges streams.
Last Updated:
Contributors: Alexey Zimarev, Chris Chinchilla, Chris Chinchilla, Oskar Dudycz