elasticsearch实现远程索引复制

来源:互联网 发布:淘宝客服面试注意事项 编辑:程序博客网 时间:2024/06/05 20:15

1、环境准备

elasticsearch5.x

2、配置文件设置

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

3、es的reindex语句

POST _reindex{  "source": {    "remote": {      "host": "http://10.10.10.102:9200",      "socket_timeout": "30s",      "connect_timeout": "30s"    },    "index": "voice2017-11",    "size": 1000,    "query": {}  },  "dest": {    "index": "voice2017-11"  }}

4、参数解释

source:{    host:源es的ip与端口    socket_timeout:读取超时时间    connect_timeout:连接超时时间    index:源索引名字    size:批量抓取的size大小    (从远程服务器重新编译使用默认最大大小为100MB的堆缓冲区。如果远程索引包含非常大的文档,则需要使用较小的批量)    query:查询指定条件下的字段}dest:{    index:当前索引名字}

5、查询结果

{  "took": 1867,  "timed_out": false,  "total": 322,  "updated": 322,  "created": 0,  "deleted": 0,  "batches": 4,  "version_conflicts": 0,  "noops": 0,  "retries": {    "bulk": 0,    "search": 0  },  "throttled_millis": 0,  "requests_per_second": -1,  "throttled_until_millis": 0,  "failures": []}
原创粉丝点击