Elasticsearch集群
1、三台机器大家集群
192.168.204.209 elasticsearch.yml
cluster.name: mycluster # 集群名,所有节点node都应配置相同的集群名 node.name: node1 # 本节点名,同一集群下不同的node名字不能重复 node.master: true node.data: true network.host: 0.0.0.0 http.port: 9200 #参数设置一系列符合主节点条件的节点的主机名或 IP 地址来引导启动集群。 cluster.initial_master_nodes: ["node1"] # 设置新节点被启动时能够发现的主节点列表(主要用于不同网段机器连接) discovery.zen.ping.unicast.hosts: ["192.168.204.209","192.168.204.203","192.168.204.108"] # 该参数就是为了防止”脑裂”的产生。定义的是为了形成一个集群,有主节点资格并互相连接的节点的最小数目。 discovery.zen.minimum_master_nodes: 2 # 解决跨域问题配置 http.cors.enabled: true http.cors.allow-origin: "*"
192.168.204.203 elasticsearch.yml
cluster.name: mycluster # 集群名,所有节点node都应配置相同的集群名 node.name: node2 # 本节点名,同一集群下不同的node名字不能重复 node.master: true node.data: true network.host: 0.0.0.0 http.port: 9200 cluster.initial_master_nodes: ["node1"] discovery.zen.ping.unicast.hosts: ["192.168.204.209","192.168.204.203","192.168.204.108"] discovery.zen.minimum_master_nodes: 2 http.cors.enabled: true http.cors.allow-origin: "*"
192.168.204.108 elasticsearch.yml
cluster.name: mycluster # 集群名,所有节点node都应配置相同的集群名 node.name: node3 # 本节点名,同一集群下不同的node名字不能重复 node.master: true node.data: true network.host: 0.0.0.0 http.port: 9200 cluster.initial_master_nodes: ["node-1"] discovery.zen.ping.unicast.hosts: ["192.168.204.209","192.168.204.203","192.168.204.108"] discovery.zen.minimum_master_nodes: 2 http.cors.enabled: true http.cors.allow-origin: "*"
0
2、一台机器搭建集群(一)
注意修改jvm.options
 
0
elasticsearch-7.3.2_node1
cluster.name: luban node.name: node-1 node.master: true node.data: true network.host: 0.0.0.0 http.port: 9200 transport.port: 9300 cluster.initial_master_nodes: ["node-1"] discovery.seed_hosts: ["192.168.204.209:9300", "192.168.204.209:9301","192.168.204.209:9302"] discovery.zen.minimum_master_nodes: 2 http.cors.enabled: true http.cors.allow-origin: "*"
elasticsearch-7.3.2_node2
cluster.name: luban node.name: node-2 node.master: true node.data: true network.host: 0.0.0.0 http.port: 9201 transport.port: 9301 cluster.initial_master_nodes: ["node-1"] discovery.seed_hosts: ["192.168.204.209:9300", "192.168.204.209:9301","192.168.204.209:9302"] discovery.zen.minimum_master_nodes: 2 http.cors.enabled: true http.cors.allow-origin: "*"
elasticsearch-7.3.2_node3
cluster.name: luban node.name: node-3 node.master: true node.data: true network.host: 0.0.0.0 http.port: 9202 transport.port: 9302 cluster.initial_master_nodes: ["node-1"] discovery.seed_hosts: ["192.168.204.209:9300", "192.168.204.209:9301","192.168.204.209:9302"] discovery.zen.minimum_master_nodes: 2 http.cors.enabled: true http.cors.allow-origin: "*"
分别启动:
./elasticsearch -p /tmp/elasticsearch_9200_pid -d
./elasticsearch -p /tmp/elasticsearch_9201_pid -d
./elasticsearch -p /tmp/elasticsearch_9202_pid -d
 
3、一台机器搭建集群(二)
 
0
新建目录:
0
 
0
注意赋予权限
chown -R taibai:taibai ES
分别启动:
./elasticsearch -d -E node.name=node-1 -E http.port=9200 -E transport.port=9300 -E path.data=/ES/data/node1 -E path.logs=/ES/logs/node1
./elasticsearch -d -E node.name=node-2 -E http.port=9201 -E transport.port=9301 -E path.data=/ES/data/node2 -E path.logs=/ES/logs/node2
./elasticsearch -d -E node.name=node-3 -E http.port=9202 -E transport.port=9302 -E path.data=/ES/data/node3 -E path.logs=/ES/logs/node3
 
 
posted on 2024-10-09 14:31  Old-Kang  阅读(5)  评论(0编辑  收藏  举报