SOLR

脚本执行:

单机:bin/slor start

修改solr配置文件:vim solr.in.sh

注意点

名称搜索空格用+代替: Luxury+Tempered

fq:加速缓存查询

fl:过滤查询字段

[]包含头尾 {}不包含头尾,()用于构成子查询

SOLR安装常见问题

更新zk配置文件(managed-schema|data-config.xml)

./../../../scripts/cloud-scripts/zkcli.sh -z localhost:2181,localhost:2182,localhost:2183 -cmd putfile /configs/wish_item/data-config.xml /Users/zhanxf/hadoop/solr-5.3.1_copy/server/solr/erp_wish_item1/conf/data-config.xml

solr.in.sh集群配置(集群配置jvm配置内存至少1G)

ZK_HOST="localhost:2181,localhost:2182,localhost:2183"

SOLR_JAVA_MEM="-Xms1G -Xmx1G”

将附加jar复制到solr-webapp/WEB-INFO/lib目录下

mmseg4j-core-1.10.0.jar

mmseg4j-solr-2.3.0.jar

mysql-connector-java-5.1.18-bin.jar

solr-dataimporthandler-5.3.1.jar

solr-dataimporthandler-extras-5.3.1.jar

伪分布式zk节点数至少3个集群才能生效

创建集合

自动路由

./bin/solr create_collection -c wish_item -d /Users/zhanxf/hadoop/solr-5.3.1_copy/server/solr/erp_wish_item1/conf -s 2 -rf 1

手动路由

curl http://localhost:8983/solr/admin/collections?action=CREATE&name=wish_item&router.name=implicit&shards=shard1,shard2,shard3,shard4,shard5,shard6&maxShardsPerNode=6

删除集合

curl http://localhost:8983/solr/admin/collections?action=DELETE&name=wish_item

编写solr插件问题

1.编译失败,上传下面2个jar到本地maven仓库

mvn install:install-file -DgroupId=org.apache.solr.handler.dataimport -DartifactId=solr-dataimporthandler -Dversion=5.3.1 -Dpackaging=jar -Dfile=solr-dataimporthandler-5.3.1.jar

mvn install:install-file -DgroupId=org.restlet.jee -DartifactId=org.restlet -Dversion=2.3.0 -Dpackaging=jar -Dfile=org.restlet-2.3.0.jar

mvn install:install-file -DgroupId=org.restlet.jee -DartifactId=org.restlet.ext.servlet -Dversion=2.3.0 -Dpackaging=jar -Dfile=org.restlet.ext.servlet-2.3.0.jar

线上问题排查常用命令

grep "concurrent mode failure" solr_gc_log_20170711_* | wc -l

jstat -gcutil 15611 5000 10

jstack 15611

集群搜索整理

单片搜索

http://localhost:8983/solr/testimplicit_shard1_replica1/select?q=*%3A*&wt=json&indent=true&debugQuery=true&shards=shard2

线上操作(集群环境)

虚拟机内存设置

SOLR_HEAP="12288M"

SOLR_JAVA_MEM="-Xms12288m -Xmx12288m"

SOLR_TIMEZONE="GMT+08:00”

上传宝贝配置文件

sh /data/project/solr-5.3.1/server/scripts/cloud-scripts/zkcli.sh -z zoo6.superboss.cc:30004,zoo5.superboss.cc:30004,zoo4.superboss.cc:30004 -cmd putfile /configs/wish_item/data-config.xml /data/project/wish_item_conf/data-config.xml

上传店铺配置文件

sh /data/project/solr-5.3.1/server/scripts/cloud-scripts/zkcli.sh -z zoo6.superboss.cc:30004,zoo5.superboss.cc:30004,zoo4.superboss.cc:30004 -cmd putfile /configs/wish_merchant/data-config.xml /data/project/wish_merchant_conf/data-config.xml

创建店铺core

sh solr create_collection -c wish_merchant -d /data/project/wish_merchant_conf

创建宝贝core

curl "http://121.41.43.155:30005/solr/admin/collections?action=CREATE&name=wish_item&router.name=implicit&shards=shard1,shard2,shard3,shard4,shard5,shard6&maxShardsPerNode=6”

关联配置文件和core

sh /data/project/solr-5.3.1/server/scripts/cloud-scripts/zkcli.sh -z zoo6.superboss.cc:30004,zoo5.superboss.cc:30004,zoo4.superboss.cc:30004 -cmd linkconfig -collection wish_item -confname wish_item

上传配置文件到zk

sh /data/project/solr-5.3.1/server/scripts/cloud-scripts/zkcli.sh -z zoo6.superboss.cc:30004,zoo5.superboss.cc:30004,zoo4.superboss.cc:30004 -cmd upconfig -confdir /data/project/wish_item_conf -confname wish_item

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 两年前用过solr5.1版本的,当时只是简单入个门,拿来在项目里建个全文索引,然后再query,其他什么也没做,还...
    Coselding阅读 3,220评论 3 22
  • solr 数据同步,全量、增量方式 DIH全量同步(全表数据)(一般做第一次数据同步) 首先创建对应的数据库表 s...
    逐暗者阅读 15,298评论 1 26
  • Solr是什么? Solr 是Apache下的一个顶级开源项目,采用Java开发,它是基于Lucene的全文搜索服...
    FTOLsXD阅读 798评论 0 4
  • 1 准备工作及相关介绍 solr和lucene的版本是同步更新的,最新版本是6.5.0。本案例使用4.10.3 j...
    阿太哥阅读 2,408评论 1 5
  • 这个章节只整理一下solr集群的部署方法 solr提供集群模式的example 打开cmd,进入solr文件夹下的...
    熙熙爸爸阅读 1,478评论 0 3

友情链接更多精彩内容