ElasticSearch分布式集群搭建

ElasticSearch分布式集群搭建

网络配置

主机名称 IP地址
master 192.168.10.110
slave1 192.168.10.111
slave2 192.168.10.112

参数配置

修改master的elasticsearch/config/elasticsearch.yml

$ vim elasticsearch.yml
# 在最下面加入

# 配置跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
# 配置实例名称
cluster.name: elastic
# 配置节点名称
node.name: master
# 是否是主节点
network.host: 192.168.20.110
# 设置集群ip组
discovery.zen.ping.unicast.hosts: ["192.168.20.100", "192.168.20.111","192.168.20.112"]
# 设置最小的主机数
discovery.zen.minimum_master_nodes: 2

修改slave1的elasticsearch/config/elasticsearch.yml

$ vim elasticsearch.yml
# 在最下面加入

# 配置跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
# 配置实例名称
cluster.name: elastic
# 配置节点名称
node.name: master
# 是否是主节点
network.host: 192.168.20.111
# 设置集群ip组
discovery.zen.ping.unicast.hosts: ["192.168.20.100", "192.168.20.111","192.168.20.112"]
# 设置最小的主机数
discovery.zen.minimum_master_nodes: 2

修改slave2的elasticsearch/config/elasticsearch.yml

$ vim elasticsearch.yml
# 在最下面加入

# 配置跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
# 配置实例名称
cluster.name: elastic
# 配置节点名称
node.name: master
# 是否是主节点
network.host: 192.168.20.112
# 设置集群ip组
discovery.zen.ping.unicast.hosts: ["192.168.20.100", "192.168.20.111","192.168.20.112"]
# 设置最小的主机数
discovery.zen.minimum_master_nodes: 2

启动集群

清空三台机器elasticsearch目录下data和logs文件夹下文件,依次启动master,slave1,slave2

$ ./bin/elasticsearch

你可能感兴趣的:(搜索引擎)