描述:由于某种原因,我们现有机房需要关停,并且没有新的机房环境,只能使用阿里云Elasticsearch,而我们之前的ES版本比较老,阿里云Elasticsearch版本目前为6.3.2,版本跨度比较多,所以只能通过中间件的方式做一下数据转换,将老数据写入到kafka中,再通过logstash消费kafka中的数据写入到新的ES集群中。
老环境信息
ES集群1.5.2(5个节点)
192.168.100.132
192.168.100.138
192.168.100.142
192.168.100.145
192.168.100.146
logstash 2.4.1
192.168.100.138
kafka_2.11-1.1.0
192.168.100.138
logstash-6.3.2
192.168.100.117
192.168.100.118
192.168.100.119
迁移版本
1.5.2->6.3.2
迁移流程
涉及软件版本
elasticsearch-1.5.2.noarch.rpm
kafka_2.11-1.1.0.tgz
logstash-2.4.1.noarch.rpm
logstash-6.3.2.rpm
注意事项
目前有一个情况是logstash-2.4.1可以向kafka_2.11-0.8.0写入数据,但是logstash-6.3.2无法读取低版本kafka_2.11-0.8.0中的数据,也就是无法进行消费,这是比较坑的。
logstash对kafka也有版本的兼容问题
https://www.elastic.co/guide/en/logstash/6.5/plugins-inputs-kafka.html
This plugin uses Kafka Client 2.0.0.
https://www.elastic.co/guide/en/logstash/6.3/plugins-inputs-kafka.html
This plugin uses Kafka Client 1.1.0
https://www.elastic.co/guide/en/logstash/5.0/plugins-inputs-kafka.html
This plugin uses Kafka Client 0.10.0.1
https://www.elastic.co/guide/en/logstash/2.4/plugins-inputs-kafka.html
This plugin uses Kafka Client 0.8.2.2
https://www.elastic.co/guide/en/logstash/2.3/plugins-inputs-kafka.html
注意:
```
Kafka Client Version Logstash Version Plugin Version Security Features Why?
kafka 0.8 对应 logstash 2.0.0 - 2.x.x<3.0.0 Legacy, 0.8 is still popular
kafka 0.9 对应 logstash 2.0.0 - 2.3.x 3.x.x Basic Auth, SSL
```
经实践使用logstash-2.4.1可以向kafka_2.11-1.1.0中写数据,logstash 6.3.2同时也可以消费kafka 1.1.0中的数据。
1.5.2版本集群上查询索引
查看所有索引
[root@linux]# curl -XGET http://192.168.100.138:9200/_cat/indices | awk '{print $3}'
查看某个索引信息
[root@linux]# curl -XGET http://192.168.100.138:9200/gdbmlogsinfo-2019-04/_settings,_mapping?pretty=true
-----------------分隔线-----------------
{
"gdbmlogsinfo-2019-04" : {
"settings" : {
"index" : {
"creation_date" : "1553014705773