Linux中solr及solr集群的搭建

本文提供Solr单机版及集群的安装步骤,包括解压、启动验证、配置分词器、修改schema.xml等关键操作。

单机版:

1 将solr的jar包导入Linux 并进行解压 tar -zxvf solr-4.10.3.tgz.tgz

2 进入文件 cd solr-4.10.3/bin 运行solr ./solr start -p 8080 ps -ef|grep solr 查看solr进行是否存在

3 测试是否能运行 本地LinuxIP:8080/solr

4 如果能运行 关闭solr ./solr stop -p 8080 需按照需求配置配置文件 将分词器 IKAnalyzer2012FF_u1.jar 放入solr文件夹下的example/solr-webapp/webapp/WEB-INF/lib

在WEB-INF下创建classes文件夹

将分词器的配置文件 mydict.dic ext_stopword.dic IKAnalyzer.cfg.xml 放入solr文件夹下的example/solr-webapp/webapp/WEB-INF/classes

5

修改Solr下的schema.xml文件,添加FieldType:

vim /usr/local/solr-4.10.3/exammple/solr/collection1/conf/schema.xml

将下列文件添加至此配置文件中

<fieldType name="text_ik" class="solr.TextField">
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
</fieldType>

<field name="item_title" type="text_ik" indexed="true" stored="true"/>
<field name="item_sell_point" type="text_ik" indexed="true" stored="true"/>
<field name="item_price" type="long" indexed="true" stored="true"/>
<field name="item_image" type="string" indexed="false" stored="true" />
<field name="item_category_name" type="string" indexed="true" stored="true" />
<field name="item_desc" type="text_ik" indexed="true" stored="false" />

<field name="item_keywords" type="text_ik" indexed="true" stored="false" multiValued="true"/>
<copyField source="item_title" dest="item_keywords"/>
<copyField source="item_sell_point" dest="item_keywords"/>
<copyField source="item_category_name" dest="item_keywords"/>
<copyField source="item_desc" dest="item_keywords"/>

保存退出

5 进入solr下的bin目录 运行solr ./solr start -p 8080

6 测试是否能运行 本地LinuxIP:8080/solr

 

 

solrCloud solr集群
在/usr/local下 创建文件夹 solrCloud
将配置完整的solr-4.10.3复制三份 放入solrCloud 名字为 solr01 solr02 solr03
分别在三个文件下执行
./solr01/bin/solr start -c -z zookeeper的IP地址:2181 -p 自定义端口
测试是否连得通 
本地LinuxIP:8080/solr 点击页面左边列表中的Greph 查看是否成功

转载于:https://www.cnblogs.com/ITniuniu/p/9257618.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值