Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client side failover /load balancing #2

Open
meenarc opened this issue Oct 4, 2014 · 11 comments
Open

Client side failover /load balancing #2

meenarc opened this issue Oct 4, 2014 · 11 comments
Labels

Comments

@meenarc
Copy link

meenarc commented Oct 4, 2014

Does Spring-Data-Solr handle client side failover,load balancing across multiple solr nodes(something like http://wiki.apache.org/solr/LBHttpSolrServer?)

@christophstrobl
Copy link
Owner

@meenarc yes. just use the type you want eg. CloudSolrServer in your configuration.

@Bean
public SolrServer solrServer() {
  return new CloudSolrServer("http://127.0.0.1/zk", new LBHttpSolrServer("http://127.0.0.1:8983/solr_1", "http://127.0.0.1:8983/solr_2"));
}

@meenarc
Copy link
Author

meenarc commented Oct 6, 2014

So can the CloudSolrServer API be used , even in case of private clustered Solr installations. Like we are planning a DataStax Solr clustered set up

@meenarc meenarc closed this as completed Oct 6, 2014
@meenarc meenarc reopened this Oct 6, 2014
@christophstrobl
Copy link
Owner

Actually I never tested it against DataStax.

@meenarc
Copy link
Author

meenarc commented Oct 20, 2014

I have another question-Can Spring Data Solr be used in a JRE 6 environment

@christophstrobl
Copy link
Owner

that pretty much depends on the solr-solrj version you're using. As off org.apache.solr:solr-solrj:4.8.0 you'll require to have at least Java 7.

@meenarc
Copy link
Author

meenarc commented Oct 20, 2014

But can I assume that 1.3.0.RELEASE of spring-data-solr would be tied to SolrJ 4.7.2?
If you were to upgrade to using SolrJ 4.8 would it mean that there would be a newer version of spring-data-solr and to that extent I can go by the release version of spring-data-solr?

@christophstrobl
Copy link
Owner

You can expect sd-solr 1.3.x to stick with the solrj 4.7.x line.

We plan to upgrade solrj in 1.4.0 but keep spring-data-solr itself 1.6 compatible so that you sill can use it along with solrj 4.7.x in a Java 6 environment.

@meenarc
Copy link
Author

meenarc commented Oct 24, 2014

I had tried to set up the Solr Template as follows

<solr:solr-server id="solrServer" url="http://10.63.20.128:8983/solr"/>

<bean id="solrTemplate" class="org.springframework.data.solr.core.SolrTemplate" >
    <constructor-arg ref="solrServer" />
    <constructor-arg index="1" value="${solr.core.datapages:datapages.spreadsheet_test}"/>
</bean>

Anytime I use the SolrTemplate I run into Caused by: org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: http://10.63.20.128:8983/solr/datapages.spreadsheet_test
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:507)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:199)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
at org.springframework.data.solr.core.SolrTemplate$11.doInSolr(SolrTemplate.java:353)
at org.springframework.data.solr.core.SolrTemplate$11.doInSolr(SolrTemplate.java:350)
at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:132)
... 40 more
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to 10.63.20.128:8983 timed out
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:129)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)

But when I use the SolrJ API directly as follows I am able to fetch results.

HttpSolrServer solrServer=new HttpSolrServer("http://10.63.20.128:8983/solr/datapages.spreadsheet_test") ;
SolrQuery query = new SolrQuery();
..........
solrServer.query(query);

In both cases the maven dependency is on the 1.3.0 RELEASE, so the SolrJ used above is the same as the one that used by the underlying Spring jars.

@christophstrobl
Copy link
Owner

@meenarc would you mind including your referenced solrServer bean definition?

@meenarc
Copy link
Author

meenarc commented Oct 25, 2014

solr:solr-server id="solrServer" url="http://10.63.20.128:8983/solr"

The previous comment got badly formatted and am not sure if you got to view the contents.I just removed the end and clsoing tags of the solr bean definition I have and pasted it above since that seems to impact formatting.

@christophstrobl
Copy link
Owner

hmm... well that's strange. Would you mind opening an issue in JIRA. It would be really helpful if you could include (gist maybe) a small sample reproducing the error. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants