What is SolrCloud collection?
A complete logical index in a SolrCloud cluster. The index can be distributed into more than single shard. This distributed index can be referred to by name of collection. A collection is associated with a config file set and is made up of one or more shards.
What is Config Set?
It is a set of configuration files required by the collection to function properly. The config set can be referred by a name and at minimum consists of solrconfig.xml and schema.xml, but can include other files such as synonyms.txt, stopwords.txt etc and other files.
Where is the Config Set stored in SolrCloud?
Config Set files are stored in Zookeeper in the form of tree structure that can be viewed from Solr console.
In the above Zookeeper config, notice how cluster info is arranged, specifically the location of
techproducts collection Config Set. The path to each branch/leaves is accessed as follows.
/ -> Zookeeper's root /configs -> path under which each collection's configuration is stored. /configs/techproducts/synonyms.txt -> path to synonyms.txt file of techproducts collection
Updating synonyms.txt file
Instead of using Zookeeper’s native script (which is not friendly for updating Zookeeper data) it is possible to update entire file using
zkcli utility that comes with Solr.
For example, from local windows, synonyms.txt can be updated as follows on
techproducts SolrCloud cluster.
C:\solr-7.1.0\server\scripts\cloud-scripts>zkcli -zkhost localhost:2181 -cmd putfile /configs/techproducts/synonyms.txt C:/solr-7.1.0/server/solr/configsets/sample_techproducts_configs/conf/synonyms.txt
C:\solr-7.1.0\server\scripts\cloud-scripts is where Solr zookeeper scripts reside.
zkcli is the script to use.
localhost:2181 is Zookeeper server used by SolrCloud cluster.
putfile is the command to update synonyms.txt in Zookeeper tree.
/configs/techproducts/synonyms.txt is the path of synonyms.txt file in Zookeeper tree structure.
C:/solr-7.1.0/server/solr/configsets/sample_techproducts_configs/conf/synonyms.txt is where the updated synonyms.txt file resides.
- Zookeeper stores configuration files in the form of tree structure.
- The tree structure can be viewed in Solr console http://localhost:8983/solr/#/~cloud?view=tree
- Navigate to specific file in zookeeper tree from the ‘root’ / (for example, /configs/techproducts/synonyms.txt)
- Solr provides
zkcliscript that allows updates to specific files in Zk tree strcuture.
zkcliscript needs zookeeper’s address used by SolrCloud