Reputation: 1953
I have solrCloud setup with 3 different machines. created collection with 3shards
& 2replicas
and indexed few documents into it. if I query using
URL like below
http:machineIP:8983/solr/collection1/select?q=*:*
I get results. if I change machineIP to any one 3 machine IP it will work.
My question is if the machine while requesting solr (say machine 1)is down how to redirect the query requests to other available solr machines(machine 2 or 3).
I am looking for one common point (or URL) to send requests to solrcloud. which will take care if a machine (or node)is failed, pass request to other available machines.
Thanks in advance, vinod
Upvotes: 1
Views: 595
Reputation: 1624
One way of doing this would be to use a proxy server like Nginx.
Nginx allows you to create a pool of server locations to forward traffic to.
The configuration might look something like this:
upstream backend_hosts {
server machineIP1:8983;
server machineIP2:8983;
server machineIP3:8983;
}
server {
listen 80;
server_name example.com;
location /solr/ {
proxy_pass http://backend_hosts;
}
}
With this solution, a request like:
http://example.com/solr/collection1/select?q=:
Would be forwarded to one of the servers in the pool defined in the upstream
block. If an error occurs in communicated with on of the servers, it will be forwarded to the next in the list. By default traffic is distributed in a round-robin style.
If you add another machine to SolrCloud, you can simply add it to the pool.
Digital Ocean has a good, clearly written intro to Nginx as a proxy and the upstream module.
Otherwise, the Nginx docs are the place to go.
Upvotes: 4