分散式資料庫Couchbase 叢集遷移

分散式資料庫Couchbase 叢集遷移

CouchBase是一款開源的、分散式的nosql資料庫,主要用於分散式快取和資料儲存領域。能夠透過manage cache提供快速的亞毫米級別的k-v儲存操作,並且提供快速的查詢和其功能強大的能夠指定SQL-like查詢的查詢引擎

Couchbase是一個較新的、發展迅速的nosql資料庫技術。2014年,viber宣佈使用couchbase替換mongodb,以適應10億級的使用者量,目前,couchbase已大量運用於生產環境,國內使用的公司主要有新浪,騰訊等。

Couchbase是CouchDB和MemBase的合併。而memBase是基於Memcached的。因此Couchbase聯合了couchbase的簡單可靠和memcached的高效能,以及membase的可擴充套件性。靈活的資料模型:couchbase中使用json格式儲存物件和物件之間的關係。

Nosql資料庫的一個特性是不需要定義資料結構,在Couchbase中,資料可以儲存為key-value對或者json文件,不需要預先定義嚴格的格式,由於這種特性,Couchbase支援以 scale out(水平擴充套件)方式擴充套件資料量,提升io效能,只需要在叢集中新增更多的伺服器就行了。相反,關係資料庫管理系統scale up(縱向擴充套件),透過加更多的CPU,記憶體和硬碟以擴充套件容量。

本文主要介紹分散式資料庫Couchbase 叢集遷移方案之CBBACK/CBRESTORE

——-環境描述:CentOS release 6。7 (Final)——-源主機IP:10。10。10。10(此處真實地址已xx)——-目標主機IP:11。11。11。11(此處真實地址已xx)——-應用服務:couchbase-server-enterprise-5。5。2-centos6。x86_64。rpm版本

1、CBBACK

命令列操作方式:cbbackup [options] [source] [backup-dir] -u [admin] -p [password]

[administrator@JavaLangOutOfMemory ~ ]% 。/cbbackup -m full http://10。10。10。10:8091 /home/ubuntu/ -u Administrator -p password //-m full引數表明:執行全叢集節點備份操作,基於-m引數:full、diff及accu。bucket: did_devices, msgs transferred。。。 : total | last | per sec byte : 0 | 0 | 0。0。bucket: xwf_events, msgs transferred。。。 : total | last | per sec byte : 0 | 0 | 0。0。bucket: xwf_main, msgs transferred。。。 : total | last | per sec byte : 0 | 0 | 0。0done[administrator@JavaLangOutOfMemory ~ ]% 。/cbbackup -m full ——single-node -t 3 http://10。10。10。10:8091 /home/ubuntu/ -u Administrator -p passwor//——single-node 引數表明:執行單節點的備份操作//-t 3引數表明:當前執行備份的執行緒個數為3。bucket: did_devices, msgs transferred。。。 : total | last | per sec byte : 0 | 0 | 0。0。bucket: xwf_events, msgs transferred。。。 : total | last | per sec byte : 0 | 0 | 0。0。bucket: xwf_main, msgs transferred。。。 : total | last | per sec byte : 0 | 0 | 0。0done[administrator@JavaLangOutOfMemory ~ ]% 。/cbbackup -m full -v http://10。10。10。10:8091 /home/ubuntu/ -u Administrator -p password //-v引數表明:執行過程中相關log的輸出2016-01-03 11:10:39,380: mt cbbackup。。。2016-01-03 11:10:39,380: mt source : http://10。10。10。10:80912016-01-03 11:10:39,380: mt sink : /home/ubuntu/2016-01-03 11:10:39,380: mt opts : {‘username’: ‘’, ‘verbose’: 1, ‘extra’: {‘max_retry’: 10。0, ‘rehash’: 0。0, ‘dcp_consumer_queue_length’: 1000。0, ‘data_only’: 0。0, ‘uncompress’: 0。0, ‘nmv_retry’: 1。0, ‘conflict_resolve’: 1。0, ‘cbb_max_mb’: 100000。0, ‘report’: 5。0, ‘mcd_compatible’: 1。0, ‘try_xwm’: 1。0, ‘backoff_cap’: 10。0, ‘batch_max_bytes’:400000。0, ‘report_full’: 2000。0, ‘flow_control’: 1。0, ‘batch_max_size’: 1000。0, ‘seqno’: 0。0, ‘design_doc_only’: 0。0,‘allow_recovery_vb_remap’: 0。0, ‘recv_min_bytes’: 4096。0}, ‘collection’: None, ‘ssl’: False, ‘threads’: 4, ‘key’: None,‘password’: ‘’, ‘id’: None, ‘bucket_source’: None, ‘silent’: False, ‘dry_run’: False, ‘single_node’: False, ‘vbucket_list’: None, ‘separator’: ‘::’, ‘mode’: ‘full’}2016-01-03 11:10:39,393: mt Starting new HTTP connection (1): 10。10。10。102016-01-03 11:10:39,500: mt bucket: did_devices2016-01-03 11:10:39,818: w0 source : http://10。10。10。10:8091(did_devices@10。10。10。10:8091)2016-01-03 11:10:39,818: w0 sink : /home/ubuntu/(did_devices@10。10。10。10:8091)2016-01-03 11:10:39,819: w0 : total | last | per sec。bucket: did_devices, msgs transferred。。。 : total | last | per sec batch : 0 | 0 | 0。0 byte : 0 | 0 | 0。0 msg : 0 | 0 | 0。02016-01-03 11:10:39,902: mt Starting new HTTP connection (1): 10。10。10。102016-01-03 11:10:39,907: mt Starting new HTTP connection (1): 10。10。10。102016-01-03 11:10:39,962: mt Starting new HTTP connection (1): 10。10。10。102016-01-03 11:10:39,968: mt Starting new HTTP connection (1): 10。10。10。102016-01-03 11:10:39,973: mt bucket: xwf_events2016-01-03 11:10:40,252: w1 source : http://10。10。10。10:8091(xwf_events@10。10。10。10:8091)2016-01-03 11:10:40,252: w1 sink : /home/ubuntu/(xwf_events@10。10。10。10:8091)2016-01-03 11:10:40,252: w1 : total | last | per sec。bucket: xwf_events, msgs transferred。。。 : total | last | per sec batch : 0 | 0 | 0。0 byte : 0 | 0 | 0。0 msg : 0 | 0 | 0。0。。。。 。。。done

2、CBRESTORE

命令操作方式:cbrestore [options] [backup-dir] [destination]

[administrator@JavaLangOutOfMemory ~ ]% 。/cbrestore -b xwf_events -B xwf_events ——from-date=2014-08-01 ——to-date=2015-08-01 -t 3 /home/ubuntu/ http://11。11。11。11:8091 -u Administrator -p password 。 bucket: xwf_events, msgs transferred。。。 : total | last | per sec byte : 0 | 0 | 0。0 done [administrator@JavaLangOutOfMemory ~ ]%。/cbrestore -b xwf_events -B xwf_events ——from-date=2014-08-01 ——to-date=2015-08-01 -t 3 -v /home/ubuntu/ http://11。11。11。11:8091 -u Administrator -p password // -b 引數表明源buckets名稱,即source_bucket // -B 引數表明目標buckets名稱,即destiant_bucket // ——from-date 引數表明從具體的某一日開始 // ——to-date 引數表明截止到具體的某一日 2016-01-03 11:46:39,408: mt cbrestore。。。 2016-01-03 11:46:39,408: mt source : /home/ubuntu/ 2016-01-03 11:46:39,408: mt sink : http://11。11。11。11:8091 2016-01-03 11:46:39,408: mt opts : {‘username’: ‘’, ‘verbose’: 1, ‘extra’: {‘max_retry’: 10。0, ‘rehash’: 0。0, ‘dcp_consumer_queue_length’: 1000。0, ‘data_only’: 0。0, ‘uncompress’: 0。0, ‘nmv_retry’: 1。0, ‘conflict_resolve’: 1。0, ‘cbb_max_mb’: 100000。0, ‘report’: 5。0, ‘mcd_compatible’: 1。0, ‘try_xwm’: 1。0, ‘backoff_cap’: 10。0, ‘batch_max_bytes’: 400000。0, ‘report_full’: 2000。0, ‘flow_control’: 1。0, ‘batch_max_size’: 1000。0, ‘seqno’: 0。0, ‘design_doc_only’: 0。0, ‘allow_recovery_vb_remap’: 0。0, ‘recv_min_bytes’: 4096。0}, ‘collection’: None, ‘ssl’: False, ‘threads’: 3, ‘to_date’: ‘2015-08-01’, ‘key’: None, ‘password’: ‘’, ‘id’: None, ‘bucket_source’: ‘xwf_events’, ‘silent’: False, ‘dry_run’: False, ‘from_date’: ‘2014-08-01’, ‘bucket_destination’: ‘xwf_events’, ‘add’: False, ‘vbucket_list’: None, ‘separator’: ‘::’} 2016-01-03 11:46:39,423: mt Starting new HTTP connection (1): 11。11。11。11 2016-01-03 11:46:39,522: mt bucket: xwf_events 2016-01-03 11:46:39,543: w0 source : /home/ubuntu/(xwf_events@11。11。11。11:8091) 2016-01-03 11:46:39,544: w0 sink : http://11。11。11。11:8091(xwf_events@11。11。11。11:8091) 2016-01-03 11:46:39,544: w0 : total | last | per sec 2016-01-03 11:46:39,544: w0 batch : 1 | 1 | 54。1 2016-01-03 11:46:39,544: w0 byte : 0 | 0 | 0。0 2019-01-03 11:46:39,544: w0 msg : 0 | 0 | 0。0 。 bucket: xwf_events, msgs transferred。。。 : total | last | per sec batch : 1 | 1 | 14。3 byte : 0 | 0 | 0。0 msg : 0 | 0 | 0。0 2016-01-03 11:46:39,595: mt Starting new HTTP connection (1): 11。11。11。11 2016-01-03 11:46:39,602: mt Starting new HTTP connection (1): 11。11。11。11 done

- EOF -

如果您喜歡本文,歡迎

點贊

收藏

留言

,或者點選右下角,把文章分享給你的朋友們~~~

分散式資料庫Couchbase 叢集遷移

分散式資料庫Couchbase 叢集遷移

Luga Lee

“路,在自己腳下~”

TAG: 1011010339