Window环境下基于Tomcat & Zookeeper搭建Solr Cloud 5.1

本文详细介绍了如何部署SolrCloud集群,并与Tomcat服务器整合,包括下载安装Zookeeper、SolrCloud和Tomcat,配置Zookeeper,设置Tomcat端口,以及验证部署的正确性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

官方文档(英文)
https://wiki.apache.org/solr/SolrCloudTomcat

Download Tomcat\Zookeeper\Solr Cloud

tomcat 7
下载地址:http://archive.apache.org/dist/tomcat/tomcat-7/

Solr Cloud 5.1
下载地址:http://www.apache.org/dyn/closer.cgi/lucene/solr/5.1.0

Zookeeper 3.4.6
下载地址:http://zookeeper.apache.org/doc/r3.4.6/

安装Zookeeper

1) 下载Zookeeper from http://zookeeper.apache.org/releases.html

2) 解压Zookeeper, 由于我是在本机,所以我放在同一目录下:
D:\zookeeper\zookeeper-3.4.6-1
D:\zookeeper\zookeeper-3.4.6-2
D:\zookeeper\zookeeper-3.4.6-3

3)编辑Zookeeper配置文件:
D:\zookeeper\zookeeper-3.4.6-1\conf\zoo.cfg

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=../data
dataLogDir=../logs
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

initLimit=5  
syncLimit=2  
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3880
server.3=127.0.0.1:2890:3890

4) 其他的两个也类似,只是注意clientPort,因为我是在本地,所以端口不能重复。

5)在data目录下创建myid文件
D:\zookeeper\zookeeper-3.4.6-1\data\myid

例如:server 1 的myid内容为

1

server 1 为 1, server 2 为 2, server 3 为 3。

6) 启动Zookeeper
D:\zookeeper\zookeeper-3.4.6-1\bin\zkServer.cmd

报以下错误,需要把三个Zookeeper都启动起来。

2015-05-14 22:08:46,220 [myid:1] - WARN  [WorkerSender[myid=1]:QuorumCnxManager@382] - Cannot open channel to 3 at elect
ion address szpc1475/10.86.18.193:3890
java.net.ConnectException: Connection refused: connect
        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:368)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:341)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:
449)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:430)
        at java.lang.Thread.run(Unknown Source)

安装Tomcat

D:\tomcat\apache-tomcat-7.0.61-1
D:\tomcat\apache-tomcat-7.0.61-2
D:\tomcat\apache-tomcat-7.0.61-3

2)修改server端口(由于本机要运行多个tomcat,简单期间直接修改端口)
D:\tomcat\apache-tomcat-7.0.61-1\conf\server.xml
修改完之后运行tomcat,看下tomcat是否可以正常启动且可以访问。
D:\tomcat\apache-tomcat-7.0.61-1\bin\startup.bat

浏览器输入http://127.0.0.1:8081/,确认是否可以看到首页。

3)将下载的

4)

5)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值