CouchbaseMock
CouchbaseMock copied to clipboard
Create buckets automatically when server is started
Instead of creating the bucket using REST API, is there a way that we can configure CouchbaseMock to create the buckets automatically every time it is started?
Sure, you can use the command line syntax (e.g. -buckets). See the
-?` option for more details:
$ java -jar CouchbaseMock.jar -?
Options are:
-h --host The hostname for the REST port. Default=8091
-b --buckets (See description below
-p --nodes The number of nodes each bucket should contain. Default=10
-v --vbuckets The number of vbuckets each bucket should contain. Default=1024
-R --replicas The number of replica nodes for each bucket. Default=2
--harakiri-monitor The host:port on which the control socket should connect to
-S --with-beer-sample Initialize the cluster with the `beer-sample` bucket active
-D --docs Specify a ZIP file that should contain documents to be loaded
into the `default` bucket
-E --empty Initialize a blank cluster without any buckets. Buckets may then
be later added via the REST API
=== -- bucket option ===
Buckets descriptions is a comma-separated list of {name}:{password}:{bucket type} pairs.
To allow unauthorized connections, omit password.
Third parameter could be either 'memcache' or 'couchbase' (default value is 'couchbase'). E.g.
default:,test:,protected:secret,cache::memcache
The default is equivalent to `couchbase::
Thanks, --buckets works!
But there is no similar option for creating views?
Not at the moment. How would such an interface look like anyway? What would it accept as input? Something akin to cbdocloader?
You can specify a zipfile (in the form of cbdocloader
) and pass that to the -D
option.
What about a zip file, where each folder is the name of a bucket, each subfolder is a design document, and .js files are in each with the name of the view? Or maybe just a single JSON with stringified javascript functions?