cbdocloader tool

The cbdocloader tool is used to load a group of JSON documents in a given directory or in a single .zip 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
Note: 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/
Windows C:\Program Files\Couchbase\Server\bin\
Mac OS X /Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/

CLI command and parameters

The following are command options for cbdocloader :

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 REST_USERNAME.
-p [password], --password=[password] REST password of the cluster. It can be specified in environment variable REST_PASSWORD.
-b [bucket-name], --bucket=[bucket-name] Specific bucket name. Default is default bucket. Bucket will be created if it does not exist.
-n [localhost]:[port] --node=[localhost]:[port] Node address. Default port is 8091.
-s [quota] RAM quota for the bucket in MB. Default is 100MB.
Note: The cbdocloader tool is typically used during the initial Couchbase Server install.

Syntax

Basic syntax:


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

Example

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