I accidentally deleted id field from solr. What to do now?
{
"add-field" : {
"name":"id",
"type":"string"
}
}
Not working too. Core not loaded.
Are you running in SolrCloud mode? If not, edit the managed-schema directly on the disk under the core directory, then restart Solr.
If you're running in cluster / cloud mode, you can first use the downconfig command to download the current configuration, the use upconfig to upload the edited configuration.
zkcli.sh is located under server/scripts/cloud-scripts/zkcli.sh by default.
Related
I have Solr cloud configuration which we run on 4 servers. We use tomcat as web server for solr. I have 5 zookeepers to maintain the data-replication. I have added a jar file with custom update processor. This is in shared folder which is mention in solr.xml
<solr persistent="true" sharedLib="/solr/lib">
While creating the first version of this jar file I gave the name updateProcessor.0.1.jar as the file name. Even though it was shared, jar files were added in all the 4 servers.
But now I have to update the updateProcessor. For this I created updateProcessor0.2.jar. I deleted the updateProcessor.0.1.jar from each sever and added a new one. But changes were not seen ?
Any ideas what I am doing wrong? Should this is be checked using zkcli ?
Well I found a roundabout which may help someone in future maybe.
I changed entry in solrconfig from
<processor class="org.apache.solr.update.processor.MyUpdateProcessorFactory">
to
<processor class="org.apache.solr.update.processor.MyUpdateProcessorFactory2">
I renamed the class file I created in solr config from MyUpdateProcessorFactory to MyUpdateProcessorFactory2
Currently we are using Apache Solr 4.10.3 OR Heliosearch Distribution for Solr [HDS] as a search engine to index our data.
Now after that, I got the news about Apache Solr 5.0.0 release in last month. I'd successfully installed Apache Solr 5.0.0 version and now its running properly on 8983 port (means only running solr but unable to create core). In that UI, I'm unable to find the example core as well as schema or config files under it. So, I started creating new core as we create in old versions but unable to create one. Following is the error, I'm getting it:
Error CREATEing SolrCore 'testcore1': Unable to create core [testcore1] Caused by: Could not find configName for collection testcore1 found:null
Note: I also seen Cloud tab on (ie. http://localhost:8983/solr/) left side of Solr UI and also don't know how it works? Meaning I don't know the location of the schema.xml, solrconfig.xml files due to lack of example folder (Collection1) and how to update those files?
Is there any useful document or solution available to solve this error?
In Solr 5, creation of cores is supported by the bin/solr script provided in the distribution. Try
bin/solr create -help
for a quick introduction.
From the above help doc, you may find:
bin/solr create [-c name] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port]
In Solr 5.4.0 , create new core using command from Solr-5.x.x folder (Solr Installation folder) like following,
$ bin/solr create -c <name>
See this documentation of Apache Solr 5.4 https://cwiki.apache.org/confluence/display/solr/Running+Solr
{SOLR_INSTALLATION}/server/solr/configsets\basic_configs\conf
you can find the example schema.xml and solrconfig.xml.
if you want to create the new core
{SOLR_INSTALLATION}/server/solr/{new core name} folder and create conf folder with required schema and solrconfig.xml and blank core.properties file.
you can find the examples for schema and config in
{SOLR_INSTALLATION}/example/example-DIH/solr
Create using the web interface
Go to bin directory and issue
./solr start -e cloud -noprompt
Which will start solr.
Go to http://localhost:8983
(this is assuming you are running on localhost)
Click on core admin and they "Add Core"
Use provided solr script with solr user privileges to create Solr cores, e.g.
cd /opt/solr
sudo -u solr ./bin/solr create -c testcore1
Run bin/solr --help for syntax guidance.
For any other issues, please check your Solr logs (e.g. /var/solr/logs/solr.log).
Related: SOLR-7826: Permission issues when creating cores with bin/solr as root user.
You can find your solrconfig.xml and schema.xml inside the collection directory.
Go to /usr/lib/ambari-infra-solr/server/solr and u will see a folder with same name as of collection and with schema and config files.
Inside the conf folder there will be a managed-schema file and other files that you have been searching for.
As for this error
Error CREATEing SolrCore 'testcore1': Unable to create core [testcore1] Caused by: Could not find configName for collection testcore1 found:null
This error must be coming when you are creating solr collection from UI.
For that go to location where solr.cmd is located and type the below code
./solr create -c -d -s -r
copy conf from solr/example/conf to solr/server/solr/.
I want to be able to add new collections to my SolrCloud dynamically. But to add a collection I have to upload the config file into ZooKeeper first, right?
But how can I do that without restarting ZooKeeper and my Solr instance?
If you are using SOLR4.0+ then you dont have to restart the SOLR instances.
http://technical-fundas.blogspot.in/2014/07/solr-reload-solrconfigxml-and-schemaxml.html
And When you upload the config files zookeeper, you neither have to restart the zookeeper as well.
Steps:
1) Upload the solrconfig.xml / schema.xml file in zookeeper
2) RUN reload command
http://technical-fundas.blogspot.in/2014/07/solr-reload-solrconfigxml-and-schemaxml.html
Hope this answers to your question...
I have a Solr slave that is running in Tomcat. I added a core, so I changed solr.xml. To reload it I decided to simply restart Tomcat using the Windows Services managament console.
After restarting Tomcat I keep getting the following exception:
org.apache.lucene.store.LockObtainFailedException: Index locked for
write for core
I decided to temporarily change the solrconfig.xml for each core to add:
<unlockOnStartup>true</unlockOnStartup>
But no luck. Locking is set to native, so I can't go and remove lock files.
How do I get Solr up and running again?
How should I restart Solr to prevent this from happening?
Delete only write.log in data/index . Where is data directory is specified in conf/solrconfig.xml.
Clear the index directory and restart solr. It will work
Delete file write.log in folder /data/index/ for your core then restart tomcat. It worked for me.
In case the other answers don't work, check your file permissions. In my case, I had to do a
chown -R tomcat6:tomcat6 /opt/solr/corename
Just deleted write.lock file under Solr > My Core > data > Index > write.lock file and restart solr server and it's worked.
I have setup a SolrCloud replication using standalone zookeeper. But now I wish to make some changes to my Schema.xml and reload the core. The problem is that when I run a single server Solr (no solrcloud) the new schema is loaded, but I do not know how to reload schema on all the replication server. I tried reloading the schema on one of the server with no desired impact. Is there a way in which I can reload my schema.xml in Solr in distributed replication setup which uses zookeeper.
Just found the solution we need to push the changed configuration to zookeeper ensemble.
Just use
sh zkcli.sh -cmd upconfig -zkhost 127.0.0.1:2181 -collection collection1 -confname myconf -solrhome ../solr -confdir ../solr/collection1/conf
zkcli.sh is present under example/cloud-scripts
The answer marked as correct is wrong. You have to use Solr Collection API
Once you have uploaded the new collection (index) configuration with the Solr zkcli.sh utility the configuration will not be reloaded automatically.
Solr Collection API are indicated for SolrCloud and the configuration reload will be spread in the whole cluster. As far as I know Solr Collection API are available at least from Solr 4.8.
The procedure is slightly different and with these API you can reload the configuration on the entire Cluster with only one API call.
Just upload your updated configuration with the Solr zkcli.sh utility. Pay attention to do not confuse Solr zkcli.sh with Zookeeper zkCli.sh they have quite the same name but completely different purpose.
So as said use Solr zkcli.sh (At time of writing is in the directory server/scripts/cloud-scripts):
./zkcli.sh -cmd upconfig -zkhost 127.0.0.1:2181 -collection collection1 -confname myconf -confdir path/to/solr/collection1/conf
Then you can reload the configuration of collection1 with:
http://server1:8983/solr/admin/collections?action=RELOAD&name=collection1
The entire cluster will be updated.
This worked for me :
bin/solr zk -upconfig -n collectionName -d pathto/Conf_directory -z localhost:2181/solr
Below is the Command for Windows,
IT will be almost same in Unix we just need to change the path of Solr lib and class-path separator ; & : Because its java command so should run in Unix also.
java -Dlog4j.configuration="file:E:/solr-5.5.1/server/scripts/cloud-scripts/log4j.properties" -classpath .;E:/solr-5.5.1/server/solr-webapp/webapp/WEB-INF/lib/*;E:/solr-5.5.1/server/lib/ext/* org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 192.168.42.13:2787 -confdir E:/New_Solor_Conf -confname Solor_conf
Brief details about command as follows:
Configuration of log4j for logging.
-Dlog4j.configuration="file:E:/solr-5.5.1/server/scripts/cloud-scripts/log4j.properties
Class path to run "org.apache.solr.cloud.ZkCLI". class.
make sure UNIX and Windows will have different : (Unix seperator) ;(Windows Separator)
-classpath .;E:/solr-5.5.1/server/solr-webapp/webapp/WEB-INF/lib/;E:/solr-5.5.1/server/lib/ext/
-zkhost 192.168.42.13:2787 (Remote Host and port where Solr Zookeeper is running)
-confdir E:/New_Solor_Conf (Local directory what we need to upload.)
-confname Solor_conf Remote instance name.
If you will not use correct class path you will get error like :
Error: Could not find or load main class org.apache.solr.cloud.ZkCLI
or
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFacto
ry
at org.apache.solr.common.cloud.SolrZkClient.<clinit>(SolrZkClient.java:
71)
at org.apache.solr.cloud.ZkCLI.main(ZkCLI.java:183)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
I am able to upload my local configuration changes without physically login to remote Solr box. Hope it will work for other also.