admin管理员组

文章数量:1558092

前提: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服务器

 

本文标签: 服务器索引数据es