Skip to content
A fast and portable CouchDB command line utility.
Go Shell
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Makefile package inside of couchdb-util folder Jan 27, 2014

couchdb-utils Build Status

A fast and portable CouchDB command line utility. See help below for more information. Built with Go.

Specifically this was built for maintaing a backup database by providing the following functionality:

  • Easily replicate an entire remote machine (except databases that begin with '_'). This can be run repeatedly, as it will skip over any existing replicators on the target.

    couchdb-utils rep host --continuous

  • Refresh/regenerate all views in the backup database to allow quick failover. This could be run from a cronjob or as an external process. See the couchdb faq for more info.

    couchdb-utils refreshviews

Speed is an important feature. Here's a general idea of what you can expect.

$ time couchdb-utils databases | wc -l

real    0m0.020s
user    0m0.000s
sys 0m0.000s

$ time couchdb-utils views | wc -l

real    0m0.076s
user    0m0.012s
sys 0m0.016s

Run using local database on a linux virtual machine, YMMV.


Binaries for select systems are available

There are no dependencies besides the included binary.


Example Usage

# refresh views in `mydb` database on host, print views refreshed
couchdb-utils refreshviews mydb -v
# refresh all views on host, print http requests
couchdb-utils refreshviews -d

# start continuous replication of all databases that do not begin with '_'
# from `` to `user:secret@`
couchdb-utils rep host -h user:secret@ -v

Base commands

  couchdb-utils [flags]
  couchdb-utils [command]

Available Commands:
  version                            :: Prints the version number of couchdb-utils
  server                             :: Print basic server info
  stats [(<part1> <part2>)]          :: Print server stats (optionally only a certain section eg: couchdb request_time).
  activetasks [<type>]               :: Print active tasks (optionally filtering by type)
  session                            :: Print information about authenticated user
  databases                          :: Print all databases
  views [<db>...]                    :: Print all views (optionally filtering by database(s))
  refreshviews [<db>...] [--verbose] :: Refresh views (optionally filtering by database(s))
  rep <command>...                   :: Replication subcommands
  help [command]                     :: Help about any command

 Available Flags:
  -d, --debug=false: print http requests
  -h, --host="http://localhost:5984": Couchdb server url (http://user:password@host:port)
  -v, --verbose=false: chatty output

Replication commands

  couchdb-utils rep <command>... [flags]
  couchdb-utils rep [command]

Available Commands:
  list                                                 :: Print all replicators
  start <source> <target> [--create --continuous]      :: Configure replication from source to target
  stop (<id>... | --all) [--verbose]                   :: Stop replicating given id(s) or all
  host <remote_host> [--create --continuous --verbose] :: Replicates all databases in remote host that do not begin with '_'

 Available Flags:
  -d, --debug=false: print http requests
  -h, --host="http://localhost:5984": Couchdb server url (http://user:password@host:port)
  -v, --verbose=false: chatty output


A simple makefile is provided. Make sure GO is installed and setup for cross-compiling. See here and here for help.


Please do.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.