注意事项: Solr设备 Hello World

试用 Solr-4.10.2


一 shards, 这两款机器

一是垃圾 rm -r example/solr/collection1/data/*

启动一个 node

cd example

java -Dbootstrap_confdir=./solr/collection1/conf -Dcollection.configName=myconf -DzkRun -DnumShards=1 -jar start.jar

提交一篇文档

cd exampledocs
java -Durl=http://localhost:8983/solr/collection1/update -jar post.jar monitor.xml


去 http://10.15.4.173:8983/solr/#/~cloud  查询一下文件






看下 cloud 的结构



启动 node 2 再看下 clould的结构
java -DzkHost=10.15.4.173:9983 -jar start.jar



两个 shards, 两台机器

在一台机器上做以下操作

首先清理环境。把solor文件夹删除,又一次解压 tgz文件

cp -r example example2

启动一个node

cd example
java -Dbootstrap_confdir=./solr/collection1/conf -Dcollection.configName=myconf -DzkRun -DnumShards=2 -jar start.jar -Dhost=10.15.4.173

cd example2

java -Djetty.port=7574  -DzkHost=10.15.4.173:9983 -Dhost=10.15.4.173 -jar start.jar   


在还有一台机器上进行以下操作

cp -r example example2

启动一个node

cd example
java  -DzkHost=10.15.4.173:9983 -Dhost=10.15.4.207 -jar start.jar   

cd example2

java -Djetty.port=7574  -DzkHost=10.15.4.173:9983 -Dhost=10.15.4.207 -jar start.jar   





这个时候假设把10.15.4.173:8983 (第一个启动的服务) kill 掉。其它三个服务都不能工作了(不停connect).

据说在用类似 -DzkHost=10.15.4.173:9983,10.15.4.209:8574。 能够实现自己主动服务替代,但还没有实验成功。


ref

http://heliosearch.org/solr/getting-started/
https://wiki.apache.org/solr/SolrCloud



版权声明:本文博主原创文章,博客,未经同意不得转载。

原文地址:https://www.cnblogs.com/zfyouxi/p/4855025.html