solrCloud 4.9 分布式集群部署及注意事项
2017-05-13 10:28
393 查看
环境搭建
一.zookeeper
参考:http://blog.chinaunix.NET/uid-25135004-id-4214399.html
二.solrCloud
参考:http://lucien-zzy.iteye.com/blog/2002463
1.安装tomcat,配置端口。部署solr.war,将solr\example\lib\ext下的jar拷贝到solr\WEB-INF\lib下。
2.创建
/home/solr/solrcloud
/home/solr/solrcloud/config-files (放置solr\example\solr\collection1\conf 下的所有文件)
/home/solr/solrcloud/solr-lib (放置solr\WEB-INF\lib下的所有jar包)
3.配置中文分词器
4.创建solr数据目录
/home/solr/solr-cores
生成solr.xml,如下:
5.创建
tomcat/conf/Catalina
tomcat/conf/Catalina/localhost
并创建solr.xml
docBase根据实际情况配置;
solr/home为之前创建的目录:/home/solr/solr-cores
6.修改tomcat/bin/cataina.sh 文件,在最上方加入:JAVA_OPTS="-DzkHost=master:2181,slave1:2181,slave2:2181",或直接使用ip。
将以上配置发布到集群其他机器上。
7.SolrCloud是通过ZooKeeper集群来保证配置文件的变更及时同步到各个节点上,所以,需要将配置文件上传到ZooKeeper集群中。执行如下操作:
-cmd upconfig:上传配置文件
-confdir:配置文件的目录
-confname:指定对应的名称
-cmd linkconfig:为指定collection"绑定"配置文件
-collection
-confname
8.检查zookeeper的配置信息
zkCli.sh -server ip:port
ls /configs/myconf
ls /live_nodes
9.启动tomcat,创建collection
action:CREATE
name:collection名称
numShards:分片数量
replicationFactor:副本集数量
也可以通过zk查询collection的情况:ls /collections/mycollection
-------------------------------
1.ZK CLI
ZooKeeper's Command Line Utility (CLI).
ZooKeeper CLI Examples
Below are some examples of using the zkcli CLI:
Uploading a Configuration Directory
Put arbitrary data into a new ZK file
Put a local file into a new ZK file
Linking a Collection to a Configuration Set
Bootstrapping All the Configuration Directories in solr.xml
Scripts
There are scripts in example/cloud-scripts that handle the classpath and class name for you if you are using Solr out of the box with Jetty. Commands then become:
2.Managing collections via the collections API
CREATE---
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---
RELOAD---
SPLIT SHARD---
3.Creating cores via CoreAdmin
-------------------------------
Q1:Multiple schemas in the same SolrCloud ?
指定配置文件,上传到zk。
为创建的collection指定collection.configName。
文章来源:http://blog.csdn.net/guochunyang/article/details/49181759
一.zookeeper
参考:http://blog.chinaunix.NET/uid-25135004-id-4214399.html
二.solrCloud
参考:http://lucien-zzy.iteye.com/blog/2002463
1.安装tomcat,配置端口。部署solr.war,将solr\example\lib\ext下的jar拷贝到solr\WEB-INF\lib下。
2.创建
/home/solr/solrcloud
/home/solr/solrcloud/config-files (放置solr\example\solr\collection1\conf 下的所有文件)
/home/solr/solrcloud/solr-lib (放置solr\WEB-INF\lib下的所有jar包)
3.配置中文分词器
4.创建solr数据目录
/home/solr/solr-cores
生成solr.xml,如下:
<?xml version="1.0" encoding="UTF-8" ?> <solr persistent="true"> <logging enabled="true"> <watcher size="100" threshold="INFO" /> </logging> <cores defaultCoreName="collection1" adminPath="/admin/cores" host="${host:}" hostPort="8080" hostContext="${hostContext:solr}" zkClientTimeout="${zkClientTimeout:15000}"> </cores> </solr>
5.创建
tomcat/conf/Catalina
tomcat/conf/Catalina/localhost
并创建solr.xml
<?xml version="1.0" encoding="UTF-8"?> <Context docBase="/soft/apache-tomcat-7.0.37/webapps/solr" debug="0" crossContext="true"> <Environment name="solr/home" type="java.lang.String" value="/home/solr/solr-cores" override="true"/> </Context>
docBase根据实际情况配置;
solr/home为之前创建的目录:/home/solr/solr-cores
6.修改tomcat/bin/cataina.sh 文件,在最上方加入:JAVA_OPTS="-DzkHost=master:2181,slave1:2181,slave2:2181",或直接使用ip。
将以上配置发布到集群其他机器上。
7.SolrCloud是通过ZooKeeper集群来保证配置文件的变更及时同步到各个节点上,所以,需要将配置文件上传到ZooKeeper集群中。执行如下操作:
java -classpath .:/home/solr/solrcloud/solr-lib/* org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 192.168.91.128:2181,192.168.91.129:2181,192.168.91.130:2181 -confdir /home/solr/solrcloud/config-files/ -confname myconf
-cmd upconfig:上传配置文件
-confdir:配置文件的目录
-confname:指定对应的名称
java -classpath .:/home/solr/solrcloud/solr-lib/* org.apache.solr.cloud.ZkCLI -cmd linkconfig -collection collection1 -confname myconf -zkhost 192.168.91.128:2181,192.168.91.129:2181,192.168.91.130:2181
-cmd linkconfig:为指定collection"绑定"配置文件
-collection
-confname
8.检查zookeeper的配置信息
zkCli.sh -server ip:port
ls /configs/myconf
ls /live_nodes
9.启动tomcat,创建collection
curl 'http://192.168.91.128:8080/solr/admin/collections?action=CREATE&name=mycollection&numShards=3&replicationFactor=1'
action:CREATE
name:collection名称
numShards:分片数量
replicationFactor:副本集数量
也可以通过zk查询collection的情况:ls /collections/mycollection
-------------------------------
1.ZK CLI
ZooKeeper's Command Line Utility (CLI).
zkcli
Parameters
Short | Parameter Usage | Meaning |
---|---|---|
-cmd <arg> | CLI Command to be executed: bootstrap, upconfig, downconfig, linkconfig, makepath, get, getfile, put, putfile, listor 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 upconfig, linkconfig: 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 bootstrapor when using -runzk: the mandatory solrhome location. |
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 example/cloud-scripts 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=<collection_name>&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://blog.csdn.net/guochunyang/article/details/49181759
相关文章推荐
- solrCloud 4.9 分布式集群部署及注意事项
- solrCloud 4.9 分布式集群部署及注意事项
- solrCloud 4.9 分布式集群部署及注意事项
- SolrCloud 分布式集群安装部署(solr+ zookeeper +tomcat)
- Solr系列二:solr-部署详解(solr两种部署模式介绍、独立服务器模式详解、SolrCloud分布式集群模式详解)
- SolrCloud 分布式集群安装部署(solr4.8.1 + zookeeper +tomcat)
- Spring Cloud Eureka集群部署注意事项
- 170825、SolrCloud 分布式集群部署步骤
- hadoop伪分布式集群部署注意事项
- 【SOLR集群】分布式搜索部署SOLRCLOUD案例图文
- solr单机和集群的部署、以及注意事项
- 基于Docker 分布式部署solrCloud
- SolrCloud-5.2.1 集群部署及测试
- SolrCloud集群部署
- 部署基于tomcat 8 的solrCloud 5.5集群
- SolrCloud集群部署
- spring cloud开发、部署注意事项
- Qizmt 单机及分布式部署注意事项
- solrCloud分布式集群安装配置
- 集群部署及测试SolrCloud-5