首页 文章

在Solr Cloud 模式下将文档添加到集合失败

提问于
浏览
0

我需要将文件夹中的所有文档添加到集合中,但失败了:

这是我的命令:

hostname: mysolr
Solr Admin URL: http://mysolr.net:8983/solr/#/
Collection name: collection_indexer
Collection url: http://mysolr.net:8983/solr/#/collection_indexer_shard1_replica1

数据文件夹:

/tmp/solr_data

运行文件夹:

bash-4.1$ pwd
/opt/cloudera/parcels/CDH/jars

命令:

java -Dtype=application/json -Drecursive -Durl="http://mysolr.net:8983/solr/#/collection_indexer_shard1_replica1/update/json/docs" -jar post.jar /tmp/solr_data

输出:

bash-4.1 $ java -Dtype = application / json -Drecursive -Durl =“http://mysolr.net:8983/solr/#/collection_indexer_shard1_replica1/update/json/docs”-jar post.jar / tmp / solr_data SimplePostTool版本1.5使用content-type application / json将文件发布到基本URL http://mysolr.net:8983/solr/#/collection_indexer_shard1_replica1/update/json/docs ..进入递归模式,最大深度= 999,延迟= 0s索引目录/ tmp / solr_data(1个文件,深度= 0)POSTing文件test.json SimplePostTool:警告:Solr为url返回错误#405(Method Not Allowed):http://mysolr.net:8983 / solr /# collection_indexer_shard1_replica1 / update / json / docs SimplePostTool:警告:响应:Apache Tomcat / 6.0.45 - 错误报告525D76;} - > HTTP状态405 - HTTP方法此URL不支持POST noshade =“noshade”>类型状态报告消息HTTP方法此URL描述不支持POST . 请求的资源不允许使用指定的HTTP方法 . Apache Tomcat / 6.0.45 SimplePostTool:警告:读取响应时出现IOException:java.io.IOException:服务器返回HTTP响应代码:405为URL:http://mysolr.net:8983 / solr /#/collection_indexer_shard1_replica1/update/json索引/ docs 1个文件 . 委托Solr索引更改为http://mysolr.net:8983/solr/#/collection_indexer_shard1_replica1/update/json/docs ..花费的时间:0:00:00.100

我也试过:http://mysolr.net:8983/solr/#/collection_indexer/update/json/docs作为Durl并得到了相同的错误信息 .

请注意,错误消息的结尾似乎提示该错误与url或REST有关,请您澄清这里缺少的内容?

非常感谢你 .

Update 20180415 7:07am EST:

根据MatsLindh在下面的评论,我对命令进行了更改,并使用新命令再次运行

java -Dtype=application/json -Drecursive -Durl="http://dsnyr001d01i1d.nam.nsroot.net:8983/solr/collection_indexer_shard1_replica1/update" -jar post.jar /tmp/solr_data

SimplePostTool版本1.5使用content-type application / json将文件发布到基本URL http://mysolr.net:8983/solr/collection_indexer_shard1_replica1/update . 进入递归模式,max depth = 999,delay = 0s索引目录/ tmp / solr_data(1个文件,深度= 0)POSTing文件test.json SimplePostTool:警告:Solr为url返回错误#400(错误请求):http://mysolr.net:8983 / solr / collect_indexer_shard1_replica1 / update SimplePostTool:警告:响应:{“responseHeader”:{“status”:400,“QTime”:0},“error”:{“metadata”:[“error-class”,“org.apache.solr.common.SolrException”,“ root-error-class“,”org.apache.solr.common.SolrException“],”msg“:”未知命令:region [9]“,”code“:400}} SimplePostTool:警告:读取响应时出现IOException: java.io.IOException:服务器返回HTTP响应代码:400为URL:http://mysolr.net:8983 / solr / collect_indexer_shard1_replica1 / update1索引的文件 . 委托Solr索引更改为http://mysolr.net:8983/solr/collection_indexer_shard1_replica1/update ..花费的时间:0:00:00.100

这次是400错误 .

从Solr Admin我仍然没有看到添加新文档 .

谢谢 .

2 回答

  • 0

    标准HTTP URL中 # 之后的任何部分都是锚,并且意味着在客户端上使用(通常通过滚动到锚点为 id 的元素) . 现在,它更多地用于保持浏览器应用程序的状态(特别是在引入历史状态API之前) .

    重要的是, # 后面的任何内容都不会传输到服务器 - 它只能由客户端用于滚动页面或浏览器中的javascript用于处理状态(在这种情况下 - 您实际看到的页面) .

    由于它从未传输到服务器,因此您最终向 http://mysolr.net:8983/solr/ 发出请求 - 这可能不是您要查询的URL .

    删除锚点并使用实际的集合更新URL: http://mysolr.net:8983/solr/collection_indexer/update/json/docs 应该可以工作 .

    如果您在 Cloud 模式下运行,则不必使用直接核心URL(即使用分片/副本参数) .

  • 0

    最后使用以下步骤对其进行排序(在log / var / log / solr中显示异常):

    1. Manually created new schema file specifically for the data format
    2. Update the instance and the schema
    solrctl instancedir --update
    solrctl collection --reload
    3. make sure the id for each doc is unique
    

    非常感谢MatsLindh的启发 . 非常感谢 .

相关问题