Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Building a Search Infrastructure with Apache Solr and SolrCloud

Apache Solr is the underlying technology that powers Mylife.com's people search capabilities. Apache Solr and SolrCloud will be introduced and their application to our current search infrastructure will be discussed.


on 3 October 2017

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Building a Search Infrastructure with Apache Solr and SolrCloud

Building a Search Infrastructure
with Apache Solr and SolrCloud

Solr Replicas
Centralized management
Introduction to Solr
When replica goes down
Leader stops sending updates
During recovery
Simple synch if differences are small
Get missing update commands from leader
Otherwise replicate whole index
Get full index from leader
Solr and Lucene
Built on Apache Lucene- Java library for information retrieval
Manages an inverted index
Regular index
"what terms in a document?"
Inverted index
"which documents contain a specific term?"
If master goes down, then cannot update shard
Document assignment performed internally by own hashing scheme
No centralized management of schema or configuration
Splitting shards requires reindexing
Searches to cluster, must use lengthy 'shard' parameter
Mylife Architecture
What is Solr?
System built to search text
A platform to build search applications on
Customizable, open source software
SolrCloud Indexing
No more master/slave. Just leaders/replicas
Leader automatically elected
If leader goes down, then a new replica is automatically elected as new leader
Fixes problem of master going down and cannot update shard
Shard selection for indexing
document ID hashed
no need to do own hashing
Solr Searching
Requests can be sent to any machine
No distinction between master and slave
Searching is near real-time
distributed indexing
soft commits to memory
No need for shard parameter in query or solrconfig.xml
Centralized configuration
Maintains schema and configuration
Provides distributed synchronization
Run ZooKeeper as part of Solr application
If Solr app goes down, ZooKeeper also goes down
Run ZooKeeper as stand-alone instance on separate boxes
Multiple instances of ZooKeeper running if any ZooKeeper instance crash
Embedded versus Ensemble
SolrCloud Leader
When leader goes down
Only some replicas may have received updates
New leader chosen and synch processes run against other replicas
If replicas are too out of synch, asks for full replication/ replay based recovery
Solves challenge of failed updates when master is down
Why Solr?
Solr performs better for text search than relational DBs
Solr features specific to text search
highlighting, faceting, etc
Sample Inverted Index
Solr Architecture
Distributed capabilities of Solr
Set up fault-tolerant, highly available cluster of Solr servers
install Solr
Start Solr up with -DzkHost parameter
Register them with load balancer
Shut down machine
Currently, each Solr server has its own schema.xml, solrconfig.xml
Updates requires copying to each server
Can mean redeployment of entire cluster
SolrCloud allows uploading configuration to ZooKeeper
ZooKeeper sends updated configuration to entire cluster
Spencer Yuen, Mylife.com
Simple Clients
Manage own load balancing
If server fails, try another replica in shard
Intelligent Clients
Connects to ZooKeeper to know which shards are up
Commit Strategies
When doc is sent to index
For replica, forward request
to own shard leader if shard is correct
to leader of another shard that is correct
For leader
forward doc to correct shard leader
index doc for itself and shard replicas
Transaction Log
Records updates
Allows replay of uncommitted updates if indexing is interrupted
Allows replicas to synch
Mylife Pipeline
Searching in Solr
Mylife Solr Query
Filter queries limit responses to main query
query parser which processes user input, can handle errors, e.g. Lucene, dismax, edismax
request distributed across all shards in the list. We'll revisit for SolrCloud.
Response writers format output, including XML, JSON, etc
Boost particular field when determining which results go to top
q or q.alt
actual main query
A Few Parameters
Request Handling
index with its configurations. What is actually being indexed and searched on
request handler
plugin to Solr that processes incoming request in a particular way
Solr Schema
fields - what you are searching/indexing in your document
"name", "dob", "location"
a field can be "indexed" (searched on) and/or "stored" (displayed as result)
fields are denormalized or flat structure
field types - data type of field
"string", "int", "date", "boolean"
Contains Solr configurations
Custom request handlers
browse, admin, data import
Supporting library paths
Data directory
Frequency of commit
cache management configurations
...and more
Sample Solr Schema
<field name="name"type="string" indexed="true" stored="true"/>
<fieldType name="string" class="solr.StrField"/>
Update Handler
Handles update request
Processes commit to disk
refreshes searcher or snapshot view of index
Solr uses unique ID
marks old version as deleted
adds new version of document
processes text for each field or apply transformations to make text easily searchable
character filter, e.g. ISO Latin
I LOVE This café -> I LOVE This cafe
tokenizer, e.g. whitespace
I LOVE This cafe
token filters, e.g. lowercase
i love this cafe
Solr is powerful, simple, easily configurable platform for search applications
SolrCloud support fault-tolerance through ZooKeeper
Prize Question
What is the name of an intelligent Solr client?
Solr Feature: Faceted Search
technique to access information according to a classification system by multiple dimensions
Sample faceted search
Faceting in Solr
Faceting supported out-of-the-box in Solr
Use facet query parameters
Can facet on
field values
Facet Parameters
Specify faceted fields
Specify max number values
Specify sort order by count or alphabet
facet.offset for paging
Sample Mylife query
Shard Splitting
Initial collection
Need to select number of shards
May have chosen wrong number
Re-indexing data required to reallocate shards
Shard splitting
Solr 4.3 feature
Pre-existing shards can be split without reindexing
Solr Cloud Admin
Full transcript