xref: /3.0.3-GA/couchbase-examples/README.md (revision 693225bb)
1Docloader
2=============
3
4We use this tool to upload a bunch of json documents into Couchbase Server.
5
6Build
7-------
8
9After you clone the project from `git@github.com:couchbase/couchbase-examples.git`, run the following command:
10
11    config/autorun.sh
12
13To build the package, run
14
15    make bdist
16
17Run command
18------------
19
20    cbdocloader OPTIONS DOCUMENTS
21
22DOCUMENTS:
23
24The documents parameter can be either a directory name which contains all the json documents or a .zip file which archives the document directory.
25
26Generally speaking, the document directory should have the following layout:
27
28    /design_docs    which contains all the design docs for views.
29    /docs           which contains all the raw json data files. It can have other sub directories too.
30
31All json files should be well formatted. And no spaces allowed in file names. Design docs will be uploaded after all other data files.
32
33OPTIONS:
34
35  `-n HOST[:PORT]`, --node=HOST[:PORT] Default port is 8091
36
37  `-u USERNAME`, --user=USERNAME       REST username of the cluster. It can be specified in environment variable REST_USERNAME.
38
39  `-p PASSWORD`, --password=PASSWORD   REST password of the cluster. It can be specified in environment variable REST_PASSWORD.
40
41  `-b BUCKETNAME`, --bucket=BUCKETNAME Specific bucket name. Default is default bucket. Bucket will be created if it doesn't exist.
42
43  `-s QUOTA`,                          RAM quota for the bucket. Unit is MB. Default is 100MB.
44
45  `-h` --help                          Show this help message and exit
46
47Example
48-------
49
50    # Upload documents archived in zip file ../samples/gamesim.zip. All data will be inserted in bucket mybucket
51    #
52    ./cbdocloader  -n localhost:8091 -u Administrator -p password -b mybucket ../samples/gamesim.zip
53
54Errors
55------
56
57These are kinds of error cases to consider ...
58
59* JSON files are not well formatted
60* Wrong REST username and password
61* Bucket cannot be created due to too large ram quota specified.
62