我正在尝试通过 Bluemix solr 索引 nutch 抓取的数据,但无论如何我都找不到这样做。我的主要问题是:有没有人可以帮助我这样做?我应该怎么做才能将我的 nutch 抓取数据的结果发送到我的 Blumix Solr。对于爬行,我使用了 nutch 1.11,这是我现在所做的一部分以及我面临的问题:我认为可能有两种可能的解决方案:
- 通过 nutch 命令:
“NUTCH_PATH/bin/nutch index crawl/crawldb -linkdb crawl/linkdb crawl/ -Dsolr.server.url="OURSOLRURL"”</p>
我可以通过OURSOLR索引nutch爬取的数据。但是,我发现了一些问题。
a-虽然听起来很奇怪,但它无法接受 URL。我可以改用 URL 的编码来处理它。
b-由于我必须连接到特定的用户名和密码,nutch 无法连接到我的 solr。考虑到这一点:
Active IndexWriters :
SolrIndexWriter
solr.server.type : Type of SolrServer to communicate with (default 'http' however options include 'cloud', 'lb' and 'concurrent')
solr.server.url : URL of the Solr instance (mandatory)
solr.zookeeper.url : URL of the Zookeeper URL (mandatory if 'cloud' value for solr.server.type)
solr.loadbalance.urls : Comma-separated string of Solr server strings to be used (madatory if 'lb' value for solr.server.type)
solr.mapping.file : name of the mapping file for fields (default solrindex-mapping.xml)
solr.commit.size : buffer size when sending to Solr (default 1000)
solr.auth : use authentication (default false)
solr.auth.username : username for authentication
solr.auth.password : password for authentication
在命令行输出中,我尝试通过使用命令“solr.auth=true solr.auth.username="SOLR-UserName" solr.auth.password="Pass" 的身份验证参数来管理这个问题。
所以到目前为止,我必须使用这个命令:
”bin/nutch index crawl/crawldb -linkdb crawl/linkdb crawl/segments/2016* solr.server.url="https%3A%2F%2Fgateway.watsonplatform.net%2Fretrieve-and-rank%2Fapi%2Fv1%2Fsolr_clusters% 2FCLUSTER-ID%2Fsolr%2Fadmin%2Fcollections" solr.auth=true solr.auth.username="USERNAME" solr.auth.password="PASS"“。
但是由于某种我还没有意识到的原因,该命令将身份验证参数视为已抓取的数据目录并且不起作用。所以我想这不是“Active IndexWriters”的正确方法,谁能告诉我那我该怎么办?
- 通过 curl 命令:
“curl -X POST -H "Content-Type: application/json" -u "BLUEMIXSOLR-USERNAME":"BLUEMIXSOLR-PASS" " https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/ solr_clusters/CLUSTERS-ID/solr/example_collection/update " --data-binary @{/path_to_file}/FILE.json"</p>
我想也许我可以提供这个命令创建的 json 文件:
bin/nutch commoncrawldump -outputDir finalcrawlResult/ -segment crawl/segments -gzip -extension json -SimpleDateFormat -epochFilename -jsonArray -reverseKey 但是这里有一些问题。
一个。此命令在复杂的路径中提供了如此多的文件,这将花费大量时间来手动发布所有这些文件。我猜对于大的 cawling 来说这甚至是不可能的。有没有办法通过一个命令一次发布目录及其子目录中的所有文件?
湾。在 commoncrawldump 创建的 json 文件的开头有一个奇怪的名称“ÙÙ÷yœ”。
C。我删除了奇怪的名称并尝试仅发布其中一个文件,但结果如下:
{"responseHeader":{"status":400,"QTime":23},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"Unknown command 'url' at [9]","code":400}}
这是否意味着这些文件不能提供给 Bluemix solr 并且对我来说毫无用处?