Couchbase IV (Management and maintenance) management common commands
Command descriptionserver-list list all servers in a clusterserver-info Show Detai LS on one serverserver-add add one or more servers to the Clusterserver-readd readd a server that Was failed overrebalance Start a cluster rebalancingrebalance-stop stop current cluster rebalancing Rebalance-status Show Status of cluster Rebalancingfailover Failover one or more serversclus Ter-init Set the Username,password and port of the Clustercluster-edit Modify cluster settingsnode-i NIT Set node specific parametersbucket-list list all buckets in a clusterbucket-create ADD a new bucket to the Clusterbucket-edit Modify an existing bucketbucket-delete delete an Existin G Bucketbucket-flush flush all data from disk to a given Bucketbucket-compact compact database and in Dex Datasetting-compactiOn set auto compaction settingssetting-notification Set notifications.setting-alert Email Alert Settings Setting-autofailover Set auto failover SETTINGSSETTING-XDCR set xdcr-related configuration which affect Beha Vior.xdcr-setup Set up XDCR replication.xdcr-replicate Create and run replication via XDCRHELP Show Longer Usage/help and example
Command options
Command Option descriptionserver-add--server-add=host[:P ORT] server to add to Clusterserver-add--server-ad D-username=username Admin username for the server to be Addedserver-add--server-add-password=password Admin passwo Rd for the server to is Addedserver-readd--server-add=host[:P ort] server to re-add to Clusterserver-readd--serv Er-add-username=username Admin username for the server to be Addedserver-readd--server-add-password=password Admin p Assword for the server to is Addedrebalance--server-add* see Server-add optionsrebalance--server-remove=host[:P or T] The server to remove from Clusterfailover--server-failover=host[:P ort] server to failovercluster-*--cluste R-username=user new admin usernamecluster-*--cluster-password=password new admin passwordcluster-*--cluster- Port=port New cluster rest/http portcluster-*--cluster-ramsize=ramsizemb Per node RAM quota in Mbnode-init-- Node-init-data-path=path Per node path to store Datanode-init--node-init-index-path=path Per node path to store indexbucket-*--bucket= Bucketname Named Bucket to act onbucket-*--bucket-type=type bucket type, either memcached or couchbasebucket-* --bucket-port=port Supports ASCII protocol and does not require authenticationbucket-*--bucket-password=password Sta Ndard port, exclusive with bucket-portbucket-*--bucket-ramsize=ramsizemb buckets RAM quota in mbbucket-*--bucket- Replica=count Replication countbucket-*--enable-flush=[0|1] enable/disable flushbucket-*--enable-index-replica =[0|1] enable/disable index replicasbucket-*--wait wait for the bucket create to is complete before returningbucket-* --force force command execution without asking for confirmationbucket-*--data-only Compact database data onl ybucket-*--view-only Compact View data onlysetting-compacttion--compaction-db-percentage=percentage percentage of disk fragmentation WHEn database compaction is triggeredsetting-compacttion--COMPACTION-DB-SIZE=SIZE[MB] size of disk fragmentation when dat Abase compaction is triggeredsetting-compacttion--compaction-view-percentage=percentage percentage of disk Fragmentat Ion when views compaction is triggeredsetting-compacttion--COMPACTION-VIEW-SIZE=SIZE[MB] size of disk fragmentation W Hen views compaction are triggeredsetting-compacttion--compaction-period-from=hh:mm Enable compaction from this time Onwa Rdssetting-compacttion--compaction-period-to=hh:mm Stop Enabling compaction at this timesetting-compacttion--enable- COMPACTION-ABORT=[0|1] Allow compaction to abort when time expiressetting-compacttion--enable-compaction-parallel=[0| 1] Allow parallel compaction processes for database and viewsetting-notification--enable-notification=[0|1] Allow Noti Ficationssetting-alert--enable-email-alert=[0|1] Allow email alertsetting-alert--email-recipients=recipient Emai L Recipents, separate adDresses with, or; Setting-alert--email-sender=sender sender Email addresssetting-alert--email-user=user email s erver usernamesetting-alert--email-password=pwd Email server passwordsetting-alert--email-host=host Email serve R hostnamesetting-alert--email-port=port email server portsetting-alert--enable-email-encrypt=[0|1] email encry Ption with 0 The default for no Encryptionsetting-alert--alert-auto-failover-node node is failed over via Autofailove Rsetting-alert--alert-auto-failover-max-reached Maximum number of auto failover nodes Reachedsetting-alert--alert- Auto-failover-node-down node not auto Failed-over as other nodes is down at the same Timesetting-alert--alert-auto-fai Lover-cluster-small node not auto Failed-over as cluster is too smallsetting-alert--alert-ip-changed Node IP Address Changed Unexpectedlysetting-alert--alert-disk-space disk space used for persistent storage have reached at least 90% CA Pacitysetting-alert--Alert-meta-overhead Metadata overhead is more than 50% of RAM for Nodesetting-alert--alert-meta-oom Bucket memory On a node was entirely used for Metadatasetting-alert--alert-write-failed Writing data to disk for a specific bucket Have failedsetting-autofailover--enable-auto-failover=[0|1] allow auto Failoversetting-autofailover--auto-failov Er-timeout=timeout (>=30) Specify amount of node timeout that triggers auto FAILOVERSETTING-XDCR--max-concurrent-r EPS=[32] Maximum concurrent replicators per bucket, 8 to 256.SETTING-XDCR--checkpoint-interval=[1800] intervals be Tween checkpoints, 14400 SECONDS.SETTING-XDCR--worker-batch-size=[500] Doc batch size, 10000.setting-xd CR--doc-batch-size=[2048]kb Document batching Size, ten to 100000 KBSETTING-XDCR--failure-restart-interval=[30] I Nterval for restarting failed XDCR, 1 to SECONDSSETTING-XDCR--optimistic-replication-threshold=[256] Document b Ody size Threshold (bytes) to trigger optimistic Replicationxdcr-setup--create Create a new XDCR configurationxdcr-setup--edit Modify Exis Ted Xdcr configurationxdcr-setup--delete Delete existing XDCR configurationxdcr-setup--xdcr-cluster-name=clusternam E Remote cluster namexdcr-setup--xdcr-hostname=hostname remote host name to connect Toxdcr-setup--xdcr-username=use Rname Remote Cluster admin usernamexdcr-setup--xdcr-password=password remote Cluster admin passwordxdcr-replicate --create Create and start a new replicationxdcr-replicate--delete Stop and cancel a replicationxdcr-replicate-- Xdcr-from-bucket=bucket Source bucket name to replicate fromxdcr-replicate--xdcr-clucter-name=clustername Remote clust Er to replicate toxdcr-replicate--xdcr-to-bucket=bucketname Remote buckets to replicate to
Backup and Recovery Cbbackup
Can be used to back up single-node, single-bucket, or even entire cluster
The command format is as follows:
cbbackup [options] [source] [backup_dir]
[Options]
--single-node
备份指定的单节点
--bucket-source Or-b
备份指定的bucket
[Source]
Local Directory Reference
使用couchstore-files的url形式备份在某node的单bucket:couchstore-files:///opt/couchbase/var/lib/couchbase/data/default这类方法不备份bucket的design document
Cluster node
备份整个节点,使用url形式:http://HOST:8091使用couchbase 协议前缀:couchbase://Administrator:[email protected]:8091url的多余选项可以用来指定备份整个集群或某一节点,或单bucket等
[Backup_dir]
The path of the backup
Cbbackup Best Practices backup all nodes and all buckets
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.7done [####################] 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.2done
Backup all nodes, single bucket
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.2done
Backup single node, all buckets
shell> cbbackup http://HOST:8091 /backups/backup-20120501 -u Administrator -p password --single-node
Backup single node, single bucket; Backup files stored on same node
shell> ssh [email protected]remote-shell> sudo su - couchbaseremote-shell> cbbackup http://127.0.0.1:8091 /mnt/backup-20120501 -u Administrator -p password --single-node -b default
Filter the Bucket key
#只备份key前缀为object.的内容数据shell> cbbackup http://HOST:8091 /backups/backup-20120501 -u Administrator -p password -b default -k ‘^object.*‘
Using a copy backup
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
Cbrestore
For recovering data to a node or a specified bucket, etc.
Command format:
cbrestore [options] [source] [destination]
[Options]
--bucket-source
指定要恢复bucket的名字
--bucket-destination
指定要恢复到bucket的名字
[Source]
指定要备份数据的路径
[Destination]
指定要数据恢复到的源
Cbresotre Best practices restore a bucket to a cluster
shell> cbrestore /backups/backup-2012-05-10 http://Administrator:[email protected]: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.0done
Restore bucket to the specified bucket
shell> cbrestore /backups/backup-2012-05-10 http://Administrator:[email protected]: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.0done
Filtering the contents of a Bucekt filter
#恢复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_62013-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.0done
Couchbase IV (Management and maintenance)