Connecting Martini to SolrCloud
The ability to connect Martini to a SolrCloud cluster is already a built-in feature. It only takes a few simple configuration changes. Before doing this however, you should ensure that connecting to SolrCloud is supported by your Martini license.
Navigate to Martini's
Open your instance properties file and edit the
This property value should be
cloud, to tell Martini that it will be using SolrCloud. It triggers Martini to use the delegating version of Solr. That is, Martini will iterate through a list of declared Solr servers and use the first server that successfully connects to a Solr core.
Delegating Solr servers
Martini also ships with a built-in feature that allows it to use an embedded Solr server in place of the cloud or remote Solr cluster when the latter is unavailable.
This feature is disabled by default, but you can enable it by setting the
solr.enable-embedded-fallbackinstance property value to
The comma-separated IP addresses of the ZooKeeper instances in your ZooKeeper ensemble.
The prefix of your collection names.
Here's how it's configured for this section's example:
1 2 3
solr.mode=cloud solr.url=192.168.21.71:2181,192.168.21.72:2181,192.168.21.73:2181 solr.core-prefix=jte
Restart your Martini instance. This time, it should connect to your SolrCloud cluster.
cd <martini-home>/bin/ ./toro-martini start
While Martini is starting, check the logs to see if the collections have been initialized properly. You should see something similar to the logs below if Martini was able to communicate properly with the SolrCloud cluster:
1 2 3 4
25/04/18 08:56:49.977 INFO [CloudSolrClient] Starting core: 'invoke_monitor' 25/04/18 08:56:50.037 INFO [CloudSolrClient] Starting core: 'invoke_monitor' completed 25/04/18 08:56:49.402 INFO [CloudSolrClient] Starting core: 'tracker' 25/04/18 08:56:49.963 INFO [CloudSolrClient] Starting core: 'tracker' completed
That's it! Your Martini instance is now using the SolrCloud cluster that you have just configured!