Solr replication copies an index from a leader to one or more followers. The followers poll the leader and pull the changed index files after each commit, so they serve the same data, in another region if you want, while you write only to the leader.
solrconfig.xml.The follower checks the leader every pollInterval and copies what changed.
01 · On the leader
Open the leader index, click Configuration and add the handler to solrconfig.xml (edit a file):
<requestHandler name="/replication" class="solr.ReplicationHandler"> <lst name="leader"> <str name="replicateAfter">startup</str> <str name="replicateAfter">commit</str> <str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str> </lst> </requestHandler>
replicateAfter: when the leader offers a new version, after startup and after each commit.
confFiles: configuration files copied along with the data. Leave solrconfig.xml out: the follower needs its own.
02 · On the follower
In the follower index, add:
<requestHandler name="/replication" class="solr.ReplicationHandler"> <lst name="follower"> <str name="leaderUrl">https://LEADER_HOST/solr/LEADER_INDEX</str> <str name="pollInterval">00:00:20</str> <str name="httpBasicAuthUser">LEADER_USERNAME</str> <str name="httpBasicAuthPassword">LEADER_PASSWORD</str> </lst> </requestHandler>
leaderUrl: the address of the leader index, https:// + the Host on its Info tab + /solr/ + its name (address and login).
pollInterval: how often the follower checks for changes, as HH:MM:SS.
httpBasicAuthUser and httpBasicAuthPassword: the username and password of the leader index (HTTP Basic Auth).
leader, follower and leaderUrl, and Solr 10 accepts only those. On older versions write master, slave and masterUrl instead. Opensolr writes the same pairs when it sets up replication for you.03 · Let the two indexes reach each other
On the leader, allow the follower's server on the /replication handler, in the Security tab under IP Restriction. Find its address with ping FOLLOWER_HOST.
Do the same on the follower for the leader's server.
Keep schema.xml identical on both indexes. A mismatch makes replication fail or the results differ.
04 · Check that it works
Save both files (each save reloads its index), then ask the follower for its replication status:
curl -u "FOLLOWER_USERNAME:FOLLOWER_PASSWORD" "https://FOLLOWER_HOST/solr/FOLLOWER_INDEX/replication?command=details&wt=json"
An error that says the leader is not available has its own page: Leader not available.
Replication
Manual index replication: leader and follower (this page)