zoukankan      html  css  js  c++  java
  • SolrCloud 5.5.5 + Zookeeper + HDFS使用

    安装sol r

    三个节点192.168.1.231,192.168.1.234,192.168.1.235

    下载安装包solr.tar.gz

    解压 tar -zxvf solr.tar.gz

    配置ZK

    编辑solr.in.sh

    修改ZK_HOST

    ZK_HOST="192.168.1.231:2181,192.168.1.232:2181,192.168.1.233:2181"

    修改SOLR_HOST(所在节点主机IP)

    SOLR_HOST="192.168.1.235"

    启动

    /bin/solr start

    浏览器请求 192.168.1.231:8983

    索引数据存本地模式

    使用ZK管理Solr的配置文件

    准备配置文件

    在server/solr/configsets下新建文件夹tag_configs,将configsets下的basic_configs/conf拷贝到tag_configs下

    修改managed-schema

    <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="rowkey" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="tags" type="string" indexed="true" stored="true" required="true" multiValued="true" />

    上传配置文件到ZK

    /usr/local/test/solr-5.5.5/server/scripts/cloud-scripts/zkcli.sh -zkhost 192.168.1.231:2181, 192.168.1.232:2181, 192.168.1.233:2181
    -cmd upconfig -confdir /usr/local/test/solr-5.5.5/server/solr/configsets/tag_configs/conf -confname tagCollection

    创建Collection

    curl "http://192.168.1.235:8983/solr/admin/collections
    ?action=CREATE&name=tagCollection&numShards=3&replicationFactor=3&maxShardsPerNode=3&collection.configName=tagCollection"

    成功后浏览器查看

    成功。

    补充

    ZK删除配置文件

    [root@node-231 ~]# /usr/hdp/2.6.1.0-129/zookeeper/bin/zkCli.sh
    [zk: localhost:2181(CONNECTED) 1] ls /configs
    [tagcollection, tagCollection, test]
    [zk: localhost:2181(CONNECTED) 3] rmr /configs/tagcollection

    删除collection

    http://192.168.1.235:8983/solr/admin/collections?action=DELETE&name=tagcollection
    

    数据索引存储在HDFS

    准备配置文件

    在以上基础上修改solrconfig.xml

    找到<directoryFactory>标签,修改如下

    <directoryFactory name="DirectoryFactory" class="solr.HdfsDirectoryFactory">
       <str name="solr.hdfs.confdir">/etc/hadoop/conf</str>
       <str name="solr.hdfs.home">hdfs://mycluster/solr</str>
       <bool name="solr.hdfs.blockcache.enabled">true</bool>
       <int name="solr.hdfs.blockcache.slab.count">1</int>
       <bool name="solr.hdfs.blockcache.direct.memory.allocation">true</bool>
       <int name="solr.hdfs.blockcache.blocksperbank">16384</int>
       <bool name="solr.hdfs.blockcache.read.enabled">true</bool>
       <bool name="solr.hdfs.nrtcachingdirectory.enable">true</bool>
       <int name="solr.hdfs.nrtcachingdirectory.maxmergesizemb">16</int>
       <int name="solr.hdfs.nrtcachingdirectory.maxcachedmb">192</int>
    </directoryFactory>

    solr.hdfs.confdir参数是Hadoop配置文件路径

    solr.hdfs.home参数是solr的索引数据所存放的位置

    注意:此处如果使用nameservice(mycluster),则必须要指定solr.hdfs.confdir,否则会报错

    如果不加solr.hdfs.confdir,solr.hdfs.home需要配置为192.168.1.231:8020的形式。

    将<lockType>${solr.lock.type:native}</lockType>
 修改为


    <lockType>${solr.lock.type:hdfs}</lockType>

    接下来操作和上边一样,上传配置文件到ZK,创建collection。

  • 相关阅读:
    nullnullConnecting with WiFi Direct 与WiFi直接连接
    nullnullUsing WiFi Direct for Service Discovery 直接使用WiFi服务发现
    nullnullSetting Up the Loader 设置装载机
    nullnullDefining and Launching the Query 定义和启动查询
    nullnullHandling the Results 处理结果
    装置输出喷泉装置(贪心问题)
    数据状态什么是事务?
    停止方法iOS CGD 任务开始与结束
    盘文件云存储——金山快盘
    函数标识符解决jQuery与其他库冲突的方法
  • 原文地址:https://www.cnblogs.com/EnzoDin/p/9326294.html
Copyright © 2011-2022 走看看