Can I setup an index as "read-only" in just a few nodes, and expect ES to route correctly?


(José de Zárate) #1

Say I have 5 nodes, and one one index with the standard 1 shard - 5
replicas configuration.

Can I configure the index, on a per node basis, as "read-only" in , say, 4
of those nodes, and expect that when an indexing request is made, ES will
route that to the one node that has write access to the index?

--


(Artem Grinblat) #2

IMHO, there can be no such thing as a read-only replica, the replicas would
need to index the update in order to stay up to date with the primary shard.
See also therehttps://groups.google.com/d/msg/elasticsearch/I6YrFyRRNkQ/KhLpXfpGZKcJ:
"There is no meaning to have balanced primary allocation since primary and
replica shards do the same work."

As the question is interesting to me as well, I did some search. It looks
like:

You can route the requests to the primary shard with the "_primary"
preference:
http://www.elasticsearch.org/guide/reference/api/search/preference.html

You can move shards with
http://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.html

Choosing a primary shard is being worked on:
https://groups.google.com/d/msg/elasticsearch/eDoenE7GHWA/ydyG7l3oL-4J

--


(system) #3