Backing up design documents

Backing up design documents

Design documents are backed up with the design_doc_only=1 option.

Description

Backup only design documents from a cluster or bucket with the option, design_doc_only=1 . Restore only design documents with cbrestore design_doc_only=1 .

Syntax

Basic syntax:

cbbackup http://[host]:8091 [backup-location] -x design_doc_only=1 -b [bucket-name]

Example

The following example creates a backup copy of all design documents from foo-bucket and store this as design.json in the directory ~/backup/foo-bucket . If a bucket is not specified, design documents for all buckets in the cluster are backed up.

cbbackup http://10.5.2.117:8091 ~/backup -x design_doc_only=1

Response

The following example response shows only design documents for all buckets being backed up. In this case, the source node had two (2) buckets including the default bucket.


transfer design doc only. bucket msgs will be skipped.
transfer design doc only. bucket msgs will be skipped.
done
        

In the following output, two design documents were backed up.

[
   {
      "controllers":{
         "compact":"/pools/default/buckets/default/ddocs/_design%2Fddoc1/controller/compactView",
         "setUpdateMinChanges":"/pools/default/buckets/default/ddocs/_design%2Fddoc1/controller/setUpdateMinChanges"
      },
      "doc":{
         "json":{
            "views":{
               "view1":{
                  "map":"function(doc){emit(doc.key,doc.key_num);}"
               },
               "view2":{
                  "map":"function(doc,meta){emit(meta.id,doc.key);}"
               }
            }
         },
         "meta":{
            "rev":"1-6f9bfe0a",
            "id":"_design/ddoc1"
         }
      }
   },
   {
      "controllers":{
         "compact":"/pools/default/buckets/default/ddocs/_design%2Fddoc2/controller/compactView",
         "setUpdateMinChanges":"/pools/default/buckets/default/ddocs/_design%2Fddoc2/controller/setUpdateMinChanges"
      },
      "doc":{
         "json":{
            "views":{
               "dothis":{
                  "map":"function (doc, meta) {\n  emit(meta.id, null);\n}"
               }
            }
         },
         "meta":{
            "rev":"1-4b533871",
            "id":"_design/ddoc2"
         }
      }
   },
   {
      "controllers":{
         "compact":"/pools/default/buckets/default/ddocs/_design%2Fdev_ddoc2/controller/compactView",
         "setUpdateMinChanges":"/pools/default/buckets/default/ddocs/_design%2Fdev_ddoc2/controller/setUpdateMinChanges"
      },
      "doc":{
         "json":{
            "views":{
               "dothat":{
                  "map":"function (doc, meta) {\n  emit(meta.id, null);\n}"
               }
            }
         },
         "meta":{
            "rev":"1-a8b6f59b",
            "id":"_design/dev_ddoc2"
         }
      }
   }
]