Restore indexes only with cbbackupmgr

Hello,

Is there a way to restore indexes only with the cbbackupmgr restore command?

I could not find the info on cbbackupmgr restore | Couchbase Docs

Cheers
Henry

@hse What is the context of what you wish to accomplish here? If any indexes or partitions have been lost, e.g. due to failover, they will be rebuilt by doing a Rebalance. The Rebalance button should be enabled in the UI in a situation like this.

Hello @Kevin.Cherkauer, it’s more out of curiosity, I hope I’ll never run into this issue, but here is how you can reproduce the index loss with a failover:

  • create a couchbase community cluster with 2 nodes
  • load the sample bucket travel-sample
  • see in the index page that indexes are spread over the 2 nodes
  • gracefully failover 1 node and rebalance
  • indexes from removed node are gone





@hse Thank you for the context. In this situation those indexes are indeed gone and need to be recreated via “create index” statements because:

  1. They did not have any replicas.
  2. Graceful Failover feature does yet not exist for GSI. It is only graceful for Data Service, but like a kill -9 for Index Service. (Graceful Failover | Couchbase Docs)
  3. Index Service metadata is distributed, so each node only knows about indexes it hosts.

Thus if the last node containing metadata for a given index is lost, the existence of that index is also lost. There is a Graceful Failover feature for Index Service under contemplation for the future, though I can’t guarantee when it might be implemented. I know it is one of the more popular requests from customers.

If you had removed the node by rebalancing it out of the cluster, then its indexes would have migrated to the remaining node as part of that operation. Or if the indexes had replicas, there would be one replica on each node originally, so one would survive the loss of a single node. When a healthy node is later rebalanced back in the replicas would be recreated and balanced across the two nodes, since their metadata was not lost.

I am not a backup and restore expert so don’t have info about whether restoring just indexes from a backup is possible.

You can restore indexes only – you can specify what you want to restore by disabling what you do not want to restore. So, to restore indexes only, you would do something like –

cbbackupmgr restore -a /backups/cb_backup_20220407 -r repo1 -c localhost -u Administrator -p password  --disable-cluster-analytics --disable-analytics --disable-views --disable-ft-indexes --disable-ft-alias --disable-data --disable-eventing --disable-bucket-query --disable-cluster-query
4 Likes