zookeeper配置
1.下载zookeeper,解压
2.conf同级目录新建data, log两个文件夹
3.data中新建myid文件,内容分别存放server的名称(1,2,3)(对应zoo.zfg中的server.1,server.2,server.3)
4.进入conf文件夹,拷贝zoo.example.zfg文件为zoo.zfg
5.修改zoo.zfg文件:
dataDir=XXX/XXX/zookeeper-3.4.10/data
dataLogDir=XXX/XXX/zookeeper-3.4.8/log
clientPort=2181
server.1=zooserver01:2888:3888
server.2=zooserver02:2888:3888
server.3=zooserver03:2888:3888
solr配置
1.下载solr,解压
2.修改bin下的solr.ini.cmd
ZK_HOST="zooserver01:2181,zooserver02:2181,zooserver03:2181"
去掉 ZK_CLIENT_TIMEOUT 的注释
3.上传configset,进入下面目录:7.4/server/server/scripts/cloud-scripts,执行命令
./zkcli.sh -zkhost zooserver01:2181,zooserver02:2181,zooserver03:2181 -cmd upconfig -confdir 7.4/server/server/solr/configsets/default/conf -confname default
4.修改solr.xml, 进入目录:7.4/server/solr/solr.xml
host改为域名或IP
5.zookeeper集群操作上传的文件
进入zookeeper的bin下
./zkCli.sh 连接zookeeper集群
ls /configs/myconf 查看上传的配置文件
delete /configs/myconf/solrconfig.xml 删除文件
delete /configs/myconf 删除空文件夹
get /configs/myconf/solrconfig.xml 查看文件内容
rmr /configs/myconf 递归删除(慎重使用)
6.启动solr集群
进入 solr-5.5.3下
./bin/solr restart
7.操作collection
a.创建collection
http://192.168.17.142:8983/solr/admin/collections?action=CREATE&name=test&numShards=3&replicationFactor=3&maxShardsPerNode=3&collection.configName=myconf
b.删除
http://192.168.17.142:8983/solr/admin/collections?action=DELETE&name=test
c.重新加载
http://192.168.17.143:8983/solr/admin/collections?action=RELOAD&name=test
***Zookeeper命令
-c,--collection
-cmd cmd to run: bootstrap, upconfig, downconfig,
linkconfig, makepath, put, putfile,get,getfile,
list, clear, updateacls, ls
-d,--confdir
files
-h,--help bring up this help page
-n,--confname
set
-name
-r,--runzk
- only for clusters on one machine (tests, dev)
-s,--solrhome
-val
-x,--excluderegex
expression won't be uploaded
-z,--zkhost
Examples:
zkcli.sh -zkhost localhost:9983 -cmd bootstrap -solrhome /opt/solr
zkcli.sh -zkhost localhost:9983 -cmd upconfig -confdir /opt/solr/collection1/conf -confname myconf
zkcli.sh -zkhost localhost:9983 -cmd downconfig -confdir /opt/solr/collection1/conf -confname myconf
zkcli.sh -zkhost localhost:9983 -cmd linkconfig -collection collection1 -confname myconf
zkcli.sh -zkhost localhost:9983 -cmd makepath /apache/solr
zkcli.sh -zkhost localhost:9983 -cmd put /solr.conf 'conf data'
zkcli.sh -zkhost localhost:9983 -cmd putfile /solr.xml /User/myuser/solr/solr.xml
zkcli.sh -zkhost localhost:9983 -cmd get /solr.xml
zkcli.sh -zkhost localhost:9983 -cmd getfile /solr.xml solr.xml.file
zkcli.sh -zkhost localhost:9983 -cmd clear /solr
zkcli.sh -zkhost localhost:9983 -cmd list
zkcli.sh -zkhost localhost:9983 -cmd ls /solr/live_nodes
zkcli.sh -zkhost localhost:9983 -cmd clusterprop -name urlScheme -val https
zkcli.sh -zkhost localhost:9983 -cmd updateacls /solr
zkcli.sh -zkhost localhost:9983 -cmd getfile /security.json security.json