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

Multi-core with Multi-tenancy #7

Open
skrasovsky opened this issue Dec 19, 2015 · 1 comment
Open

Multi-core with Multi-tenancy #7

skrasovsky opened this issue Dec 19, 2015 · 1 comment

Comments

@skrasovsky
Copy link

Hi!

We use solr 5.x and spring-data-solr. I try to understand is it possible to use multi-core in multi-tenancy mode.

We have several tenants and we want to have a single solr core per tenant. The main problem is a spring repositories, i can't define which core should use repository for current tenant.
For example:

public class User {
    @Field("username")
    private String username;
}

public interface UserRepository extends SolrCrudRepository<User, String> {
    User findUserByUsername(String username);
}

And two cores:

http://localhost:8983/solr/tenant_1
http://localhost:8983/solr/tenant_2

So, if tenant = tenant_1, repository should search for user in /solr/tenant_1, if tenant = tenant_2 in /solr/tenant_1.

I can do it manually via solrj:

String solrServerUrl = "http://localhost:8983/solr";
MulticoreSolrServerFactory solrServerFactory = new MulticoreSolrServerFactory(new HttpSolrServer(solrServerUrl));

SolrServer solrServer = solrServerFactory.getSolrServer("tenant1");

SolrQuery solrQuery = new SolrQuery();
solrQuery.setQuery("find user by username query");

solrServer.query(solrQuery);

But it is not convenient. In this case we need to rewrite all our solr repositories.

@christophstrobl can you advice something?

Thanks!

@casabian
Copy link

casabian commented Nov 20, 2017

Hi @skrasovsky,
did you find a solution for this? I'm facing the same problem without willing to rewrite all repos.

@christophstrobl do you have any advice for that topic?

Thanks!

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

No branches or pull requests

2 participants