Couchbase IV(管理与维护)

Couchbase IV(管理与维护)

管理

常用命令

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

备份与恢复

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:[email protected]:8091
    
    url的多余选项可以用来指定备份整个集群或某一节点,或单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.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
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.2
done
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 - couchbase
remote-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:[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.0
done
恢复bucket到指定的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.0
done
过滤筛选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_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
时间: 2024-10-05 00:36:53

Couchbase IV(管理与维护)的相关文章

Oracle RAC OCR 的管理与维护

OCR相当于Windows的注册表.对于Windows而言,所有的软件信息,用户,配置,安全等等统统都放到注册表里边.而集群呢,同样如此,所有和集群相关的资源,配置,节点,RAC数据库统统都放在这个仓库里.如果OCR被破坏则导致集群服务启动异常,需要修复OCR.因此OCR的管理与维护对于整个集群而言,是相当重要的.本文主要描述了Oracle 10g RAC下的OCR的管理与维护. [python] view plain copy print? 1.环境 [email protected]:~> 

活动目录管理及维护----------操作主机1(转移主机优化域控制器,占用操作主机较色,升级03域控制器到08)

享受生活  热爱挑战                                                                                        刘明远分享                 六操作主机  上(本章分两节) 每章一段话 没有永远的缘份,没有永远的生命,我们所能拥有的,可能只是平凡的一生.然而因为有你,生命便全然不同,世界也许因你而更加精彩.不要放弃了自己!!! (本章实验:转移主机的优化域控制器.  占用操作主机角色) 一  操作主

管理和维护RHCS集群

导读 管理和维护RHCS集群是一个非常复杂和繁琐的工作,要维护好一个RHCS集群,必须熟悉RHCS的基本运行原理,在集群管理方面,RHCS提供了两种方式:即Luci图形界面方式和命令行方式,这儿重点讲述在命令行下如何管理RHCS集群. 启动RHCS集群 RHCS集群的核心进程有cman和rgmanager.要启动集群,依次启动cman,然后再启动rgmanager,操作如下: 在主机web1上启动集群服务: [[email protected] ~]# service cman start St

目录:SQL Server 2014 管理与维护指南

<SQL Server 2014 安装与配置指南> 章节目录 <SQL Server 2014管理与维护> 第1章  实现数据完整性和一致性 1.1  数据完整性 1.2  数据一致性 1.3  阻塞和死锁 第2章  包含数据库 2.1  包含的概念 2.2  实现包含数据库 2.3  包含数据库的排序规则 2.4  迁移到包含数据库 第3章  管理数据库 3.1  修改数据库选项 3.2  数据库的文件类型 3.3  数据库的触发器 第4章  数据库的组织结构 4.1  文件组

活动目录管理及维护----------操作主机2(升级03域控制器到08)

享受生活 热爱挑战       刘明远分享 六 操作主机  下 每章一段话 我想我们应该用自己的力量去完成以往没完成的事情,要给自己勇气去做,不要留下遗憾 提升2003AD 到 2008AD  实现思路 1 扩展Windows server 2003 AD 的林架构和域架构.更新组策略对象权限,更新AD对RODC(只读域控制器)的支持 2  将独立服务器DC02 加入现有域,并提升为额外域控制器. 3  将fsmo角色转移到dc02. 4 将DC01降级为普通成员服务器 5 提升AD域功能级别和

Couchbase V(管理任务)

Couchbase V(管理任务) 多读写 在Couchbase2.1中支持硬盘多读些(Multi- Readers and Writers),一般双核4G服务默认3个thread 4核16G内存一个设置为 8个线程 Server Warmup 在Couchbase重启后,需要经历热身阶段才能进入运行状态: 初始化,这阶段服务没有任何数据,将从vBucket中加载初始化各个vBucket的状态和数据. Key Dump. 这阶段,主要加载key和metadata. 检查访问日志, 预读单个访问缓

命令行管理和维护RHCS集群

1.启动RHCS集群 RHCS集群的核心进程有cman和rgmanager,要启动集群,一次在集群的每个节点上执行如下命令: service cman start service rgmanager start 执行着两个命令是有先后顺序的,要先启动cman,然后再启动rgmanager. [[email protected] ~]# service cman start Starting cluster: Checking if cluster has been disabled at boo

火灾自动报警系统的管理和维护

机房对安防是非常重视的,经常对火灾自动报警系统进行管理和维护,火灾自动报警系统是一门先进的消防技术设施,档案资料的管理.触发装置在使用中常出现的问题及排除.报警装置的检查.电源检查.保证联动控制系统的正常运行等,能在防火灭火中充分发挥作用,保证机房设备安全运行. 1.报警装置的检查 在进行检查时可对某一火灾探测器用专用加烟工具进行实际操作检查.当火灾探测器在接收到烟雾后,报警确认灯亮,表明该探测器工作正常,与此同时向报警控制器发出火灾信号.还要检查时钟是否走动,有无发生火警的时间记录.检查后,值

第四单元 目录文件的浏览、管理及维护(一)

第四单元 目录文件的浏览.管理及维护(一) Linux文件系统的层次结构 Linux文件系统的树状结构 目录是什么 顶层根目录的表示 文件系统中的两个特殊目录 Linux系统中的一些重要的目录 bin目录 sbin目录 家目录 dev目录 etc目录 挂载目录/media或/mnt 其他常用目录 绝对和相对路径 绝对路径 相对路径 课后作业 [本节内容]1. Linux文件系统的层次结构(详见linux系统管理P40)1) 了解Linux文件系统的树状结构:在Linux或UNIX操作系统中,所有