How to create index on two nodes on Community Edition

n1ql

#1

I have set up a cluster to test with (Community Edition 5.1.1). When I first created the cluster all indeces were created on both servers. Now I have done some further tuning and improvements - but the new indeces seems to only be created on one of the nodes. I created them using the Query option on the admin console.

If I specify CREATE INDEX ... WITH {"num_replica":1} I get an error message stating that I can only specify this on Enterprise Editions. So question is: How do I get the indeces on both nodes? Am I just too impatient - or do I need to do something manually?


#2

Replicated indexes are EE only feature cc. @deepkaran.salooja

For CE you need to manage by yourself by creating equivalent indexes. i.e create same index with different name without {“num_replica”:1}

CREATE INDEX ix1_replica1 ON default(c1,c2);
CREATE INDEX ix1_replica2 ON default(c1,c2);

Also you can place index which ever node you want by specifying in WITH clause or let indexer place it.


#3

Ok, but then why did the server itself place all indexes on both nodes when I added the second cluster node?

But fair enough. I was just “tricked” into believing that it was a general feature and did not see anything about it only being EE.

Thanks!


#4

… perhaps you should specify in the documentation that this is only an enterprise feature. It doesn’t say in neither “nodes” nor “num_replicas” - see: https://docs.couchbase.com/server/5.1/n1ql/n1ql-language-reference/createindex.html


#5

Thanks @jda for the feedback. We’ll update the documentation on this topic DOC-4320.

The index placement policy for 5.1 CE is round robin across all the index service nodes in the cluster.