栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Windows部署集群--elasticsearch

Windows部署集群--elasticsearch

1. 部署集群

(1) 创建 elasticsearch-cluster 文件夹,在内部复制三个 elasticsearch 服务

2) 修改集群文件目录中每个节点的 config/elasticsearch.yml 配置文件

node-1001 节点

#节点 1 的配置信息:
#集群名称,节点之间要保持一致
cluster.name: my-elasticsearch
#节点名称,集群内要唯一
node.name: node-1001
node.master: true
node.data: true

#ip 地址
network.host: localhost
#http 端口
http.port: 1001
#tcp 监听端口
transport.tcp.port: 9301

#discovery.seed_hosts: ["localhost:9301", "localhost:9302","localhost:9303"]
#discovery.zen.fd.ping_timeout: 1m
#discovery.zen.fd.ping_retries: 5

#集群内的可以被选为主节点的节点列表
#cluster.initial_master_nodes: ["node-1", "node-2","node-3"]

#跨域配置
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"

node-1002 节点

#节点 2 的配置信息:
#集群名称,节点之间要保持一致
cluster.name: my-elasticsearch
#节点名称,集群内要唯一
node.name: node-1002
node.master: true
node.data: true

#ip 地址
network.host: localhost
#http 端口
http.port: 1002
#tcp 监听端口
transport.tcp.port: 9302

discovery.seed_hosts: ["localhost:9301"]
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5

#集群内的可以被选为主节点的节点列表
#cluster.initial_master_nodes: ["node-1", "node-2","node-3"]

#跨域配置
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"

node-1003 节点

#节点 3 的配置信息:
#集群名称,节点之间要保持一致
cluster.name: my-elasticsearch

#节点名称,集群内要唯一
node.name: node-1003
node.master: true
node.data: true

#ip 地址
network.host: localhost
#http 端口
http.port: 1003
#tcp 监听端口
transport.tcp.port: 9303

#候选主节点的地址,在开启服务后可以被选为主节点
discovery.seed_hosts: ["localhost:9301", "localhost:9302"]
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5

#集群内的可以被选为主节点的节点列表
#cluster.initial_master_nodes: ["node-1", "node-2","node-3"]

#跨域配置
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
2. 启动集群

1) 启动前先删除每个节点中的 data 目录中所有内容(如果存在)

2) 依次双击执行node-1001 ,node-1002,node-1003的 bin/elasticsearch.bat, 启动节点服务器,启动后,会自动加入指定名称的集群

3. 测试集群 3.1 查看集群状态

http://127.0.0.1:1001/_cluster/health
http://127.0.0.1:1002/_cluster/health
http://127.0.0.1:1003/_cluster/health

3.2 增加, 查询索引

向集群中的 node-1001 节点增加索引
http://127.0.0.1:1001/user

在集群中的 node-1002, node-1003节点查询索引
http://127.0.0.1:1002/_cat/indices?v
http://127.0.0.1:1003/_cat/indices?v


        
【】

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/784892.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号