搭建zookeper管理solr集群

本文详细介绍了如何在两台服务器上部署ZooKeeper集群,包括下载安装包、配置myid文件、修改zoo.cfg参数及启动ZooKeeper等步骤。

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

以两台服务器为例:

IP地址分别为:10.0.1.201 和10.0.1.202

下载zookeeper压缩包

wget  http://apache.fayea.com/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz

在10.0.1.201服务器上:

1、进入/home/目录下(随便选择目录),将zookeeper-3.4.9.tar.gz压缩文件放入该目录下
执行命令
tar -zxvf zookeeper-3.4.9.tar.gz
解压zookeeper安装包zookeeper-3.4.9文件夹

2、接下来创建data目录,并在data目录中创建myid文件,将"1"写入到myid文件中

cd  /home/zookeeper-3.4.9
mkdir data
echo 1 >> data/myid
zookeeper-3.4.9目录下创建一个存放日志的目录logs
mkdir logs
3、进入conf目录下,将zoo_sample.cfg文件重命名为zoo.cfg
cd conf
mv zoo_sample.cfg zoo.cfg
4、最后修改zoo.cfg中的参数
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=5
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.

dataDir=/home/zookeeper-3.4.9/data
dataLogDir=/home/zookeeper-3.4.9/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
server.1=10.0.1.201:2881:3881
server.2=10.0.1.202:2881:3881

5、启动zookeper

/home/zookeeper-3.4.9/bin/zkServer.sh start

 

6、最后进入solr安装目录的bin目录下修改solr.in.sh文件,在文件中添加
SOLR_MODE=solrcloud
ZK_HOST=10.0.1.201:2181,10.0.1.202:2181
SOLR_HOST="10.0.1.201"


在10.0.1.202服务器上:

1、进入/home/目录下(随便选择目录),将zookeeper-3.4.9.tar.gz压缩文件放入该目录下
执行命令
tar -zxvf zookeeper-3.4.9.tar.gz
解压zookeeper安装包zookeeper-3.4.9文件夹

2、接下来创建data目录,并在data目录中创建myid文件,将"1"写入到myid文件中

cd  /home/zookeeper-3.4.9
mkdir data
echo 2 >> data/myid
zookeeper-3.4.9目录下创建一个存放日志的目录logs
mkdir logs
3、进入conf目录下,将zoo_sample.cfg文件重命名为zoo.cfg
cd conf
mv zoo_sample.cfg zoo.cfg
4、最后修改zoo.cfg中的参数
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=5
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.

dataDir=/home/zookeeper-3.4.9/data
dataLogDir=/home/zookeeper-3.4.9/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
server.1=10.0.1.201:2881:3881
server.2=10.0.1.202:2881:3881

5、启动zookeper

/home/zookeeper-3.4.9/bin/zkServer.sh start

 

可使用在两台服务器上查看zookeeper的运行状态

/home/zookeeper-3.4.9/bin/zkServer.sh status 

 

6、最后进入solr安装目录的bin目录下修改solr.in.sh文件,在文件中添加
SOLR_MODE=solrcloud
ZK_HOST=10.0.1.201:2181,10.0.1.202:2181
SOLR_HOST="10.0.1.202"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值