Connection failed error when accessing the Search app (Solr) from Hue

If you are using Solr with Hue to generate interactive dashboards and for indexing data, and if you have deployed two Solr services on your cluster and selected the second one as a dependency for Hue, then Cloudera Manager assigns the hostname of the first Solr service and the port number of the second Solr service resulting in an incorrect Solr URL in the search section of the hue.ini file. As a result, you may see a “Connection failed” error when you try to access the Search app from the Hue web UI.

For example, consider two Solr services with the following configuration:

Solr-1, hostname=solr1, port:2345

Solr-2, hostname=solr2, port=4567

If you select Solr-2 as a dependent service for Hue, then Cloudera Manager updates the search section of the hue.ini file as follows:
[search]
# URL of the Solr Server
 solr_url=http://solr2:2345/solr/

As a result, you may not be able to access the Search app from the Hue web UI. To resolve this issue:

  1. Log into Cloudera Manager as an administrator.
  2. Go to Clusters > $Hue service > Configuration and add the following lines in the Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini field:
    [search]
    # URL of the Solr Server
    solr_url=http://[***HOSTNAME***]:[***PORT***]/solr/
    solr_url=http://solr2:4567/solr/
  3. Click Save Changes.
  4. Restart the Hue servie.