> For the complete documentation index, see [llms.txt](https://darren.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://darren.gitbook.io/project/k8s-xi-tong-wan-zheng-bu-shu/efk/es-ji-qun-bu-shu.md).

# es集群部署

参考上篇es搭建

只 需要修改 elasticsearch.yml中的

```
cluster.name: mzlog
node.name: n1
network.host: 10.1.195.3
这三个即可
```

如下详细

| 名称 | 地址          | cluster.name |
| -- | ----------- | ------------ |
| n1 | 10.1.195.3  | mzlog        |
| n2 | 10.1.196.15 | mzlog        |

## n2上部署

部署同n1一样，只是改了ip

```
1.安装jdk
yum -y install java-1.8.0-openjdk*

2.下载es并安装
wget -c https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.0.rpm
rpm -ivh elasticsearch-6.3.0.rpm

3.设置开机启动
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
###您可以通过执行来启动ElasticSearch服务
sudo systemctl start elasticsearch.service

4.修改配置，改为集群式
[root@centos elasticsearch]# egrep -v "#|^$" elasticsearch.yml
cluster.name: mzlog
node.name: node2
path.data: /data1/elastic/data #修改存储路径
path.logs: /data1/elastic/logs #修改日志路径
bootstrap.memory_lock: true #启用内存锁，防止内存被交换出去
network.host: 10.1.196.15
discovery.zen.ping.unicast.hosts: ["10.1.195.3", "10.1.196.15"]
会把写在第一个的当做主节点，另外一个为工作节点
注意：修改path.data和path.logs里面后的权限，属主要改为elasticsearch用户

5.修改jvm.options里内存大小
-Xms32g
-Xmx32g

6.划分角色
node.master: true
node.data: true
```
