Al: As it happens, I hope sometime today to put up a patch for SOLR-4910 that should harden up many things in persisting solr.xml, I'll be sure to include this. It's kind of a pain to create an automated test for this, so I'll give it a whirl manually.
As you say, most of this is going away in 5.0, but it needs to work for 4.x. And when I get the patch up, if you could give it a "real world" try it'd be great! Thanks, Erick On Fri, Jun 14, 2013 at 6:15 PM, Al Wold <alw...@alwold.com> wrote: > Hi, > I'm working on setting up a solr cloud test environment, and the target > environment I need to put it in has multiple webapps per tomcat instance. > With that in mind, I wanted/had to avoid putting any configs in system > properties. I tried putting the zkHost in solr.xml, like this: > >> <?xml version="1.0" encoding="UTF-8" ?> >> <solr persistent="true" sharedLib="lib" zkHost="10.116.249.136:2181"> >> <!-- this 8080 might need to change in production --> >> <cores adminPath="/admin/cores" zkClientTimeout="20000" hostPort="8080" >> hostContext="/"/> >> </solr> > > Everything works fine when I first start things up, create collections, > upload docs, search, etc. Creating the collection, however, modifies the > solr.xml file, and doesn't keep the zkHost setting: > >> <?xml version="1.0" encoding="UTF-8" ?> >> <solr persistent="true" sharedLib="lib"> >> <cores adminPath="/admin/cores" zkClientTimeout="20000" hostPort="8080" >> hostContext="/"> >> <core loadOnStartup="true" shard="shard2" >> instanceDir="directory_shard2_replica1/" transient="false" >> name="directory_shard2_replica1" collection="directory"/> >> <core loadOnStartup="true" shard="shard1" >> instanceDir="directory_shard1_replica1/" transient="false" >> name="directory_shard1_replica1" collection="directory"/> >> </cores> >> </solr> > > > With that in mind, once I restart tomcat, it no longer knows it's supposed to > be talking to zookeeper, so it looks for local configs and blows up. > > I traced this back to the code in CoreContainer.java, in the method > persistFile(), where it seems to contain no code to write out the zkHost when > it updates solr.xml. I upped the logging on my solr instance to verify this > code is executing, so I'm pretty sure it's the right spot. > > Is anyone else using zkHost in their solr.xml successfully? I can't see how > it would work given this problem. > > Does this seem like a bug? If so, I can probably file a report and submit a > patch. It seems like this problem may become a non-issue in 5.0, based on > comments in the code and some of the discussion in JIRA, but I'm not sure how > far off that is. > > Thanks! > > -Al Wold >