Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/janl/couchdb-utils
A fast and portable CouchDB command line utility.
https://github.com/janl/couchdb-utils
Last synced: 3 months ago
JSON representation
A fast and portable CouchDB command line utility.
- Host: GitHub
- URL: https://github.com/janl/couchdb-utils
- Owner: janl
- License: mit
- Fork: true (awilliams/couchdb-utils)
- Created: 2014-06-08T12:30:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-24T11:44:18.000Z (almost 11 years ago)
- Last Synced: 2024-04-07T01:27:36.773Z (9 months ago)
- Language: Go
- Size: 246 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
couchdb-utils [![Build Status](https://travis-ci.org/awilliams/couchdb-utils.png?branch=master)](https://travis-ci.org/awilliams/couchdb-utils)
=============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 maindb.example.com:5984 --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](http://wiki.apache.org/couchdb/Frequently_asked_questions#I_want_to_update_my_view_indexes_more_often_than_only_when_a_user_reads_it._How_do_I_do_that_best.3F) for more info.
`couchdb-utils refreshviews`Speed is an important feature. Here's a general idea of what you can expect.
```bash
$ time couchdb-utils databases | wc -l
26real 0m0.020s
user 0m0.000s
sys 0m0.000s$ time couchdb-utils views | wc -l
575real 0m0.076s
user 0m0.012s
sys 0m0.016s
```
*Run using local database on a linux virtual machine, YMMV.*### Download
[Binaries for select systems are available](https://github.com/awilliams/couchdb-utils/releases)
There are no dependencies besides the included binary.
### Usage
**Example Usage**
```bash
# refresh views in `mydb` database on host couch.example.com:1234, print views refreshed
couchdb-utils refreshviews mydb --host=user:[email protected]:1234 -v
# refresh all views on host couch.example.com:1234, print http requests
couchdb-utils refreshviews --host=user:[email protected]:1234 -d# start continuous replication of all databases that do not begin with '_'
# from `33.33.33.10:5984` to `user:[email protected]:5984`
couchdb-utils rep host 33.33.33.10:5984 -h user:[email protected]:5984 -v
```**Base commands**
```bash
Usage:
couchdb-utils [flags]
couchdb-utils [command]Available Commands:
version :: Prints the version number of couchdb-utils
server :: Print basic server info
stats [( )] :: Print server stats (optionally only a certain section eg: couchdb request_time).
activetasks [] :: Print active tasks (optionally filtering by type)
session :: Print information about authenticated user
databases :: Print all databases
views [...] :: Print all views (optionally filtering by database(s))
refreshviews [...] [--verbose] :: Refresh views (optionally filtering by database(s))
rep ... :: Replication subcommands
help [command] :: Help about any commandAvailable 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**
```bash
Usage:
couchdb-utils rep ... [flags]
couchdb-utils rep [command]Available Commands:
list :: Print all replicators
start [--create --continuous] :: Configure replication from source to target
stop (... | --all) [--verbose] :: Stop replicating given id(s) or all
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
```## Compiling
A simple makefile is provided. Make sure GO is installed and setup for cross-compiling. See [here](http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go) and [here](https://coderwall.com/p/pnfwxg) for help.
## Contributing
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