首页 > 代码库 > Couchbase IV(管理与维护)
Couchbase IV(管理与维护)
Couchbase IV(管理与维护)
管理
常用命令
Command Descriptionserver-list List all servers in a clusterserver-info Show details 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 rebalancingrebalance-status Show status of current cluster rebalancingfailover Failover one or more serverscluster-init Set the username,password and port of the clustercluster-edit Modify cluster settingsnode-init 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 existing bucketbucket-flush Flush all data from disk for a given bucketbucket-compact Compact database and index datasetting-compaction Set auto compaction settingssetting-notification Set notifications.setting-alert Email alert settingssetting-autofailover Set auto failover settingssetting-xdcr Set XDCR-related configuration which affect behavior.xdcr-setup Set up XDCR replication.xdcr-replicate Create and run replication via XDCRhelp show longer usage/help and example
命令选项
Command Option Descriptionserver-add --server-add=HOST[:PORT] Server to add to clusterserver-add --server-add-username=USERNAME Admin username for the server to be addedserver-add --server-add-password=PASSWORD Admin password for the server to be addedserver-readd --server-add=HOST[:PORT] Server to re-add to clusterserver-readd --server-add-username=USERNAME Admin username for the server to be addedserver-readd --server-add-password=PASSWORD Admin password for the server to be addedrebalance --server-add* See server-add OPTIONSrebalance --server-remove=HOST[:PORT] The server to remove from clusterfailover --server-failover=HOST[:PORT] Server to failovercluster-* --cluster-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 Standard port, exclusive with bucket-portbucket-* --bucket-ramsize=RAMSIZEMB Bucket 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 bucket create to be complete before returningbucket-* --force Force command execution without asking for confirmationbucket-* --data-only Compact database data onlybucket-* --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 database compaction is triggeredsetting-compacttion --compaction-view-percentage=PERCENTAGE Percentage of disk fragmentation when views compaction is triggeredsetting-compacttion --compaction-view-size=SIZE[MB] Size of disk fragmentation when views compaction is triggeredsetting-compacttion --compaction-period-from=HH:MM Enable compaction from this time onwardssetting-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 notificationssetting-alert --enable-email-alert=[0|1] Allow email alertsetting-alert --email-recipients=RECIPIENT Email recipents, separate addresses with , or ;setting-alert --email-sender=SENDER Sender email addresssetting-alert --email-user=USER Email server usernamesetting-alert --email-password=PWD Email server passwordsetting-alert --email-host=HOST Email server hostnamesetting-alert --email-port=PORT Email server portsetting-alert --enable-email-encrypt=[0|1] Email encryption with 0 the default for no encryptionsetting-alert --alert-auto-failover-node Node was failed over via autofailoversetting-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 are down at the same timesetting-alert --alert-auto-failover-cluster-small Node not auto failed-over as cluster was too smallsetting-alert --alert-ip-changed Node ip address changed unexpectedlysetting-alert --alert-disk-space Disk space used for persistent storage has reached at least 90% capacitysetting-alert --alert-meta-overhead Metadata overhead is more than 50% of RAM for nodesetting-alert --alert-meta-oom Bucket memory on a node is entirely used for metadatasetting-alert --alert-write-failed Writing data to disk for a specific bucket has failedsetting-autofailover --enable-auto-failover=[0|1] Allow auto failoversetting-autofailover --auto-failover-timeout=TIMEOUT (>=30) Specify amount of node timeout that triggers auto failoversetting-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 KBsetting-xdcr --failure-restart-interval=[30] Interval for restarting failed xdcr, 1 to 300 secondssetting-xdcr --optimistic-replication-threshold=[256] Document body size threshold (bytes) to trigger optimistic replicationxdcr-setup --create Create a new xdcr configurationxdcr-setup --edit Modify existed xdcr configurationxdcr-setup --delete Delete existing xdcr configurationxdcr-setup --xdcr-cluster-name=CLUSTERNAME Remote cluster namexdcr-setup --xdcr-hostname=HOSTNAME Remote host name to connect toxdcr-setup --xdcr-username=USERNAME 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 cluster to replicate toxdcr-replicate --xdcr-to-bucket=BUCKETNAME Remote bucket to replicate to
备份与恢复
cbbackup
可以用来备份单节点,单bucket,甚至整个集群
命令格式如下:
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:password@HOST:8091url的多余选项可以用来指定备份整个集群或某一节点,或单bucket等
[backup_dir]
备份的路径
cbbackup最佳实践
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 USER@HOSTremote-shell> sudo su - couchbaseremote-shell> cbbackup http://127.0.0.1:8091 /mnt/backup-20120501 -u Administrator -p password --single-node -b default
过滤bucket的key
#只备份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
cbrestore
用于恢复数据到节点或指定bucket等
命令格式:
cbrestore [options] [source] [destination]
[options]
--bucket-source
指定要恢复bucket的名字
--bucket-destination
指定要恢复到bucket的名字
[source]
指定要备份数据的路径
[destination]
指定要数据恢复到的源
cbresotre最佳实践
恢复一个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.0done
恢复bucket到指定的bucket
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.0done
过滤筛选bucekt的内容
#恢复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(管理与维护)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。