You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Brian Robinson <br...@socialsurgemedia.com> on 2013/07/24 21:00:00 UTC
Do I need solr.xml?
Hello,
I'm trying to get Solr 4.4 up and running. I only want a single core
(for now). I'm running this with Tomcat on Apache. I have a couple of
different issues, which may be resolved by including a properly written
solr.xml file.
First, when I navigate to
http://{myhost}:8080/solr/
I get what looks like the admin page, but it says that there are solr
core initialization failures, and the links on the page just bring me
back to the same page.
Second, when I try to put a doc in the index using the PHP Pecl Solr
package from a page on my site, I get errors that indicate that Solr
can't see my schema.xml file, since Solr doesn't recognize some of the
fields that I've defined. I have my updated schema.xml file in
/etc/solr/collection1/conf/
This is the error I get:
*Fatal error*: Uncaught exception 'SolrClientException' with message
'Unsuccessful update request. Response Code 400. <?xml version="1.0"
encoding="UTF-8"?> <response> <lst name="responseHeader"> <int
name="status">400</int> <int name="QTime">1</int> </lst> <lst
name="error"> <str name="msg">ERROR: [doc=334455] unknown field
'brand'</str> <int name="code">400</int> </lst> </response> ' in XXXXX:
SolrClient->addDocument(Object(SolrInputDocument)) #1 {main} thrown in
XXXXXX
And this is the relevant section of my schema.xml
<field name="brand" type="int" indexed="false" stored="true"
required="true"/>
After perusing the help pages, I see a couple of different pages that
indicate that because the directory structure has changed, Solr can no
longer find the config files and start a core without including a
solr.xml file with the proper settings. However, it's also my
understanding from other pages that we only need solr.xml if we want to
define multiple cores, and that a single core should work automatically.
So my question is: do I actually need to create a solr.xml file, and all
the accompanying files that go into specifying a core? (I'm not sure if
there are, but from some of the documentation it seems like there may
be.) Or am I pursuing an unnecessary solution to these problems, and
there's a simpler fix?
Thanks,
Brian
Re: Do I need solr.xml?
Posted by Erick Erickson <er...@gmail.com>.
Actually, you're getting a solr.xml file but you don't know it.
When Solr doesn't find solr.xml, there's a default one hard-
coded that is used. See ConfigSolrOld.java, at the end
DEF_SOLR_XML is defined.
So, as Hoss says, it's much better to make one anyway so
you know what you're getting.
Consider setting it up for the "discovery" mode, see:
http://wiki.apache.org/solr/Solr.xml%204.4%20and%20beyond
Best
Erick
On Wed, Jul 24, 2013 at 9:21 PM, Chris Hostetter
<ho...@fucit.org> wrote:
>
> : I get what looks like the admin page, but it says that there are solr core
> : initialization failures, and the links on the page just bring me back to the
> : same page.
>
> if you get an error on the admin UI, there should be specifics about
> *what* the initialization failure is -- at last one sentence, and there
> should be a full stack trace in the logs -- having those details will
> help understand the root of your first problem, which may explain your
> second problem.
>
> it would also help to know what the CoreAdmin handler returns when you ask
> it for status about all the cores -- even if the *UI* is having problems
> on your browser, that should return useful info (like: how many cores you
> have -- if any -- and which one had an init failure)
>
> https://cwiki.apache.org/confluence/display/solr/CoreAdminHandler+Parameters+and+Usage#CoreAdminHandlerParametersandUsage-{{STATUS}}
>
> : Second, when I try to put a doc in the index using the PHP Pecl Solr package
> : from a page on my site, I get errors that indicate that Solr can't see my
> : schema.xml file, since Solr doesn't recognize some of the fields that I've
> : defined. I have my updated schema.xml file in /etc/solr/collection1/conf/
>
> that doesn't make sense -- if solr can't see your schema.xml file at all,
> you wouldn't get an error about the fields you definied being missing --
> you'd get an error about the collection you are talking to not existin,g
> because if your schema.xml file can't be found (or has a problem loading)
> the entire SolrCore won't load.
>
> : <str name="msg">ERROR: [doc=334455] unknown field 'brand'</str> <int
> : name="code">400</int> </lst> </response> ' in XXXXX:
> : SolrClient->addDocument(Object(SolrInputDocument)) #1 {main} thrown in XXXXXX
>
> that error indicates that your solr client sent a document to some (valid
> and functioning) SolrCore which has a schema.xml that does not contain a
> field named "brand".
>
> : And this is the relevant section of my schema.xml
> :
> : <field name="brand" type="int" indexed="false" stored="true"
> : required="true"/>
>
> my best guess: you have multiple core defined in your solr setup -- one of
> which is working, and is what your client is trying to talk to, but which
> doesn't have the schema.xml that you put your domain specific fields in
> (maybe it's just the default example configs?) and you have another core
> defined, using your customized configs, which failed to load properly.
>
> you mentioned that you did in fact put your configs in "collection1" dir,
> but w/o the specifics of what your solr home dir structure looks like, and
> the specifics of your error message, and details about the URLs your
> client tried to talk to when it got that error, etc.... it's all just
> guesswork on our parts.
>
> http://wiki.apache.org/solr/UsingMailingLists
>
> : So my question is: do I actually need to create a solr.xml file, and all the
> : accompanying files that go into specifying a core? (I'm not sure if there are,
> : but from some of the documentation it seems like there may be.) Or am I
> : pursuing an unnecessary solution to these problems, and there's a simpler fix?
>
> the short answer of your specific question is "no", you don't *have* to
> have a solr.xml (at least not in Solr 4.x) but it's a really good idea,
> even if you only want a single core, because it gives you a way to be
> explicit about what you want and be sure it's what you are getting.
>
>
> -Hoss
Re: Do I need solr.xml?
Posted by Brian Robinson <br...@socialsurgemedia.com>.
Great, this guidance is definitely pointing me in the right direction.
Thanks Shawn, Erick, and Hoss. I'll pursue this some more and see if I
can get it working.
Brian
Re: Do I need solr.xml?
Posted by Shawn Heisey <so...@elyograg.org>.
On 7/25/2013 8:21 AM, Brian Robinson wrote:
> The sentence on the admin page just tells me to check the logs, but I
> don't appear to have any yet. Those are located in
> solr/collection1/data/tlog/, right?
Those are transaction logs - for durability in the face of failure and
for the real-time get handler. If you are using Solr 4.3.0 or later,
especially using the example jetty container (start.jar), the logs
should be in logs/solr.log, relative to the current working directory
where Solr was started. This location is dictated by log4j.properties.
If you have an earlier version or a more custom setup, the log
location could be highly variable.
The admin UI should have a logging section that will show you everything
in the log that's at least WARN severity. Often this isn't enough, and
you need the actual logfile.
> The only browser I appear to be able to use in my SSH (my only access to
> the server) is Lynx, so this response isn't formatted, unfortunately,
> but this is what I get. I tried to find a sample response so I could
> compare and parse out the useful information, but no luck. It looks like
> there is only the one core, though. I don't see anything that looks like
> an init failure.
The lynx browser isn't going to work for the admin UI. The links
(elinks on some systems) browser will display some things, but it
doesn't work either. The UI is pretty much all javascript, and you need
a full graphical browser for that to function properly.
SSH clients (including putty) will let you do port forwarding. Set it
up to forward a local port (like 8983, but you can use what you want) to
the remote port that Solr uses. Then in your local browser, go to
http://localhost:8983/solr (or whatever port you chose) and the UI
should work.
>> that error indicates that your solr client sent a document to some (valid
>> and functioning) SolrCore which has a schema.xml that does not contain a
>> field named "brand".
> So it could be that I just updated the wrong schema.xml. But if
> /etc/solr/ is my solr home directory, then /etc/solr/collection1/conf/
> would be the right location, right?
If you aren't using SolrCloud, and your core is named 'collection1',
then that should be the right schema. You must reload the core, or more
ideally completely restart Solr, after changing the schema.
Thanks,
Shawn
Re: Do I need solr.xml?
Posted by Brian Robinson <br...@socialsurgemedia.com>.
> if you get an error on the admin UI, there should be specifics about
> *what* the initialization failure is -- at last one sentence, and there
> should be a full stack trace in the logs -- having those details will
> help understand the root of your first problem, which may explain your
> second problem.
The sentence on the admin page just tells me to check the logs, but I
don't appear to have any yet. Those are located in
solr/collection1/data/tlog/, right?
>
> it would also help to know what the CoreAdmin handler returns when you ask
> it for status about all the cores -- even if the *UI* is having problems
> on your browser, that should return useful info (like: how many cores you
> have -- if any -- and which one had an init failure)
The only browser I appear to be able to use in my SSH (my only access to
the server) is Lynx, so this response isn't formatted, unfortunately,
but this is what I get. I tried to find a sample response so I could
compare and parse out the useful information, but no luck. It looks like
there is only the one core, though. I don't see anything that looks like
an init failure.
01collection1collection1true/etc/solr/collection1//etc/solr/collection1/data/solrconfig.xmlschema.xml2013-07-21T17:51:31.625Z33071636400010truefalseorg.apache.lucene.store.NRT
CachingDirectory:NRTCachingDirectory(org.apache.lucene.store.MMapDirectory@/etc/solr/collection1/data/index
lockFactory=org.apache.lucene.store.NativeFSLockFactory@7f322d18;
maxCacheMB=48.0 maxMergeSizeMB=4.0) 6565 bytes
My guess is it would look something like this if it were formatted
01
collection1
collection1
true
/etc/solr/collection1/
/etc/solr/collection1/data/
solrconfig.xml
schema.xml
2013-07-21T17:51:31.625Z33071636400010
truefalse
org.apache.lucene.store.NRTCachingDirectory:NRTCachingDirectory
(org.apache.lucene.store.MMapDirectory@/etc/solr/collection1/data/index
lockFactory=org.apache.lucene.store.NativeFSLockFactory@7f322d18;
maxCacheMB=48.0 maxMergeSizeMB=4.0)
6565 bytes
> that error indicates that your solr client sent a document to some (valid
> and functioning) SolrCore which has a schema.xml that does not contain a
> field named "brand".
So it could be that I just updated the wrong schema.xml. But if
/etc/solr/ is my solr home directory, then /etc/solr/collection1/conf/
would be the right location, right?
Brian
Re: Do I need solr.xml?
Posted by Chris Hostetter <ho...@fucit.org>.
: I get what looks like the admin page, but it says that there are solr core
: initialization failures, and the links on the page just bring me back to the
: same page.
if you get an error on the admin UI, there should be specifics about
*what* the initialization failure is -- at last one sentence, and there
should be a full stack trace in the logs -- having those details will
help understand the root of your first problem, which may explain your
second problem.
it would also help to know what the CoreAdmin handler returns when you ask
it for status about all the cores -- even if the *UI* is having problems
on your browser, that should return useful info (like: how many cores you
have -- if any -- and which one had an init failure)
https://cwiki.apache.org/confluence/display/solr/CoreAdminHandler+Parameters+and+Usage#CoreAdminHandlerParametersandUsage-{{STATUS}}
: Second, when I try to put a doc in the index using the PHP Pecl Solr package
: from a page on my site, I get errors that indicate that Solr can't see my
: schema.xml file, since Solr doesn't recognize some of the fields that I've
: defined. I have my updated schema.xml file in /etc/solr/collection1/conf/
that doesn't make sense -- if solr can't see your schema.xml file at all,
you wouldn't get an error about the fields you definied being missing --
you'd get an error about the collection you are talking to not existin,g
because if your schema.xml file can't be found (or has a problem loading)
the entire SolrCore won't load.
: <str name="msg">ERROR: [doc=334455] unknown field 'brand'</str> <int
: name="code">400</int> </lst> </response> ' in XXXXX:
: SolrClient->addDocument(Object(SolrInputDocument)) #1 {main} thrown in XXXXXX
that error indicates that your solr client sent a document to some (valid
and functioning) SolrCore which has a schema.xml that does not contain a
field named "brand".
: And this is the relevant section of my schema.xml
:
: <field name="brand" type="int" indexed="false" stored="true"
: required="true"/>
my best guess: you have multiple core defined in your solr setup -- one of
which is working, and is what your client is trying to talk to, but which
doesn't have the schema.xml that you put your domain specific fields in
(maybe it's just the default example configs?) and you have another core
defined, using your customized configs, which failed to load properly.
you mentioned that you did in fact put your configs in "collection1" dir,
but w/o the specifics of what your solr home dir structure looks like, and
the specifics of your error message, and details about the URLs your
client tried to talk to when it got that error, etc.... it's all just
guesswork on our parts.
http://wiki.apache.org/solr/UsingMailingLists
: So my question is: do I actually need to create a solr.xml file, and all the
: accompanying files that go into specifying a core? (I'm not sure if there are,
: but from some of the documentation it seems like there may be.) Or am I
: pursuing an unnecessary solution to these problems, and there's a simpler fix?
the short answer of your specific question is "no", you don't *have* to
have a solr.xml (at least not in Solr 4.x) but it's a really good idea,
even if you only want a single core, because it gives you a way to be
explicit about what you want and be sure it's what you are getting.
-Hoss
Re: Do I need solr.xml?
Posted by Brian Robinson <br...@socialsurgemedia.com>.
> I'd say you can work on this step and not bother with next steps until you
> get this one going. The main question would be where did your apache+solr
> setup came from? Was it working with earlier versions of Solr and you
> upgraded? Was it some automatic install? Something else.
It was installed by my hosting company since I have limited permissions
on our server, and this is the first installation of it on this server.
I've been trying to figure out the issues from my end so I can help
things along.
>
> I can think of three issues:
> 1) Your core/collection name is not 'collection1'. Before Solr 4.4 that
> required solr.xml. With Solr 4.4 it does not if you have a property file,
> but I am not sure of exact syntax.
Yep, I checked this, it is 'collection1'.
> 2) Your Tomcat is pointing at completely wrong directory. What does admin
> page says about your solr.solr.home path? That should be the directory
> above your collection directory and where previously solr.xml lived
The admin page that's turning up for me isn't showing that information,
so I can't verify it myself. However, the hosting company did tell me
that the home path was /etc/solr/, which is right above collection1/.
> 3) You are upgrading your setup and missed the note about log libraries
> changes: https://wiki.apache.org/solr/SolrLogging
I checked the tomcat lib directory, and the jar files from
solr/example/lib/ext/ are copied over. However, I did notice that the
log4j.properties file didn't seem to be in the right place. That could
be the issue, I've contacted my host to have them check this.
Thanks for your help so far, Alex; it does look like I was heading down
the wrong path, at least for my first problem.
Brian
>
> Regards,
> Alex.
>
> Personal website: http://www.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at
> once. Lately, it doesn't seem to be working. (Anonymous - via GTD book)
>
Re: Do I need solr.xml?
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
On Wed, Jul 24, 2013 at 3:00 PM, Brian Robinson
<br...@socialsurgemedia.com>wrote:
> I get what looks like the admin page, but it says that there are solr core
> initialization failures, and the links on the page just bring me back to
> the same page.
>
I'd say you can work on this step and not bother with next steps until you
get this one going. The main question would be where did your apache+solr
setup came from? Was it working with earlier versions of Solr and you
upgraded? Was it some automatic install? Something else.
I can think of three issues:
1) Your core/collection name is not 'collection1'. Before Solr 4.4 that
required solr.xml. With Solr 4.4 it does not if you have a property file,
but I am not sure of exact syntax.
2) Your Tomcat is pointing at completely wrong directory. What does admin
page says about your solr.solr.home path? That should be the directory
above your collection directory and where previously solr.xml lived
3) You are upgrading your setup and missed the note about log libraries
changes: https://wiki.apache.org/solr/SolrLogging
Regards,
Alex.
Personal website: http://www.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at
once. Lately, it doesn't seem to be working. (Anonymous - via GTD book)