cbdocloader

The cbdocloader tool is used to load a group of JSON documents in a given directory or in a single .zip file into a Couchbase bucket.

Syntax

The basic syntax is:

cbdocloader  -n [host]:8091 -u [Administrator] -p [password]
		-b [bucket-name] [source-file]

Description

When loading documents and any associated design documents for views, use a directory structure similar to the following:

/design_docs    // which contains all the design docs for views.
/docs           // which contains all the raw json data files. This can contain other sub directories too.

All JSON files to upload must contain well-formatted JSON. File names should exclude spaces.

Types of errors:

  • Files are not well-formatted

  • Credentials are incorrect

  • RAM quota for a new bucket to contain the JSON is too large given the current quota for Couchbase Server

When uploading both JSON documents and design documents, be aware that the design documents are uploaded after all JSON documents.

This tool is found in the following locations, depending on the platform:

Operating system Location

Linux

/opt/couchbase/bin/cbdocloader

Windows

C:\Program Files\Couchbase\Server\bin\cbdocloader

Mac OS X

/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/cbdocloader

Options

The following are the command options:

Table 1. cbdocloader options
Option Description

-h --help

Show this help message and exit.

-u [username], --user=[username]

REST username of the cluster. It can be specified in environment variable CB_REST_USERNAME.

-p [password], --password=[password]

REST password of the cluster. It can be specified in environment variable CB_REST_PASSWORD.

-b [bucket-name], --bucket=[bucket-name]

Specific bucket name. The default is default bucket. Bucket will be created if it does not exist.

-n [host]:[port] --node=[host]:[port]

Node address. The default port is 8091.

-s [quota]

RAM quota for the bucket in MB. The default is 100MB.

The cbdocloader tool is typically used during the initial Couchbase Server install.

Examples

The following is an example of uploading JSON from a .zip file:

cbdocloader -n 10.5.2.117:8091 -u Administrator -p password -b mybucket ../samples/gamesim.zip