Mar*_*uth 1 indexing solr bigdata
我正在考虑将我的数据源分块以便将优化数据导入到solr中,并且想知道是否可以使用将数据分块的主URL.
例如文件1可能有
<chunks>
<chunk url="http://localhost/chunker?start=0&stop=100" />
<chunk url="http://localhost/chunker?start=100&stop=200" />
<chunk url="http://localhost/chunker?start=200&stop=300" />
<chunk url="http://localhost/chunker?start=300&stop=400" />
<chunk url="http://localhost/chunker?start=400&stop=500" />
<chunk url="http://localhost/chunker?start=500&stop=600" />
</chunks>
Run Code Online (Sandbox Code Playgroud)
每个块网址都会导致类似的内容
<items>
<item data1="info1" />
<item data1="info2" />
<item data1="info3" />
<item data1="info4" />
</iems>
Run Code Online (Sandbox Code Playgroud)
我正在处理5亿多条记录,因此我认为数据需要分块以避免内存问题(在使用SQLEntityProcessor时遇到这种情况).我还想避免提出超过500万的网络请求,因为我认为这可能会变得昂贵
由于互联网上缺少示例,我想我会发布我最终使用的内容
<?xml version="1.0" encoding="utf-8"?>
<result>
<dataCollection func="chunked">
<data info="test" info2="test" />
<data info="test" info2="test" />
<data info="test" info2="test" />
<data info="test" info2="test" />
<data info="test" info2="test" />
<data info="test" info2="test" />
<data hasmore="true" nexturl="http://server.domain.com/handler?start=0&end=1000000000&page=1&pagesize=10"
</dataCollection>
</result>
Run Code Online (Sandbox Code Playgroud)
重要的是要注意我使用指定下一页上有更多内容并提供下一页的URL.这与DataImportHandlers的Solr文档一致.请注意,文档指定分页Feed应该告诉系统它有更多以及在哪里获得下一批.
<dataConfig>
<dataSource name="b" type="URLDataSource" baseUrl="http://server/" encoding="UTF-8" />
<document>
<entity name="continue"
dataSource="b"
url="handler?start=${dataimport.request.startrecord}&end=${dataimport.request.stoprecord}&pagesize=100000"
stream="true"
processor="XPathEntityProcessor"
forEach="/result/dataCollection/data"
transformer="DateFormatTransformer"
connectionTimeout="120000"
readTimeout="300000"
>
<field column="id" xpath="/result/dataCollection/data/@info" />
<field column="id" xpath="/result/dataCollection/data/@info" />
<field column="$hasMore" xpath="/result/dataCollection/data/@hasmore" />
<field column="$nextUrl" xpath="/result/dataCollection/data/@nexturl" />
</entity>
</document>
Run Code Online (Sandbox Code Playgroud)
注意$ hasMore和$ nextUrl字段.您可能希望放置超时.我还建议允许指定页面大小(它有助于使用tweeking设置来获得最佳处理速度).我使用四核Xeon处理器和32GB内存的单一服务器上的多核(3)solr实例索引@约12.5K记录/秒.
分页结果的应用程序使用与存储数据的SQL服务器相同的系统.当我们最终对solr服务器进行负载均衡时,我也会通过开始和停止位置来最小化配置更改....
| 归档时间: |
|
| 查看次数: |
2451 次 |
| 最近记录: |