elasticsearch 通过 _reindex迁移远程服务器的索引数据至本地索引

使用kibana连接上es数据库后进程操作


POST _reindex
{
	"source":{
		"index":"remote_persion",
		"size":1000   //可选,每次批量提交1000个,可以提高效率,建议每次提交5-15M的数据
     	"query": {}  // 可选, 不写的默认是全量数据迁移 写上条件就是选择性迁移数据
		"remote":{
				"host":"http://192.168.2.2:19200",
				"username":"aaa",
				"password":"qqq"
				}
			},
	"dest": {
		"index":"local_persion"
	}
}

在迁移过程中,会出现下列错误not whitelisted in reindex.remote.whitelist

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "[ip:9200] not whitelisted in reindex.remote.whitelist"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "[ip:9200] not whitelisted in reindex.remote.whitelaist"
  },
  "status": 400
}

需要在新集群机器elasticsearch.yml配置文件中添加白名单,
白名单表示允许远程指定ip上的es访问我的es
在elasticsearch.yml文件中添加:reindex.remote.whitelist: [“ip:9200”,”ip2:9200”]
注意:1、多个ip地址时用逗号间隔 2、在源es与目标es上都需要进行配置。

reindex.remote.whitelist: 192.168.2.2:9200
Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐