博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
solr cloud zk管理
阅读量:4171 次
发布时间:2019-05-26

本文共 3663 字,大约阅读时间需要 12 分钟。

1.ZK CLI

ZooKeeper's Command Line Utility (CLI).

zkcli Parameters

Short

Parameter Usage

Meaning

 

-cmd <arg>

CLI Command to be executed: bootstrapupconfigdownconfiglinkconfigmakepathgetgetfileput,putfilelist or clear
This parameter is mandatory

-z

-zkhost <locations>

ZooKeeper host address. 
This parameter is mandatory for all CLI commands.

-c

-collection <name>

For linkconfig: name of the collection.

-d

-confdir <path>

For upconfig: a directory of configuration files.

-h

-help

Display help text.

-n

-confname <arg>

For upconfiglinkconfig: name of the configuration set.

-r

-runzk <port>

Run ZooKeeper internally by passing the Solr run port; only for clusters on one machine.

-s

-solrhome <path>

For bootstrap or when using -runzk: the mandatory solrhome location.

ZooKeeper CLI Examples

Below are some examples of using the zkcli CLI:

Uploading a Configuration Directory

java -classpath example/solr-webapp/WEB-INF/lib/*org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 127.0.0.1:9983-confdir example/solr/collection1/conf -confname conf1 -solrhome example/solr

Put arbitrary data into a new ZK file

java -classpath example/solr-webapp/WEB-INF/lib/*org.apache.solr.cloud.ZkCLI -zkhost 127.0.0.1:9983 -put /data.txt 'some data'

Put a local file into a new ZK file

java -classpath example/solr-webapp/WEB-INF/lib/*org.apache.solr.cloud.ZkCLI -zkhost 127.0.0.1:9983 -putfile /data.txt /some/local/file.txt

Linking a Collection to a Configuration Set

java -classpath example/solr-webapp/webapp/WEB-INF/lib/*org.apache.solr.cloud.ZkCLI -cmd linkconfig -zkhost 127.0.0.1:9983-collection collection1 -confname conf1 -solrhome example/solr

Bootstrapping All the Configuration Directories in solr.xml

java -classpath example/solr-webapp/webapp/WEB-INF/lib/*org.apache.solr.cloud.ZkCLI -cmd bootstrap -zkhost 127.0.0.1:9983-solrhome example/solr

Scripts

There are scripts in /solr-7.2.1/server/scripts/cloud-scripts/zkcli.sh that handle the classpath and class name for you if you are using Solr out of the box with Jetty. Commands then become:

sh zkcli.sh -cmd linkconfig -zkhost 127.0.0.1:9983-collection collection1 -confname conf1 -solrhome example/solr

 

 

2.Managing collections via the collections API

CREATE---

http://localhost:8983/solr/admin/collections?action=CREATE&name=mycollection&numShards=3&replicationFactor=4

name:collection的名称

numShards:指定分片数量(slices)

replicationFactor:副本数量

maxShardsPerNode:默认值为1,注意三个数值:numShards、replicationFactor、liveSolrNode,一个正常的solrCloud集群不容许同一个liveSolrNode上部署同一个shard的多个replic,因此当maxShardsPerNode=1时,numShards*replicationFactor>liveSolrNode时,报错。因此正确时因满足以下条件:

numShards*replicationFactor<liveSolrNode*maxShardsPerNode

createNodeSet:

collection.configName:指定该collection使用那份config,这份config必须存在于zk中。

DELETE---

http://localhost:8983/solr/admin/collections?action=DELETE&name=mycollection

RELOAD---

http://localhost:8983/solr/admin/collections?action=RELOAD&name=mycollection

SPLIT SHARD---

http://localhost:8983/solr/admin/collections?action=SPLITSHARD&collection=
&shard=shardId

 

3.Creating cores via CoreAdmin

curl 'http://localhost:8983/solr/admin/cores?action=CREATE&name=mycore&collection=collection1&shard=shard2'

 

 

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

Q1:Multiple schemas in the same SolrCloud ?

java -classpath .:/home/solrcloud/solr-lib/* org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 10.200.51.190:2224,10.200.51.192:2224,10.200.51.194:2224 -confdir /home/solrcloud/fox-config-files/ -confname foxconf

指定配置文件,上传到zk。

curl 'http://10.200.51.194:2223/solr/admin/collections?action=CREATE&name=fox4&numShards=1&replicationFactor=5&collection.configName=foxconf'

为创建的collection指定collection.configName。

转载地址:http://buyai.baihongyu.com/

你可能感兴趣的文章
rh436 - Facing "Volume group for uuid not found" error while run lvcreate on shared storage
查看>>
Archlinux to Debian小记
查看>>
rh436 - rhel6.2下如何使/etc/iscsi/iscsid.conf里面的timeout参数生效
查看>>
rh436 - rhel6.2如何在host关闭时不保存kvm虚拟机的状态
查看>>
Debian Wheezy 64 - 解决插ntfs格式的u盘或者移动硬盘时报错,不能自动挂载
查看>>
Debian 7.1 x64 - 使用Oracle SQL Developer 3.2.2 (3.2.20.09.87)
查看>>
Oracle EBS R12 - ad patch/non-ad patch/admrgpch
查看>>
Oracle EBS R12 - Application patch可不可以reapply
查看>>
rh423 - redhat-ds如何移除已有ds并重新部署新的ds
查看>>
rh423 - 主辅同步报错:there is no replicated area "dc=server119,dc=example,dc=com" on the consumer server
查看>>
rh423 - Linux客户端利用winbind加入Windows 2008 Enterprise R1/SP1的AD
查看>>
2021-04-01
查看>>
2021-04-01
查看>>
matlab中调用函数
查看>>
leetcode - 只出现一次的数字
查看>>
leetcode - 旋转数组
查看>>
ubuntu忘记密码?怎么办
查看>>
ubuntu系统解决按上下健等出现字母问题
查看>>
ubuntu镜像下载地址
查看>>
ubuntu下安装gcc
查看>>