美文网首页
Solr 集群搭建

Solr 集群搭建

作者: 炼心之旅 | 来源:发表于2018-09-05 22:46 被阅读0次

    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 <arg> for linkconfig: name of the collection
    -cmd cmd to run: bootstrap, upconfig, downconfig,
    linkconfig, makepath, put, putfile,get,getfile,
    list, clear, updateacls, ls
    -d,--confdir <arg> for upconfig: a directory of configuration
    files
    -h,--help bring up this help page
    -n,--confname <arg> for upconfig, linkconfig: name of the config
    set
    -name <arg> name of the cluster property to set
    -r,--runzk <arg> run zk internally by passing the solr run port
    - only for clusters on one machine (tests, dev)
    -s,--solrhome <arg> for bootstrap, runzk: solrhome location
    -val <arg> value of the cluster to set
    -x,--excluderegex <arg> for upconfig: files matching this regular
    expression won't be uploaded
    -z,--zkhost <arg> ZooKeeper host address
    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

    相关文章

      网友评论

          本文标题:Solr 集群搭建

          本文链接:https://www.haomeiwen.com/subject/tawzwftx.html