Server operation

Most of the cmdlets in this module are based on the Send-CouchDBRequest cmdlet.

Send-CouchDBRequest # alias creq
Get-Help Send-CouchDBRequest -Full

Below are all the cmdlets needed to get all the information on the CouchDB server.

To get the version and other info on the server, run:


To get list of running tasks, including the task type, name, status and process ID:

Get-CouchDBActiveTask -Authorization "admin:password"

To get list of all the databases in the CouchDB instance:

Get-CouchDBDatabase -Authorization "admin:password"

To get information of a list of the specified databases in the CouchDB instance:

Get-CouchDBDatabaseInfo -Keys test,test1,test2 -Authorization "admin:password"

To get the status of the node or cluster, run this:

Get-CouchDBClusterSetup -Authorization "admin:password"

To get a list of all database events in the CouchDB instance:

Get-CouchDBDatabaseUpdates -Authorization "admin:password"

For other parameter see the table below:


normal: Returns all historical DB changes, then closes the connection. Default.

longpoll: Closes the connection after the first event.

continuous: Send a line of JSON per event. Keeps the socket open until timeout.

eventsource: Like, continuous, but sends the events in EventSource format.

Timeout Number of seconds until CouchDB closes the connection. Default is 60.
Heartbeat Period in milliseconds after which an empty line is sent in the results. Only applicable for longpoll, continuous, and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. Default is 60000.
Since Return only updates since the specified sequence ID. May be the string “now” to begin showing only new updates.

To displays the nodes that are part of the cluster:

Get-CouchDBNode -Authorization "admin:password"

To get the statistics for the running server:

Measure-CouchDBStatistics -Authorization "admin:password"
Measure-CouchDBStatistics -System -Authorization "admin:password"

To restart server:


This task required privileged access on operating system


And check health:

Get-CouchDBServer -Status

To get one or more Universally Unique Identifiers (UUIDs) from the CouchDB instance:


To set proxy server for all calls:

Set-CouchDBProxy -Server 'http://myproxy.local:8080' -Credential (Get-Credential)

And remove it


Tests the results of Lucene analyzer tokenization on sample text:

Search-CouchDBAnalyze -Field "english" -Text "running" -Authorization "admin:password"

Returns a count of completed, failed, running, stopped, and total jobs along with the state of resharding on the cluster:

Get-CouchDBReshards -Jobs -Authorization "admin:password"

This starts global resharding on all the nodes of the cluster:

Set-CouchDBReshards -State running -StateReason "Test start" -Authorization "admin:password"

Single resharding job for a particular range:

Set-CouchDBReshards -Database test -Err "Test message" -Type split -Range "80000000-ffffffff" -Authorization "admin:password"

Stop and remove specific job id:

Remove-CouchDBReshards -JobId "001-638b90b9acf73cbb113afdfdba458bec80da6a6be23599019fb7b051cedfcc93" -Authorization "admin:password"

Read the log

To read entire log.

Read-CouchDBLog -Authorization "admin:password"


The default path is specified in the server configuration. Run `` Get-CouchDBConfiguration -Session log -Key file -Authorization admin:password``. Otherwise, specify the path using the -Path parameter.

This example is used to read only the last 15 lines of log.

Read-CouchDBLog -Tail 15 -Authorization "admin:password"

Instead this to stay in append on the log for the level of warning.

Read-CouchDBLog -Level warning -Follow -Authorization "admin:password"


Each entry in the log has its own color, so as to identify the line of interest “at a glance”.

debug : Detailed debug logging.

info : Informative logging. Includes HTTP requests headlines, startup of an external processes etc.


warning : Warning messages are alerts about edge situations that may lead to errors.

error : Error level includes only things that go wrong, like crash reports and HTTP error responses (5xx codes).




Clear the log

Clear entire and rotate (save a copy in the same folder) log.

Clear-CouchDBLog -Rotate -Authorization "admin:password"


The replication is an incremental one way process involving two databases (a source and a destination).

Get replica

To get a replication document.

Get-CouchDBReplication -Authorization "admin:password"

To get a list of replication jobs.

Get-CouchDBReplicationScheduler -Authorization "admin:password"

And to get a list of replication document states.

Get-CouchDBReplicationDocument -Authorization "admin:password"

Create replica

Creation of the replicator database and replication agent is automatically in the same time.

using module PSCouchDB
$rep = New-Object PSCouchDBReplication -ArgumentList 'test','test_dump'
New-CouchDBReplication -Data $rep -Authorization "admin:password"

Now that we have a replicated document, let’s take a look at the change.

Get-CouchDBDatabaseChanges -Database test_dump -Authorization "admin:password"

Modify replica

To change the replication agent settings (continuous: true | false).

using module PSCouchDB
$rep = New-Object PSCouchDBReplication -ArgumentList 'test','test_dump'
Set-CouchDBReplication -Data $rep -Authorization "admin:password"

Remove replica

To remove the replication agent.

Remove-CouchDBReplication -Document test_test_dump -Authorization "admin:password"

Replication request

Request, configure, or stop, a replication operation.

using module PSCouchDB
$rep = New-Object PSCouchDBReplication -ArgumentList 'test','test_dump'
Request-CouchDBReplication -Data $rep -Authorization "admin:password"

Enable/Disable Maintenance

Enable maintenance mode.

Set-CouchDBMaintenanceMode -Authorization "admin:password"

Disable maintenance mode.

Set-CouchDBMaintenanceMode -Maintenance $false -Authorization "admin:password"