Discussion:
Solr 'healthcheck' command
Zheng Lin Edwin Yeo
2018-06-06 03:43:56 UTC
Permalink
Hi,

I understand that we can do the health checking of the Solr by using the
solr.cmd command under ./bin/solr, which is run from command prompt.

Would like to check, is this feature available via URL from browser?

I am using Solr 7.3.1.

Regards,
Edwin
Shawn Heisey
2018-06-06 04:09:38 UTC
Permalink
Post by Zheng Lin Edwin Yeo
I understand that we can do the health checking of the Solr by using the
solr.cmd command under ./bin/solr, which is run from command prompt.
Would like to check, is this feature available via URL from browser?
I am using Solr 7.3.1.
The healthcheck action in SolrCLI, which looks like it only works with
SolrCloud, appears to take these actions:

1) Finds the first shard leader for the named collection, does an http
HEAD request to make sure it's responding.
2) Does a *:* query on the named collection to make sure there is a good
response.
3) Then it sends this URL to a host with a leader replica and gathers
some info about the system.

http://host:port/solr/admin/info/system

Doing the *:* query on the collection would give you the important part
of the healthcheck.  If the response has a 200 code, chances are
excellent that it's working.

Thanks,
Shawn
Zheng Lin Edwin Yeo
2018-06-06 04:58:43 UTC
Permalink
Hi Shawn,

Thanks for the reply.

The healthcheck action in SolrCLI is able to return the health status of
individual collection, while this http://host:port/solr/admin/info/system URL
returns the overall health status of Solr.
We will need the information on the health status of individual collection,
like the status of the replica, and which replica are the leader. Any idea
if this is possible to do from URL?

Regards,
Edwin
Post by Shawn Heisey
Post by Zheng Lin Edwin Yeo
I understand that we can do the health checking of the Solr by using the
solr.cmd command under ./bin/solr, which is run from command prompt.
Would like to check, is this feature available via URL from browser?
I am using Solr 7.3.1.
The healthcheck action in SolrCLI, which looks like it only works with
1) Finds the first shard leader for the named collection, does an http
HEAD request to make sure it's responding.
2) Does a *:* query on the named collection to make sure there is a good
response.
3) Then it sends this URL to a host with a leader replica and gathers some
info about the system.
http://host:port/solr/admin/info/system
Doing the *:* query on the collection would give you the important part of
the healthcheck. If the response has a 200 code, chances are excellent
that it's working.
Thanks,
Shawn
Shawn Heisey
2018-06-06 05:03:53 UTC
Permalink
Post by Zheng Lin Edwin Yeo
The healthcheck action in SolrCLI is able to return the health status of
individual collection, while this http://host:port/solr/admin/info/system URL
returns the overall health status of Solr.
We will need the information on the health status of individual collection,
like the status of the replica, and which replica are the leader. Any idea
if this is possible to do from URL?
This might be what you're after:

https://lucene.apache.org/solr/guide/7_3/collections-api.html#clusterstatus

Thanks,
Shawn
Zheng Lin Edwin Yeo
2018-06-06 05:22:09 UTC
Permalink
For this clusterstatus, as we are still pointing it at the Solr directly
http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS

It is not likely to work if the main replica is down.

Let's say I have 2 replica, one in localhost:8983, and other in another
server, like 192.168.1.2:8984. If the localhost:8983 is down, the query
will not work, and it will not know if the other replica is still running
or not, unless we change the URL to
http://192.168.1.2:8984/solr/admin/collections?action=CLUSTERSTATUS

I'm looking to able to do this automatically without changing the IP
address and URL. The solr.cmd command can do it, but we are finding out if
this can be done via URL?

Regards,
Edwin
Post by Shawn Heisey
Post by Zheng Lin Edwin Yeo
The healthcheck action in SolrCLI is able to return the health status of
individual collection, while this http://host:port/solr/admin/info/system URL
returns the overall health status of Solr.
We will need the information on the health status of individual collection,
like the status of the replica, and which replica are the leader. Any idea
if this is possible to do from URL?
https://lucene.apache.org/solr/guide/7_3/collections-api.
html#clusterstatus
Thanks,
Shawn
Shawn Heisey
2018-06-06 05:37:55 UTC
Permalink
Post by Zheng Lin Edwin Yeo
For this clusterstatus, as we are still pointing it at the Solr directly
http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS
It is not likely to work if the main replica is down.
Let's say I have 2 replica, one in localhost:8983, and other in another
server, like 192.168.1.2:8984. If the localhost:8983 is down, the query
will not work, and it will not know if the other replica is still running
or not, unless we change the URL to
http://192.168.1.2:8984/solr/admin/collections?action=CLUSTERSTATUS
I'm looking to able to do this automatically without changing the IP
address and URL. The solr.cmd command can do it, but we are finding out if
this can be done via URL?
The healthcheck is able to do this even when servers go down because it
uses CloudSolrClient.  This client connects to zookeeper, where it can
learn everything about the cloud, including which servers are working.

To achieve what you want at the HTTP level, so you could type the URL in
a browser or use something that's not cloud-aware, you need to access it
through a load balancer sitting in front of Solr.  With a good config, a
load balancer would be able to deal with servers going down.  Either
that or you would need to use software that you can configure with at
least two URLs, that is able to try another URL if one doesn't work.

Thanks,
Shawn
Zheng Lin Edwin Yeo
2018-06-06 05:56:55 UTC
Permalink
Thanks for the info.

Previously you have mentioned that there's no URL for CloudSolrClient, so
this will be the same scenario?

Regards,
Edwin
Post by Shawn Heisey
Post by Zheng Lin Edwin Yeo
For this clusterstatus, as we are still pointing it at the Solr directly
http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS
It is not likely to work if the main replica is down.
Let's say I have 2 replica, one in localhost:8983, and other in another
server, like 192.168.1.2:8984. If the localhost:8983 is down, the query
will not work, and it will not know if the other replica is still running
or not, unless we change the URL to
http://192.168.1.2:8984/solr/admin/collections?action=CLUSTERSTATUS
I'm looking to able to do this automatically without changing the IP
address and URL. The solr.cmd command can do it, but we are finding out if
this can be done via URL?
The healthcheck is able to do this even when servers go down because it
uses CloudSolrClient. This client connects to zookeeper, where it can
learn everything about the cloud, including which servers are working.
To achieve what you want at the HTTP level, so you could type the URL in a
browser or use something that's not cloud-aware, you need to access it
through a load balancer sitting in front of Solr. With a good config, a
load balancer would be able to deal with servers going down. Either that
or you would need to use software that you can configure with at least two
URLs, that is able to try another URL if one doesn't work.
Thanks,
Shawn
Loading...