参考文档
- https://cloud.tencent.com/document/product/845/35568
- https://help.aliyun.com/document_detail/170095.html
- https://bbs.huaweicloud.com/blogs/detail/265963
- https://elasticsearch.cn/question/6648
- https://juejin.cn/post/6844903753322102798
- https://www.cnblogs.com/fancyBrain/p/13614082.html
- https://blog.csdn.net/laoyang360/article/details/113361967
- https://www.elastic.co/guide/en/logstash/current/plugins-inputs-elasticsearch.html#plugins-inputs-elasticsearch-socket_timeout_seconds
- https://www.elastic.co/guide/en/logstash/6.8/plugins-inputs-elasticsearch.html
- https://blog.csdn.net/w903328615/article/details/115404900
主机
- 老ES: http://10.20.41.30:9200
- 新ES: http://10.194.98.4:9200
- Logstash: 10.194.98.3
索引梳理
名称 | UUID | Lucene 文档 | 储存空间 |
---|---|---|---|
ci_thesis | OJeVZnhkSJiMTNw0TmViuA | 24503853 | 84 GB |
cnki-data | S8JyLIldR4C3ikH2jq_qUQ | 12432339 | 48.8 GB |
elantender | vKC7Iv8lQQeO1i3iYCT-PA | 307 | 6.66 MB |
elantender2 | hfut5RfWSo-2VT8S72ytxw | 2564581 | 58.5 GB |
elantender3 | XQ-qAY_NSjuYK2b17FUkmg | 800 | 16 MB |
ieee-data | K3juwXaKQVW-0J72NiJ5Pw | 2774971 | 32.1 GB |
lunwen-cn | 7bQJ8sE4Tvi5L8aBQvfzeg | 12340949 | 47.3 GB |
policies | AxRTd-uVQ_q6C4iw9l9soA | 472817 | 13.9 GB |
policies_hydrabot | EO4sAmmVQ2m_-PyczXOczQ | 2099896 | 92.8 GB |
rc_patents2 | DBSI6NwEQyaf92Kscl0ciw | 25016403 | 132 GB |
springer-data | SjopLNkNRXmEQWfGw5B2LA | 2416686 | 29.4 GB |
优化
vi /etc/logstash/logstash.yml
1 | pipeline.batch.size: 1000 |
vi /etc/logstash/jvm.options
1 | -Xms8g |
模板1
1 | input { |
模板2
1 | input { |
模板3
1 | input { |
执行
1 | /data/logstash-7.15.2/bin/logstash "--path.settings" "/data/logstash-7.15.2/config" -f logstash.conf |
分时间查询迁移
policies_hydrabot
分时段查询:
1 | {"query": {"bool": {"must_not": {"exists": {"field": "createTime"}}}}} 41724 41717 |
踩坑
- jvm.options参数中,将栈内存调到物理内存50%
- logstash.yml参数中,将batch.size调大,降低请求频次,避免output es被写死
- 使用7.X的logstash,可以向下兼容6.X的ES
- 7.X的logstash,可以配置input的timeout参数,避免网络闪断造成的scroll重置,重复插入数据问题
- 7.X的logstash,可以明显降低output es的lucene缓存占用