cbmigrate

  • reference
March 16, 2025
+ 12
Use the cbmigrate command-line tool to migrate your data from other platforms.

Description

The cbmigrate tool will migrate your existing data from the following platforms:

Installation

  1. Download the latest version of the cbmigrate package from its GitHub repository.

  2. Unpack the downloaded package to its own directory.

  3. Execute the tool by running the following from the command line:

    console
    $ ./cbmigrate [command] [flags]

Syntax

console
$ cbmigrate [--version] [--help HELP]
console
$ cbmigrate [command] [flags]

Command options

cbmigrate takes one of three optional commands. Depending on the command used, the cbmigrate tool will also accept a range of flags for additional information required for its execution.

Table 1. Command options
Command Flags

mongo

Migrate the data from a MongoDB installation to Couchbase server.

--mongodb-uri string

The mongodb connection string.

--mongodb-database string

The name of the database that you wish to migrate.

--mongodb-collection

The name of the collection within the database you are migrating.

--cb-username string

The username granting access to the target cluster.

--cb-password string

The password (attached to --cb-username) for accessing the target cluster.

--cb-cluster string

The URL of the target cluster node for the import.

--cb-bucket string

The name of the target bucket.

--cb-scope string

The target scope for the migration.

--cb-collection string

The target collection name for the import.

--cb-generate-key string

Specifies a key expression used for generating a unique key for each imported document. It allows for the creation of document keys by combining static text, field values (denoted by %fieldname%), and custom generators (like #UUID#). For example, using a combination of static text, field names, and custom generators, you can generate a unique key of the form: "key::%name%::#UUID#"
(Default: "%_id%")

--cb-cacert string

Specifies a CA certificate that will be used to verify the identity of the server being connected to. Either this flag or the --cb-no-ssl-verify flag must be specified when using an SSL encrypted connection.

--cb-no-ssl-verify

Skips the SSL verification phase. Specifying this flag will allow a connection using SSL encryption but will not verify the identity of the server you connect to.

You are vulnerable to a man-in-the-middle attack if you use this flag.

Either this flag or the --cb-cacert flag must be specified when using an SSL encrypted connection

--cb-client-cert string

The path to a client certificate used to authenticate when connecting to a cluster. May be supplied with --cb-client-key as an alternative to the --cb-username and --cb-password flags.

--cb-client-cert-password

The password for the certificate provided to the --cb-client-cert flag, when using this flag, the certificate/key pair is expected to be in the PKCS#12 format

--cb-client-key string

The path to the client private key whose public key is contained in the certificate provided to the --cb-client-cert flag. May be supplied with --cb-client-cert as an alternative to the --username and --password flags.

--cb-client-key-password string

The password for the key provided to the --cb-client-key flag, when using this flag, the key is expected to be in the PKCS#8 format

--cb-buffer-size int

An integer value denoting the size of the memory buffer used during the import. (Default: 10000)

--cb-batch-size int

The number of documents processed as a batch during the import. (Default: 200)

--copy-indexes

Copy indexes for the collection (default: true)

--hash-document-key string

Hash the couchbase document key. Can be sha256 or sha512)

--keep-primary-key

Keep the non-composite primary key in the document. By default, if the key is a non-composite primary key, it is deleted.

--help

Help for the MongoDB migration parameters and flags

--debug

Enable debug output.