bucket-create

bucket-create

Create a new Couchbase data bucket

SYNTAX

couchbase-cli bucket-create [--cluster <url>] [--username <user>] [--password <password>] [--bucket <name>] [--bucket-type <type>] [--bucket-ramsize <size>] [--bucket-replica <num>] [--bucket-port <port>] [--bucket-priority <priority>] [--bucket-eviction-policy <policy>] [--enable-flush <num>] [--enable-index-replica <num>] [--conflict-resolution <type>] [--wait]

DESCRIPTION

Creates a new bucket. This command allows the creation of both Couchbase and Memcached buckets and supports the various configuration parameters for these buckets.

OPTIONS

-c
--cluster

Specfies the hostname of a node in the cluster. See the HOST FORMATS section for more information on specifying a hostname.

-u
--user <username>

Specifies the username of the user executing the command. If you do not have a user account with permision to execute the command then it will fail with an unauthorized error.

-p
--password <password>

Specifies the password of the user executing the command. If you do not have a user account with permision to execute the command then it will fail with an unauthorized error. If this argument is specified, but no password is given then the command will prompt the user for a password through non-echoed stdin. You may also specify your password by using the environment variable CB_REST_PASSWORD.

--bucket <name>

The name of the bucket to create. The bucket name can only contain characters in range A-Z, a-z, 0-9 as well as underscore, period, dash and percent and can be a maximum of 100 characters in length.

--bucket-type <type>

The type of bucket to create. Accepted bucket types are "couchbase", "ephemeral", and "memcached". The Couchbase bucket is the standard bucket type. It supports data persistence, replication, caching, indexing, views, and N1QL queries. The ephemeral bucket is an in-memory bucket similar to the Couchbase bucket, but it does not support data persistence or views. The Memcached bucket is a cache only bucket that does not support persistence, replication, indexing, views or N1QL querying. This bucket type provides the same behavior as Memcached Server.

--bucket-ramsize <size>

The amount of memory to allocate to the cache for this bucket in Megabytes. The memory quota of this bucket must fit into the overall cluster memory quota. The minimum cache size is 100MB.

--bucket-replica <num>

The amount of servers to replicate data to. Replicas provide protection against data loss by keeping copies of the data in this bucket on multiple servers. By default the number of replicas is one even if there is only a single server in the cluster. The minimum amount of replicas is zero and the maximum number is three. This option is only valid for couchbase buckets.

--bucket-port <num>

Sets the port that the bucket listens on. This parameter is deprecated and not recommended for use.

--bucket-priority <priority>

The disk I/O priority for this bucket. The value of this flag may be set to high or low. By default the priority is set to low. This option is only valid for couchbase buckets. This setting only has an affect on the disk IO if there are other buckets in the cluster.

--bucket-eviction-policy <policy>

The memory cache eviction policy for this bucket. Couchbase buckets support either "valueOnly" eviction or "fullEviction". Specifying the "valueEviction" policy means that each key stored in this bucket must be kept in memory. This is the default policy and using this policy will improve performance of key-value operations, but limits the maximum size of the bucket. Using the "fullEviction" policy means that performance will be impacted for key-value operations, but the maximum size of the bucket is unbounded.

If you are using an Ephemeral bucket then you can specify either
"noEviction" or "nruEviction". Specifying "noEviction" means that the bucket
will not evict items from the cache if it is full. This type of eviction
policy should be used for in-memory database use cases. Specifying
"nruEviction" means that not recently used items will be evicted from memory
when all memory in the bucket is used. This eviction type should be used for
caching use cases.
--enable-flush <num>

Specifies whether or not the flush operation is allowed for this bucket. To enable flush set this option to "1". To disable flush set this option to "0". By default flush is disabled.

--enable-index-replica <num>

Enables replica view indexes for this bucket. There may be at most 1 view replica index. To enable replica indexes set the value of this option to "1". To disable replica indexes set the value of this option to "0". By default replica indexes are disabled.

--conflict-resolution <type>

Specifies the conflict resolution mechanism used for this bucket. Conflict resolution is used for resolving conflicts when using cross data center replication (XDCR). Couchbase supports sequence and timestamp based conflict resolution. Sequence based timestamp conflict resolution works by picking the document that has been updated the most times. For example, if one cluster has updated a document two times since the last sync and the other cluster has updated the document three times then the document that was updated three times will win conflict resolution regardless of the specific time the updates took place. Timestamp resolution is based on the time that a document was recieved. The latest document update will always win conflict resolution if timestamp conflict resolution is specified. Keep in mind however that if you use timestamp resolution that it is very important that the clocks on all of the nodes in all of your clusters are synchronized as precisely as possible. If they are not synchronized then you will experince behavior with timestamp conflict resolution.

--wait The create bucket command is asynchronous by default. Specifying this flag makes this a synchronous operation by waiting for the bucket to be fully created before the command returns.

HOST FORMATS

When specifying a host for the couchbase-cli command the following formats are expected:

  • couchbase://<addr>

  • <addr>:<port>

  • http://<addr>:<port>

It is recommended to use the couchbase://<addr> format for standard installations. The other two formats allow an option to take a port number which is needed for non-default installations where the admin port has been set up on a port other that 8091.

EXAMPLES

To create a Couchbase bucket named "travel-data" which has a memory cache size of 1GB run the following command.

$ couchbase-cli bucket-create -c 192.168.1.5:8091 --username Administrator \
 --password password --bucket travel-data --bucket-type couchbase \
 --bucket-ramsize 1024

To create a Couchbase bucket named "airline-data" with a memory cache size of 1GB, two data replicas, high disk I/O priority, uses full eviction, and has flush and replica indexes enabled run the following command.

$ couchbase-cli bucket-create -c 192.168.1.5:8091 --username Administrator \
 --password password --bucket travel-data --bucket-type couchbase \
 --bucket-ramsize 1024 --bucket-replicas 2 --bucket-priority high \
 --bucket-eviction-policy fullEviction --enable-flush 1 \
 --enable-index-replica 1

To create a Memcached bucket named "travel-data" which has a memory cache size of 1GB run the following command.

$ couchbase-cli bucket-create -c 192.168.1.5:8091 --username Administrator \
 --password password --bucket travel-data --bucket-type memcached \
 --bucket-ramsize 1024

ENVIRONMENT AND CONFIGURATION VARIABLES

CB_REST_PASSWORD Specifies the password of the user executing the command. This environment variable allows you to specify a default argument for the -p/--password argument on the command line. It also allows the user to ensure that their password are not cached in their command line history.

CB_REST_PASSWORD Specifies the password of the user executing the command. This environment variable allows you to specify a default argument for the -p/--password argument on the command line.