Elasticsearch到底能玩excel处理多大的数据量量

博客分类:
1. 多线程程序插入,可以根据服务器情况开启多个线程index
速度可以提高n倍, n&=2
2. 如果有多台机器,可以以每台设置n个shards的方式,根据业务情况,可以考虑取消replias
curl -XPUT 'http://10.1.*.*:9200/dw-search/' -d '{
&&& "settings" : {
&&&&&&& "number_of_shards" : 20,
&&&&&&& "number_of_replicas" : 0
&&& }
}'
这里设置20个shards, 复制为0,如果需要replicas,可以完成index后再修改为replicas&=1
原文:http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html
3. 提高ES占用内存
内存适当调大,初始是256M, 最大1G,
调大后,最小和最大一样,避免GC, 并根据机器情况,设置内存大小,
$ bin/elasticsearch -f -Xmx4g -Xms4g -Des.index.storage.type=memory
原文:http://www.elasticsearch.org/guide/reference/setup/installation.html
4. 减少shard刷新间隔
curl -XPUT 'http://10.1.*.*:9200/dw-search/_settings' -d '{
&&& "index" : {
&&&&&&& "refresh_interval" : "-1"
&&& }
}'
完成bulk插入后再修改为初始值
curl -XPUT 'http://10.1.*.*:9200/dw-search/_settings' -d '{
&&& "index" : {
&&&&&&& "refresh_interval" : "1s"
&&& }
}'
5. 设置一个shard的段segment最大数
可以减少段文件数,提高查询速度
curl -XPOST 'http://10.1.*.*:9200/dw-search/_optimize?max_num_segments=5'
注意:有时候可能需要多次执行
原文:http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html
原文:http://www.elasticsearch.org/guide/reference/index-modules/merge.html
6. 去掉mapping中_all域
Index中默认会有_all的域,这个会给查询带来方便,但是会增加索引时间和索引尺寸
"_all" : {"enabled" : false}
原文:http://www.elasticsearch.org/guide/reference/mapping/all-field.html
curl -XPOST 'http://10.1.*.*:9200/dw-search/pt_normal/_mapping' --data-binary @pt_normal_properties.mapping
7. 设置source为压缩模式或者disable
compress=true这个能大大减少index的尺寸
disable将直接没有_source域
8. 增加merge.policy.merge_factor数
设置merge.policy.merge_factor到30,初始是10
增加这个数需要更多的内存,bulk index可以调大这个值.
如果是即时索引,应该调小这个值
原文:http://www.elasticsearch.org/guide/reference/index-modules/merge.html
9. 修改Client获得方式为
Node node = nodeBuilder().client(true).node();
Client client = node.client()
相比transport client更快
测试效果,速度提高不明朗,且报错。去除
浏览 35910
zhousheng29
浏览: 107673 次
来自: 上海
每个doc多大?多少个字段?
楼主你优化后,索引速度最高能达到每秒多少记录
做成公共服务的话,别的应用调用的话,应该怎么设计?如果通过接口 ...
写的不错~~~
你好,看您讲解的很专业,现在遇到了几个问题,您若知道的话还请不 ...
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'Access denied |
used Cloudflare to restrict access
Please enable cookies.
What happened?
The owner of this website () has banned your access based on your browser's signature (3ad6f8bf350c539c-ua98).ElasticSearch大批量数据入库 - 追逐的博客 - CSDN博客
ElasticSearch大批量数据入库
ElasticSearch
1.bulk批量导入数据
curl 172.17.1.15:9200/_bulk?pretty --data-binary @E:\Bin\Debug\testdata\.jsoncurl 172.17.1.15:9200/_bulk?pretty --data-binary @E:\Bin\Debug\testdata\.jsoncurl 172.17.1.15:9200/_bulk?pretty --data-binary @E:\Bin\Debug\testdata\.jsoncurl 172.17.1.15:9200/_bulk?pretty --data-binary @E:\Bin\Debug\testdata\.jsoncurl 172.17.1.15:9200/_bulk?pretty --data-binary @E:\Bin\Debug\testdata\.json
但问题是这方法是先定义一定格式的json文件,然后再用curl命令去执行Elasticsearch的_bulk来批量插入,所以得把数据写进json文件,然后再通过批处理,执行文件插入数据,另外在生成json文件,文件不能过大,过大会报错,所以建议生成10M一个文件
2. github上找到了一个数据导入导出工具
github上找到了一个数据导入导出工具,算是基本上解决了这个问题,直接把数据从原来的index里面取出来然后重新录入到新的index里面,这样省去了数据解析的过程,节约了不少时间。
下面是问题的解决步骤:
首先安装一下elasticsearch-knapsack(数据导入导出工具)
./bin/plugin&-install&knapsack&-url&http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-knapsack/1.5.2.0/elasticsearch-knapsack-1.5.2.0-plugin.zip&&
然后可以通过导出命令导出json格式的数据到系统中的某个文件夹(导出某个index中的数据到指定路径)
curl&-XPOST&'localhost:9200/test/_export?path=/tmp/myarchive.zip'&&
然后运用导入命令将数据导入进elasticsearch里面
[html] view plain copy
curl&-XPOST&'localhost:9200/test/test/_import?path=/tmp/myarchive.zip'&
以下是github地址:
/jprante/elasticsearch-knapsack&
我的热门文章}

我要回帖

更多关于 mysql支持多大数据量 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信