Does GSI have replica?

The view index has replica and it must be specified when create the bucket,is it right? But i find no where to set the GSI replica,Does GSI have replica?

The current way to do this is by defining the same index on two index nodes, with a different name.

By definition the view index is distributed (this is a distributed map-reduce that must run on each data node).
On the other hand, GSI indexes are centralized.

As of now (Couchbase Server 4.0), GSI indexes are not replicated, so you’d have to create them on each index node in order to be fault-tolerant (see the doc here Couchbase SDKs).

Essentially this can be done in N1QL using the WITH { "nodes": "IPorHOSTNAME" } clause at the end of the CREATE INDEX statement, giving the index a slightly different name for each index node in the cluster.
(you can also maybe try to give the index the same name on each index node, not sure if that works from the top of my head)

If several indexes on different nodes have the same definition, GSI will pick the nodes in round-robin fashion.

1 Like

thanks for your help