Command Description server-list List all servers in a cluster server-info Show details on one server server-add Add one or more servers to the cluster server-readd Readd a server that was failed over rebalance Start a cluster rebalancing rebalance-stop Stop current cluster rebalancing rebalance-status Show status of current cluster rebalancing failover Failover one or more servers cluster-init Set the username,password and port of the cluster cluster-edit Modify cluster settings node-init Set node specific parameters bucket-list List all buckets in a cluster bucket-create Add a new bucket to the cluster bucket-edit Modify an existing bucket bucket-delete Delete an existing bucket bucket-flush Flush all data from disk for a given bucket bucket-compact Compact database and index data setting-compaction Set auto compaction settings setting-notification Set notifications. setting-alert Email alert settings setting-autofailover Set auto failover settings setting-xdcr Set XDCR-related configuration which affect behavior. xdcr-setup Set up XDCR replication. xdcr-replicate Create and run replication via XDCR help show longer usage/help and example
Command Option Description server-add --server-add=HOST[:PORT] Server to add to cluster server-add --server-add-username=USERNAME Admin username for the server to be added server-add --server-add-password=PASSWORD Admin password for the server to be added server-readd --server-add=HOST[:PORT] Server to re-add to cluster server-readd --server-add-username=USERNAME Admin username for the server to be added server-readd --server-add-password=PASSWORD Admin password for the server to be added rebalance --server-add* See server-add OPTIONS rebalance --server-remove=HOST[:PORT] The server to remove from cluster failover --server-failover=HOST[:PORT] Server to failover cluster-* --cluster-username=USER New admin username cluster-* --cluster-password=PASSWORD New admin password cluster-* --cluster-port=PORT New cluster REST/http port cluster-* --cluster-ramsize=RAMSIZEMB Per node RAM quota in MB node-init --node-init-data-path=PATH Per node path to store data node-init --node-init-index-path=PATH Per node path to store index bucket-* --bucket=BUCKETNAME Named bucket to act on bucket-* --bucket-type=TYPE Bucket type, either memcached or couchbase bucket-* --bucket-port=PORT Supports ASCII protocol and does not require authentication bucket-* --bucket-password=PASSWORD Standard port, exclusive with bucket-port bucket-* --bucket-ramsize=RAMSIZEMB Bucket RAM quota in MB bucket-* --bucket-replica=COUNT Replication count bucket-* --enable-flush=[0|1] Enable/disable flush bucket-* --enable-index-replica=[0|1] Enable/disable index replicas bucket-* --wait Wait for bucket create to be complete before returning bucket-* --force Force command execution without asking for confirmation bucket-* --data-only Compact database data only bucket-* --view-only Compact view data only setting-compacttion --compaction-db-percentage=PERCENTAGE Percentage of disk fragmentation when database compaction is triggered setting-compacttion --compaction-db-size=SIZE[MB] Size of disk fragmentation when database compaction is triggered setting-compacttion --compaction-view-percentage=PERCENTAGE Percentage of disk fragmentation when views compaction is triggered setting-compacttion --compaction-view-size=SIZE[MB] Size of disk fragmentation when views compaction is triggered setting-compacttion --compaction-period-from=HH:MM Enable compaction from this time onwards setting-compacttion --compaction-period-to=HH:MM Stop enabling compaction at this time setting-compacttion --enable-compaction-abort=[0|1] Allow compaction to abort when time expires setting-compacttion --enable-compaction-parallel=[0|1] Allow parallel compaction processes for database and view setting-notification --enable-notification=[0|1] Allow notifications setting-alert --enable-email-alert=[0|1] Allow email alert setting-alert --email-recipients=RECIPIENT Email recipents, separate addresses with , or ; setting-alert --email-sender=SENDER Sender email address setting-alert --email-user=USER Email server username setting-alert --email-password=PWD Email server password setting-alert --email-host=HOST Email server hostname setting-alert --email-port=PORT Email server port setting-alert --enable-email-encrypt=[0|1] Email encryption with 0 the default for no encryption setting-alert --alert-auto-failover-node Node was failed over via autofailover setting-alert --alert-auto-failover-max-reached Maximum number of auto failover nodes reached setting-alert --alert-auto-failover-node-down Node not auto failed-over as other nodes are down at the same time setting-alert --alert-auto-failover-cluster-small Node not auto failed-over as cluster was too small setting-alert --alert-ip-changed Node ip address changed unexpectedly setting-alert --alert-disk-space Disk space used for persistent storage has reached at least 90% capacity setting-alert --alert-meta-overhead Metadata overhead is more than 50% of RAM for node setting-alert --alert-meta-oom Bucket memory on a node is entirely used for metadata setting-alert --alert-write-failed Writing data to disk for a specific bucket has failed setting-autofailover --enable-auto-failover=[0|1] Allow auto failover setting-autofailover --auto-failover-timeout=TIMEOUT (>=30) Specify amount of node timeout that triggers auto failover setting-xdcr --max-concurrent-reps=[32] Maximum concurrent replicators per bucket, 8 to 256. setting-xdcr --checkpoint-interval=[1800] Intervals between checkpoints, 60 to 14400 seconds. setting-xdcr --worker-batch-size=[500] Doc batch size, 500 to 10000. setting-xdcr --doc-batch-size=[2048]KB Document batching size, 10 to 100000 KB setting-xdcr --failure-restart-interval=[30] Interval for restarting failed xdcr, 1 to 300 seconds setting-xdcr --optimistic-replication-threshold=[256] Document body size threshold (bytes) to trigger optimistic replication xdcr-setup --create Create a new xdcr configuration xdcr-setup --edit Modify existed xdcr configuration xdcr-setup --delete Delete existing xdcr configuration xdcr-setup --xdcr-cluster-name=CLUSTERNAME Remote cluster name xdcr-setup --xdcr-hostname=HOSTNAME Remote host name to connect to xdcr-setup --xdcr-username=USERNAME Remote cluster admin username xdcr-setup --xdcr-password=PASSWORD Remote cluster admin password xdcr-replicate --create Create and start a new replication xdcr-replicate --delete Stop and cancel a replication xdcr-replicate --xdcr-from-bucket=BUCKET Source bucket name to replicate from xdcr-replicate --xdcr-clucter-name=CLUSTERNAME Remote cluster to replicate to xdcr-replicate --xdcr-to-bucket=BUCKETNAME Remote bucket to replicate to
能夠用來備份單節點,單bucket,甚至整個集羣node
命令格式以下:git
cbbackup [options] [source] [backup_dir]
--single-nodegithub
備份指定的單節點
--bucket-source or -bshell
備份指定的bucket
Local Directory Referencessh
使用couchstore-files的url形式備份在某node的單bucket: couchstore-files:///opt/couchbase/var/lib/couchbase/data/default 這類方法不備份bucket的design document
cluster nodememcached
備份整個節點,使用url形式: http://HOST:8091 使用couchbase 協議前綴: couchbase://Administrator:password@HOST:8091 url的多餘選項能夠用來指定備份整個集羣或某一節點,或單bucket等
備份的路徑ui
shell> cbbackup http://HOST:8091 /backups/backup-20120501 \ -u Administrator -p password [####################] 100.0% (231726/231718 msgs) bucket: default, msgs transferred... : total | last | per sec batch : 5298 | 5298 | 617.1 byte : 10247683 | 10247683 | 1193705.5 msg : 231726 | 231726 | 26992.7 done [####################] 100.0% (11458/11458 msgs) bucket: loggin, msgs transferred... : total | last | per sec batch : 5943 | 5943 | 15731.0 byte : 11474121 | 11474121 | 30371673.5 msg :84 |84 | 643701.2 done
shell> cbbackup http://HOST:8091 /backups/backup-20120501 \ -u Administrator -p password \ -b default [####################] 100.0% (231726/231718 msgs) bucket: default, msgs transferred... : total | last | per sec batch : 5294 | 5294 | 617.0 byte : 10247683 | 10247683 | 1194346.7 msg : 231726 | 231726 | 27007.2 done
shell> cbbackup http://HOST:8091 /backups/backup-20120501 \ -u Administrator -p password \ --single-node
shell> ssh USER@HOST remote-shell> sudo su - couchbase remote-shell> cbbackup http://127.0.0.1:8091 /mnt/backup-20120501 \ -u Administrator -p password \ --single-node \ -b default
#只備份key前綴爲object.的內容數據 shell> cbbackup http://HOST:8091 /backups/backup-20120501 \ -u Administrator -p password \ -b default \ -k '^object.*'
shell> cbbackup \ couchstore-files:///opt/couchbase/var/lib/couchbase/data/default \ /mnt/backup-20120501 #上面的cbbackup至關於: shell> cp -R /opt/couchbase/var/lib/couchbase/data/default \ /mnt/copy-20120501
用於恢復數據到節點或指定bucket等this
命令格式:url
cbrestore [options] [source] [destination]
--bucket-sourcespa
指定要恢復bucket的名字
--bucket-destination
指定要恢復到bucket的名字
指定要備份數據的路徑
指定要數據恢復到的源
shell> cbrestore \ /backups/backup-2012-05-10 \ http://Administrator:password@HOST:8091 \ --bucket-source=XXX [####################] 100.0% (231726/231726 msgs) bucket: default, msgs transferred... : total | last | per sec batch : 232 | 232 | 33.1 byte : 10247683 | 10247683 | 1462020.7 msg : 231726 | 231726 | 33060.0 done
shell> cbrestore \ /backups/backup-2012-05-10 \ http://Administrator:password@HOST:8091 \ --bucket-source=XXX \ --bucket-destination=YYY [####################] 100.0% (231726/231726 msgs) bucket: default, msgs transferred... : total | last | per sec batch : 232 | 232 | 33.1 byte : 10247683 | 10247683 | 1462020.7 msg : 231726 | 231726 | 33060.0 done
#恢復key前綴爲obejct的文檔 shell> cbrestore /backups/backup-20120501 http://HOST:8091 \ -u Administrator -p password \ -b default \ -k '^object.*' 2013-02-18 10:39:09,476: w0 skipping msg with key: sales_7597_3783_6 ... 2013-02-18 10:39:09,476: w0 skipping msg with key: sales_5575_3699_6 2013-02-18 10:39:09,476: w0 skipping msg with key: sales_7597_3840_6 [ ] 0.0% (0/231726 msgs) bucket: default, msgs transferred... : total | last | per sec batch : 1 | 1 | 0.1 byte : 0 | 0 | 0.0 msg : 0 | 0 | 0.0 done