Before we get into the details on using ShardingSessionProxy, a couple
of questions:
* Are you *sure* you need to shard? Sharded Solr setups are usually
called for only if you have a truly massive amount of data in your
index. If you're just looking to scale up the amount of traffic Solr
can handle, replication is your best tool.
* Assuming the answer to the above is "yes", on what basis do you want
to shard your data? By class? Geography?
Mat
> --
> You received this message because you are subscribed to the Google Groups "Sunspot" group.
> To post to this group, send email to ruby-s...@googlegroups.com.
> To unsubscribe from this group, send email to ruby-sunspot...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ruby-sunspot?hl=en.
>
>
You'd want to put something along these lines in an initializer:
shard_sessions = (1..4).map do |i|
session = Sunspot::Session.new
session.config.solr.url = "http://solr-#{i}.myhost.com"
Sunspot::SessionProxy::ThreadLocalSessionProxy.new(session)
end
Sunspot.session = Sunspot::SessionProxy::IdShardingSessionProxy.new(
Sunspot.session, shard_sessions)
IdShardingSessionProxy is more of an example than something intended
for use as-is in a real application -- you're generally better off
implementing your own session proxy which shards based on some sort of
natural distinguisher.
Mat