I'm trying to automate the creation of new collections using the solr create
command in Solr 8.11.1 as follows
sudo -u solr /opt/solr/bin/solr create -c collection_name
However, I get connection refused since Solr is listening on the host IP address, not localhost
ERROR: Connect to localhost:8983 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Is there a way to specify a hostname/IP address when running solr create
?
You can set the hostname used for the bin/solr
script through the SOLR_HOST
environment variable:
export SOLR_HOST=<ip>
sudo -u solr /opt/solr/bin/solr create -c collection_name