ZooKeeper & Solr Cloud - I need change Schema.xml file - solr

I would like to update the /configs/DMF-index-transformed/schema.xml file in ZooKeeper with /home/~/Desktop/schema.xml. I have a link similar to this problem same problem and resolve. But there was a desire to open a new topic because it was my problem.
sh zkcli.sh -cmd upconfig -zkhost 127.0.0.1:9983 -collection DMF-index-transformed -confname ??? -solrhome ??? -confdir ???
I just want to update (editing in vi or editor) the schema.xml file. How can I organize the above command according to this problem?
solr -version 4.9.0
zooKeeper -version 3.4.6

You don't need to pass the collection and solrhome parameters, only confname and confdir.
The "confname" parameter is the name of the config in zookeeper (in your case "DMF-index-transformed"), and the "confdir" should be a directory where is your schema.xml (it's better to create a subfolder in your "Desktop" folder, to upload only the schema.xml file instead of all Desktop folder files).
So, the command should look something like this:
zkcli.sh -cmd upconfig -zkhost 127.0.0.1:9983 -confname DMF-index-transformed -confdir /home/~/Desktop/subfolder
Where "subfolder" is the folder with your schema.xml and/or another config files

Related

How to properly update configset in SolrCloud mode

I referred here to edit my solrconfig.xml file, though the changes are reflected in solrconfig.xml in zookeeper the /spell request handler that I commented is still working. Following are the steps that I followed
First I created a collection with collection name amazon_products with _default configset and in zookeeper, configset with name same as collection name amazon_products is created as shown below
Then I downloaded configset amazon_products and edited solrconfig.xml(commented /spell request handler) and then I uploaded the same to zookeper as shown below
Then I restarted solr using the following commands
bin/solr restart -c -p 8983 -s example/cloud/node1/solr
bin/solr restart -c -p 7574 -z localhost:9983 -s example/cloud/node2/solr
Now I used Solr Admin UI and changed request handler from /select to /spell, even though I commented request handler /spell in solrconfig.xml and uploaded that to zeekeeper and restarted the solr still queries executed with /spell request handler are working, but it should have shown 404 error for /spell as I commented this part
Just to verify whether changes to solrconfig.xml in zookeeper are reflected or not I downloaded configset and checked the solconfig.xml file the changes that I made were reflected properly
So to conclude though my changes are reflected why it is not working as excepted?
Is it a proper way to update configset in solrcloud?
Am I restarting solr properly?
EDIT: I even tried reloading the collection instead of restarting collection but still having the same problem
Reload command used:
http://localhost:8983/solr/admin/collections?action=RELOAD&name=amazon_products
Solved the problem. I was giving wrong port number for zookeeper so changing port number from 2181 to 9983 solved the problem.
changed the command from
bin/solr zk upconfig -n amazon_products -d /Users/swastikn/Documents/solr_configs/my_sample_configs -z localhost:2181
to
bin/solr zk upconfig -n amazon_products -d /Users/swastikn/Documents/solr_configs/my_sample_configs -z localhost:9983

How do we edit config files uploaded to zookeeper ensemble

I have uploaded solr config files to zookeeper and created collection indexed few documents into collection. Now I want to update schema file. Is it possible to edit the schema config file uploaded to zookeeper. ? If yes how do we do it. some source say upload updated schema config file to zookeeper which overwrites old one.
uploading updated config file is not tedious task But want to know if there is a way to edit the existing config file in zookeeper.
Thanks in advance,
vinod
To update schema download latest configset associated with schema
Latest configset can be downloaded using following command:
solr zk -downconfig -d directory to download -n configset name -z ip:port of zookeeper
for example : solr zk -downconfig -d C:\solr\workingConfig -n configsetName -z localhost:2181
make required changes
Then Upload latest configset to zookeeper using following command.
solr zk -upconfig -d directory to upload -n configset name -z ip:port of zookeeper
For example: solr zk -upconfig -d C:\solr\workingConfig -n configsetName -z localhost:2181
Then you need to Reload schema so that changes can take effect immediately.
Schema can be reloaded using following command:
http://ip:port/solr/admin/collections?action=RELOAD&name=

Create Solr collection with shared Zookeeper Ensemble

I set up a SOLR cluster with two nodes and external Zookeper ensemble. This ZK ensemble has 3 nodes. I start my solr instances with parameter:
-z zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/solr5
That means, I want the SOLR configuration to be under /solr5 instead of / as it is done by default.
The folder /solr5 is created in ZK with:
create /solr5 []
I also can upload the SOLR configuration into /solr5 without problem.
My question is when creating a collection, how do I get the generated files to be under /solr5?
The command I use to create the collection is:
bin/solr create -c collection1 -n configset -s 2 -rf 2
I looked at the documentation on this page but i don't see where to specify the zk path. The files and folder generated are:
security.json
clusterstate.json
aliases.json
live_nodes
overseer
overseer_elect
collections
How do I get these generated under /solr5 instead of /?
The solution is to specify the the zookeeper path in solr.xml:
<solrcloud>
<str name="zkHost">zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/solr5</str>
</solrcloud>

Solr : Path for the config files in embedded zookeeper

I am using solr-6.0.0
Using the cloud example,
I started solr in cloud mode using the following commands
bin/solr start -cloud -p 8983 -s "example/cloud/node1/solr"
bin/solr start -cloud -p 7574 -s "example/cloud/node2/solr" -z localhost:9983
I would like to index data from my database. Had it been stand-alone mode I would have edited the managed-schema and solrconfig.xml files accordingly. But for cloud-mode I cannot find those files.
According to the docs :
Note that the SolrCloud example does not include a conf directory for
each Solr Core (so there is no solrconfig.xml or Schema file). This is
because the configuration files usually found in the conf directory
are stored in ZooKeeper so they can be propagated across the cluster.
So where can I edit those files or do I need to upload a new set of config files and override the already uploaded ones?
Found this in the docs:
See the section : Uploading configs using zkcli or SolrJ
at Uploading configs using zkcli
You can do something like this to push a file :
zkcli.sh -zkhost localhost:2181 -cmd putfile /solr.xml /path/to/solr.xml
and something like this to upload the config files:
./server/scripts/cloud-scripts/zkcli.sh -zkhost localhost:9983 -cmd upconfig -confname <conf-name> -confdir <path-of-the-local-conf-dir>

How does solr loads configsets in examples provided by solr?

I have started learning solr.I have downloaded the latest zip(5.1.0) provided by solr and run the server using bin/solr start -e cloud -noprompt.
I check that this internally calls
bin/solr start -cloud -s example/cloud/node1/solr -p 8983
bin/solr start -cloud -s example/cloud/node2/solr -p 7574 -z localhost:9983
I check that these is no config(conf/solrconfig.xml) defined in example/cloud/node1/solr so how does solr load config from the SOLR_HOME/configsets directory?
I read the documentation on several places but i am still unable to figure out the use of cloud like in 'bin/solr start -cloud -s ... ' and use of zookeeper.
Please help.
when you are working on solr cloud with zookeeper, you have to upload your solr config on zookeeper.
./bin/solr zk -upconfig -z localhost:2181,localhost:2182,localhost:2182 -n my-config -d server/solr/files/conf/
using upconfig you can upload your solr config, only have to provide path of your config directory.
You can use config name(my-config) for create core using api.
http://XXX.XXX.XXX.XXX:8983/solr/admin/collections?action=CREATE&name=irTest&numShards=3&replicationFactor=2&maxShardsPerNode=3&collection.configName=my-config
So it will create core using your config only.
Download the latest version of the Apache solr reference guide.
https://www.apache.org/dyn/closer.cgi/lucene/solr/ref-guide/apache-solr-ref-guide-5.1.pdf
check this section in the PDF.
Configuration Directories and SolrCloud
Since you are not specifying a specific configset, the default is loaded.
First, if you don't provide the -d or -n options, then the default
configuration ($SOLR_HOME/server/solr/con
figsets/data_driven_schema_configs/conf) is uploaded to ZooKeeper
using the same name as the collection

Resources