Does GSI have replica?

#1

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?

#2

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

#3

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 http://developer.couchbase.com/documentation/server/4.0/indexes/gsi-for-n1ql.html).

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
#4

thanks for your help