elasticsearch reindex步骤

1.从old-cluster中查出template,然后在new-cluster中导入template:

curl -X PUT "http://new-ip:9200/_template/template_name" -H "Content-Type: application/json" -d 'template内容'

2.创建index:

curl -X PUT "http://new-ip:9200/index_name"

3.按照官方指导将refresh_interval设置为-1,number_of replica设置为0

curl -X PUT -u username:password "http://new-ip:9200/_settings?pretty" -H 'Content-Type: application/json' -d '
{
    "index" : {
        "number_of_replicas" : 0
    }
}
'


curl -X PUT -u username:password "http://new-ip:9200/_settings?pretty" -H 'Content-Type: application/json' -d '
{
    "index" : {
        "refresh_interval" : "-1"
    }
}
'

4.在new-cluster的机器上的elasticsaerch.yml中添加如下配置,然后重启new cluster:

reindex.remote.whitelist: old-ip:9200

5.执行reindex:

curl -X PUT "http://new-ip:9200/_reindex?wait_for_completion=false" -H 'Content-Type: application/json' -d '
{
    "source": {
        "remote": {
            "host": "http://old-ip:9200",
            "username": "xxx",
            "password": "xxxx"
        },
        "index": "index-on-old-cluster",
        "size": 10
    },
    "dest": {
        "index": "index-on-new-cluster"
    }
}
'

6.执行上一步时会返回一个task_id,我们可以根据task_id查看reindex的进度:

http://new-ip:9200/_task/taskid

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

QYHuiiQ

听说打赏的人工资翻倍~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值