es 将一个服务器某个索引数据复制到另一个服务器

前提:1、有es服务器 A、B两台,A上有index1及此index下全部数据 需要复制到B上

2、由于启动es不能用root用户,所以创建了esuser:esuser用户 (用户组:用户名)

步骤:

一、去A找到此索引的存储位置文件夹 /wenjianjia,并复制到B的数据存储位置

1、找到次索引的uuid

2、去文件路径找对应的文件夹

3、将此文件夹复制到B服务器es存储data路径

二、将B服务器上文件夹 /wenjianjia的esuser管理用户权限设置为读写

由于文件夹 /wenjianjia是复制过来的,esuser用户没有写权限,此时要将文件夹设置文可读写

①此时linux账户为es,切换为root账户:su root

②在root下执行:chown -R esuser:esuser /wenjianjia

解释:将esuser组下的esuser设置为文件夹拥有者

再执行: chown 777  /wenjianjia

三、B服务器运行以下请求,进行数据重新均衡分配

关闭重启分片分配

#关闭
curl -H "Content-Type: application/json" -XPUT http://192.168.0.213:9200/_cluster/settings -d'
{
  "persistent": {
    "cluster.routing.allocation.enable": "none"
  }
}'


#重启
curl -H "Content-Type: application/json" -XPUT http://192.168.0.213:9200/_cluster/settings -d'
{
  "persistent": {
    "cluster.routing.allocation.enable": "all"
  }
}'

关闭重启数据自动均衡

#关闭
curl -H "Content-Type: application/json" -XPUT http://192.168.0.213:9200/_cluster/settings -d'
{
    "transient" : {
        "cluster.routing.allocation.enable" : "none"
    }
}'


#重启
curl -H "Content-Type: application/json" -XPUT http://192.168.0.213:9200/_cluster/settings -d'
{
    "transient" : {
        "cluster.routing.allocation.enable" : "all"
    }
}'

四、重启es服务器

 

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值