solr cloud with zookeeper

1. config zookeeper

  1. Install the Java JDK. You can use the native packaging system for your system, or download the JDK from:

    http://java.sun.com/javase/downloads/index.jsp

  2. Set the Java heap size. This is very important to avoid swapping, which will seriously degrade ZooKeeper performance. To determine the correct value, use load tests, and make sure you are well below the usage limit that would cause you to swap. Be conservative - use a maximum heap size of 3GB for a 4GB machine.

  3. Install the ZooKeeper Server Package. It can be downloaded from:

    http://hadoop.apache.org/zookeeper/releases.html

  4. Create a configuration file. This file can be called anything. Use the following settings as a starting point:

    tickTime=2000
    dataDir=/var/zookeeper/
    clientPort=2181
    initLimit=5
    syncLimit=2
    server.1=zoo1:2888:3888
    server.2=zoo2:2888:3888
    server.3=zoo3:2888:3888

    You can find the meanings of these and other configuration settings in the section Configuration Parameters . A word though about a few here:

    Every machine that is part of the ZooKeeper ensemble should know about every other machine in the ensemble. You accomplish this with the series of lines of the form server.id=host:port:port . The parameters host and port are straightforward. You attribute the server id to each machine by creating a file named myid , one for each server, which resides in that server's data directory, as specified by the configuration file parameter dataDir .

  5. The myid file consists of a single line containing only the text of that machine's id. So myid of server 1 would contain the text "1" and nothing else. The id must be unique within the ensemble and should have a value between 1 and 255.

  6. If your configuration file is set up, you can start a ZooKeeper server:

    $ java -cp zookeeper.jar:lib/log4j-1.2.15.jar:conf \ org.apache.zookeeper.server.quorum.QuorumPeerMain zoo.cfg

    QuorumPeerMain starts a ZooKeeper server, JMX management beans are also registered which allows management through a JMX management console. The ZooKeeper JMX document contains details on managing ZooKeeper with JMX.

    See the script bin/zkServer.sh , which is included in the release, for an example of starting server instances.

  7. Test your deployment by connecting to the hosts:

    • In Java, you can run the following command to execute simple operations:

      $ java -cp zookeeper.jar:src/java/lib/log4j-1.2.15.jar:conf:src/java/lib/jline-0.9.94.jar \ org.apache.zookeeper.ZooKeeperMain -server 127.0.0.1:2181

    • In C, you can compile either the single threaded client or the multithreaded client: or n the c subdirectory in the ZooKeeper sources. This compiles the single threaded client:

      $ make cli_st

      And this compiles the mulithreaded client:

      $ make cli_mt

    Running either program gives you a shell in which to execute simple file-system-like operations. To connect to ZooKeeper with the multithreaded client, for example, you would run:

    $ cli_mt 127.0.0.1:2181

config solr

1. Upload configuration to ZooKeeper

sh zkcli.sh -cmd bootstrap -zkhost 127.0.0.1:9983 -solrhome example/solr

2. config solr.xml

 

<solr persistent="true" zkHost=”zoo1:2181,zoo2:2181,zoo3:2181” >

  <cores adminPath="/admin/cores" defaultCoreName="collection1" hostContext="solr" host="${host:}" hostPort="8080" zkClientTimeout="${zkClientTimeout:15000}">

    <core name="collection1" instanceDir="collection1" />

  </cores>

</solr>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值