lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "ZooKeeperIntegration" by JasonRutherglen
Date Tue, 16 Feb 2010 22:22:03 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "ZooKeeperIntegration" page has been changed by JasonRutherglen.
http://wiki.apache.org/solr/ZooKeeperIntegration?action=diff&rev1=11&rev2=12

--------------------------------------------------

  <<TableOfContents>>
  
  = Introduction =
- 
  Integrating Solr and !ZooKeeper allow us a lot more flexibility for dynamic, distributed
configuration.  Additionally, it does not require a breakage of back-compatibility and it
can use the existing Solr infrastructure.
  
  See
+ 
   * http://hadoop.apache.org/zookeeper
   * https://issues.apache.org/jira/browse/SOLR-1277
   * https://issues.apache.org/jira/browse/SOLR-1431
   * https://issues.apache.org/jira/browse/SOLR-1585
   * SolrCloud (other design notes)
+  * DeploymentofSolrCoreswithZookeeper - https://issues.apache.org/jira/browse/SOLR-1724
  
  = ZooKeeper Component =
  There will be a !ZooKeeperComponent to be configured through solrconfig.xml. The !ZookeeperComponent
may expose the !ZooKeeper client instance which could be used by any plugin for purposes such
as adding/removing key/values or performing master election etc
  
  == Configuration ==
+ An example configuration for the !ZooKeeperComponent in solrconfig may look like the following:
  
- An example configuration for the !ZooKeeperComponent in solrconfig may look like the following:
  {{{
  <zookeeper>
      <!-- See the ZooKeeper docs -->
@@ -34, +35 @@

      <str name="nodesDir">/solr_domain/nodes</str>
   </zookeeper>
  }}}
- After the nodes are started it may look as follows 
+ After the nodes are started it may look as follows
  
  {{attachment:zk-solr.png}}
  
  = ZooKeeper Aware Distributed Search =
- 
  For distributed search, a new !ShardHandler plugin will be created that moves the shard
calculation code from !QueryComponent and handles both the current approach and the !ZooKeeper
approach. There will be a new !ShardHandler called !ZooKeeperAwareShardHandler which will
use the !ZooKeeper component to figure out the available shards and their nodes.
  
  !ZooKeeperAwareShardHandler's configuration will contain the name of the shard to which
this node belongs. On startup, it will get the core's ZooKeeperComponent and add a key/value
(the shard name) in !ZooKeeper to the current core's node.
@@ -48, +48 @@

  {{{
  <requestHandler name="standard" class="solr.SearchHandler" default="true">
      <!-- other params go here -->
-  
+ 
      <shardHandler class="ZooKeeperAwareShardHandler">
         <str name="shard">shard1</int>
      </shardHandler>
  </requestHandler>
  }}}
- 
  With the above configuration, on initialization, the !ZooKeeperAwareShardHandler will get
the ZKClient from the !SolrCore and register itself as a sequential node under the path "/solr_domain/nodes"
and value url=localhost:8983/solr/core1
  
  TODO: Figure out where does "me" live - zk configuration or shard handler configuration.
@@ -64, +63 @@

  !ZooKeeperAwareShardHandler always maintains a list of shard names and a list of nodes that
belong to that shard. If the setup has all the slaves sitting behind a loadbalancer, the value
of 'me' points to the loadbalancer instead of the node's host:port. The Shardhandler would
automatically load balance if there are multiple  nodes serving up a shard.
  
  == Master/Slave ==
- 
  master/slave setup is only valid for !ReplicationHandler. So the configuration of master
node can be delegated to ReplicationHandler.
  
- The design of replication in this section is only valid if you use the standard solr.ReplicationHandler
. The configuration of ReplicationHandler would look as follows. 
+ The design of replication in this section is only valid if you use the standard solr.ReplicationHandler
. The configuration of ReplicationHandler would look as follows.
  
  {{{
  <requestHandler name="/replication" class="solr.ReplicationHandler">
@@ -81, +79 @@

      </lst>
      <lst name="zkSetup">
         <str name="masterZnode">/solr_domain/shard1_master</str>
-        <bool name="masterCandidate">true</bool>        
+        <bool name="masterCandidate">true</bool>
      </lst>
    </requestHandler>
  }}}
- 
- 
- In this design the Zookeeper is used for [[http://hadoop.apache.org/zookeeper/docs/r3.2.1/recipes.html#sc_leaderElection
| leader election]]. When Solr starts up, the !ReplicationHandler , if mastercandidate=true
,gets the !ZookeeperComponent and gets hold of the Zookeeper client. It tries to become a
master by creating a znode (SEQUENTIAL|EPHEMERAL) under the 'masterZnode'. The instance which
succeeds in becoming the leader will be the master. All other nodes will treat this as the
master. if this node dies another leader is elected and that becomes the master.
+ In this design the Zookeeper is used for [[http://hadoop.apache.org/zookeeper/docs/r3.2.1/recipes.html#sc_leaderElection|leader
election]]. When Solr starts up, the !ReplicationHandler , if mastercandidate=true ,gets the
!ZookeeperComponent and gets hold of the Zookeeper client. It tries to become a master by
creating a znode (SEQUENTIAL|EPHEMERAL) under the 'masterZnode'. The instance which succeeds
in becoming the leader will be the master. All other nodes will treat this as the master.
if this node dies another leader is elected and that becomes the master.
  
  The node created will store all the details : eg: master000000001=url=http://host:port/solr/cor1/replication,version=13254424,generation=5
  
  === Other Replication Strategies ===
- 
  NOTE COMPLETELY IMPLEMENTED YET.
  
  Nodes can register themselves as Masters by adding their entry to a Master Group and marking
themselves as a master.  The !ReplicationHandler can then be configured to subscribe to that
Master Group, getting the first one out of the list of children of the group (this is dependent
on !ZooKeeper supporting getFirstChild() which it currently does not) Masters are ephemeral.
 If that is not implemented, then we need some other way of selecting the master.  For now,
it could just be configured so that there is only one master.
  
- Thus, if there are two groups of Masters, then it would look like this:
+ Thus, if there are two groups of Masters, then it would look like this: master_group_1/
- master_group_1/
-    192.168.0.1_8080_solr [192.168.0.1:8080/solr]
-    192.168.0.2_8080_solr [192.168.0.2:8080/solr]
+ 
+  . 192.168.0.1_8080_solr [192.168.0.1:8080/solr] 192.168.0.2_8080_solr [192.168.0.2:8080/solr]
+ 
  master_group_2/
-    192.168.0.3_8080_solr [192.168.0.3:8080/solr]
-    192.168.0.4_8080_solr [192.168.0.4:8080/solr]
  
+  . 192.168.0.3_8080_solr [192.168.0.3:8080/solr] 192.168.0.4_8080_solr [192.168.0.4:8080/solr]
+ 
+ The trick here is how to keep all the masters in a group in sync.  Ideas: 1. Servlet filter
that replicates out indexing commands to other masters in a master group 2. backup masters
replicate from the master 3. Others?, as neither of these is 100% fault tolerant
- The trick here is how to keep all the masters in a group in sync. 
- Ideas:
- 1. Servlet filter that replicates out indexing commands to other masters in a master group
- 2. backup masters replicate from the master
- 3. Others?, as neither of these is 100% fault tolerant
  
  === Rebalancing ===
- 
  Through the ZK req handler, slaves can be moved around, at which point they will pull the
index from the master in their group and thus you can have rebalancing.  Additionally, new
nodes that come online w/o an index will go to their master and get the index.  The replication
handler already handles replicating configuration files, so this is just a config issue.
- 
- 
  
  The !ShardHandler is automatically setup.
  
-  1. Setup !ZooKeeper according to !ZooKeeper docs, including a ZK config file.  
+  1. Setup !ZooKeeper according to !ZooKeeper docs, including a ZK config file.
-  1. Startup the !ZooKeeper server with your configuration file.  
+  1. Startup the !ZooKeeper server with your configuration file.
   1. Startup your Solr nodes, all properly configured
  
  TODO: Show real example.

Mime
View raw message