Details
Description
Install Couchbase Server 4.5.1-2861 on 2 centos 7.2 servers.
Create a cluster of 2 nodes.
Create default bucket.
Load 100K items into bucket with key start with "1-"
Delete 50K items with key start with "1-"
Load another 50K items with key start with "2-"
Check if delete keys still in vbucket 0
[root@s44017 ~]# /opt/couchbase/bin/couch_dbdump /opt/couchbase/var/lib/couchbase/data/default/0.couch.1 | grep deleted |
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
doc deleted
|
[root@s44017 ~]# |
Backup default bucket. Only half keys (50K) backup.
[root@s44017 ~]# /opt/couchbase/bin/cbbackupmgr list --repo test --archive /tmp/backup/ |
Size Items Name
|
40.54MB - + test |
40.54MB - + 2017-03-24T08_27_32.869324048-07_00 |
40.54MB - + default |
295B 0 bucket-config.json |
40.54MB 50000 + data |
40.54MB 50000 shard_0.fdb |
2B 0 full-text.json |
190B 0 gsi.json |
2B 0 views.json |
[root@s44017 ~]# |
Purge deletes from all vbuckets.
/opt/couchbase/bin/cbcompact 172.23.121.226:11210 compact $i --dropdeletes --purge-only-upto-seq=100000 |
/opt/couchbase/bin/cbcompact 172.23.121.227:11210 compact $i --dropdeletes --purge-only-upto-seq=100000 |
Check if delete keys not in bucket any more. No deleted items in vbucket 0
[root@s44017 ~]# /opt/couchbase/bin/couch_dbdump /opt/couchbase/var/lib/couchbase/data/default/0.couch.3 | grep deleted |
[root@s44017 ~]# |
Load another 25K items with key start "3-"
Check total items in default bucket.
[root@s44017 ~]# /opt/couchbase/bin/cbstats 172.23.121.226:11211 all | grep curr_items |
curr_items: 125000 |
curr_items_tot: 250000 |
vb_active_curr_items: 125000 |
vb_pending_curr_items: 0 |
vb_replica_curr_items: 125000 |
Do backup again
[root@s44017 ~]# /opt/couchbase/bin/cbbackupmgr backup --repo test --archive /tmp/backup/ --host 172.23.121.226:8091 --username Administrator --password password |
|
Backing up to 2017-03-24T08_51_42.963424869-07_00 |
Copied all data in 3s (Avg. 417.09KB/Sec) 12500 items / 1.22MB |
default [================================================================================================================================================================================================] 100.00% |
|
Backup successfully completed
|
[root@s44017 ~]# |
Check backup data
[root@s44017 ~]# /opt/couchbase/bin/cbbackupmgr list --repo test --archive /tmp/backup/ |
Size Items Name
|
59.67MB - + test |
40.54MB - + 2017-03-24T08_27_32.869324048-07_00 |
40.54MB - + default |
295B 0 bucket-config.json |
40.54MB 50000 + data |
40.54MB 50000 shard_0.fdb |
2B 0 full-text.json |
190B 0 gsi.json |
2B 0 views.json |
19.13MB - + 2017-03-24T08_51_42.963424869-07_00 |
19.13MB - + default |
295B 0 bucket-config.json |
19.13MB 12500 + data |
19.13MB 12500 shard_0.fdb |
2B 0 full-text.json |
190B 0 gsi.json |
2B 0 views.json |
[root@s44017 ~]# |
Delete default bucket and re-create default bucket
Restore data back to default bucket. Only half data restore back to default bucket.
[root@s44017 ~]# /opt/couchbase/bin/cbbackupmgr restore --repo test --archive /tmp/backup/ --host 172.23.121.226:8091 --username Administrator --password password |
|
(1/2) Restoring backup 2017-03-24T08_27_32.869324048-07_00 |
Copied all data in 5.01s (Avg. 1.27MB/Sec) 75000 items / 6.36MB |
default [================================================================================================================================================================================================] 100.00% |
|
|
(2/2) Restoring backup 2017-03-24T08_51_42.963424869-07_00 |
Copied all data in 3s (Avg. 409.16KB/Sec) 12500 items / 1.20MB |
default [================================================================================================================================================================================================] 100.00% |
|
Restore completed successfully
|
[root@s44017 ~]# |
Check current items in bucket
[root@s44017 ~]# /opt/couchbase/bin/cbstats 172.23.121.226:11211 all | grep curr_items |
curr_items: 62500 |
curr_items_tot: 125000 |
vb_active_curr_items: 62500 |
vb_pending_curr_items: 0 |
vb_replica_curr_items: 62500 |
[root@s44017 ~]# |