How many solr servers can I add?
Posted: Wed Oct 22, 2014 1:17 am
As per the requirement, I needed three instances of Solr servers. So, I have created three Index services, three search services.
All of these three servers are standalone and are at ports 8983,8984,8985 respectively.
The problem I am getting is that, when I use just the two servers, everything is fine. But, when I add the third server, to my fascination, I am getting an error like:
Unknown field 'productId' in MySolrSearchServiceImpl.java
though the field is declared and I haven't modified it. Here the above class corresponds to 8983 port. When I remove a server, which maintains different data and is it 8985 port, then I am not seeing this error. I don't understand the relation between those two servers. Here is how I have created those servers in applicationContext.xml file..
But for all of those search services, I am using the same SolrContext class. Do I need to write SolrContext like classes of my own for each SearchService implementation?
Thanks in advance. Hope you will reply as asson as possible.
All of these three servers are standalone and are at ports 8983,8984,8985 respectively.
The problem I am getting is that, when I use just the two servers, everything is fine. But, when I add the third server, to my fascination, I am getting an error like:
Unknown field 'productId' in MySolrSearchServiceImpl.java
though the field is declared and I haven't modified it. Here the above class corresponds to 8983 port. When I remove a server, which maintains different data and is it 8985 port, then I am not seeing this error. I don't understand the relation between those two servers. Here is how I have created those servers in applicationContext.xml file..
<bean id="AbcServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
<constructor-arg value="http://localhost:8985/solr"/>
</bean>
<bean id="AbcReindexServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
<constructor-arg value="http://localhost:8985/solr/reindex"/>
</bean>
<bean id="abc" class="com.mycompany.core.search.service.solr.AbcSearchServiceImpl">
<constructor-arg name="solrServer" ref="AbcServer" />
<constructor-arg name="reindexServer" ref="AbcReindexServer" />
</bean>
<bean id="solrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
<constructor-arg value="http://localhost:8983/solr"/>
</bean>
<bean id="solrReindexServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
<constructor-arg value="http://localhost:8983/solr/reindex"/>
</bean>
<bean id="blSearchService" class="com.mycompany.core.search.service.solr.MySolrSearchServiceImpl">
<constructor-arg name="solrServer" ref="solrServer" />
<constructor-arg name="reindexServer" ref="solrReindexServer" />
</bean>
<bean id="DefSolrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
<constructor-arg value="http://localhost:8984/solr"/>
</bean>
<bean id="DefSolrReindexServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
<constructor-arg value="http://localhost:8984/solr/reindex"/>
</bean>
<bean id="DefSearchService" class="com.mycompany.core.search.service.solr.DefSolrSearchServiceImpl">
<constructor-arg name="solrServer" ref="DefSolrServer" />
<constructor-arg name="reindexServer" ref="DefSolrReindexServer" />
</bean>
<bean id="rebuildIndexJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="blSearchService" />
<property name="targetMethod" value="rebuildIndex" />
</bean>
<bean id="rebuildIndexTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
<property name="jobDetail" ref="rebuildIndexJobDetail" />
<property name="startDelay" value="${solr.index.start.delay}" />
<property name="repeatInterval" value="${solr.index.repeat.interval}" />
</bean>
<bean id="rebuildAbcIndexJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="blAbcSearchService" />
<property name="targetMethod" value="rebuildIndex" />
</bean>
<bean id="rebuildAbcIndexTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
<property name="jobDetail" ref="rebuildAbcIndexJobDetail" />
<property name="startDelay" value="${solr.abc.index.start.delay}" />
<property name="repeatInterval" value="${solr.abc.index.repeat.interval}" />
</bean>
<bean id="rebuildDefIndexJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="blDefSearchService" />
<property name="targetMethod" value="rebuildIndex" />
</bean>
<bean id="rebuildDefIndexTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
<property name="jobDetail" ref="rebuildDefIndexJobDetail" />
<property name="startDelay" value="${solr.def.index.start.delay}" />
<property name="repeatInterval" value="${solr.def.index.repeat.interval}" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="rebuildDefIndexTrigger" />
<ref bean="rebuildAbcIndexTrigger" />
<ref bean="rebuildIndexTrigger" />
<!--<ref bean="purgeCartTrigger" />-->
<!--<ref bean="purgeCustomerTrigger" />-->
</list>
</property>
</bean>
But for all of those search services, I am using the same SolrContext class. Do I need to write SolrContext like classes of my own for each SearchService implementation?
Thanks in advance. Hope you will reply as asson as possible.