Elasticsearch7.15.2 分布式集群安装(linux环境)
生活随笔
收集整理的這篇文章主要介紹了
Elasticsearch7.15.2 分布式集群安装(linux环境)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言:一到六演示采用偽分布式,七單獨介紹分布式集群方式
文章目錄
- 一、前期準備
- 1. 下載
- 2. 解壓
- 3.創建es用戶
- 4. 增加資源分配
- 5. 內核參數
- 6. 刷新 配置
- 二、node1節點
- 2.1. 重命名
- 2.1. 編輯配置
- 三、node2節點
- 3.1. 復制node-1
- 3.2. 修改配置
- 四、node3節點
- 4.1. 復制node-1
- 3.2. 修改配置
- 五、賦予權限和啟動
- 5.1. 賦予權限
- 5.2. 切換用戶
- 5.3. es啟動node1
- 5.4. es啟動node2
- 5.5. es啟動node3
- 5.6. 防火墻配置
- 六、服務驗證
- 6.1. 本機驗證
- 6.2. 瀏覽器驗證
- 七、集群配置
- 7.1. node1
- 7.2. node2
- 7.1. node3
一、前期準備
| 192.168.159.134 | 9200 | node1 |
| 192.168.159.134 | 9201 | node2 |
| 192.168.159.134 | 9202 | node3 |
請使用root用戶操作,需要es用戶操作的地方,我會提前說明。
https://www.elastic.co/cn/
1. 下載
我存放的目錄在/app下面
cd /app wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.2-linux-x86_64.tar.gz2. 解壓
tar -xzf elasticsearch-7.15.2-linux-x86_64.tar.gz3.創建es用戶
es7不能使用root用戶啟動,因此,需要創建es操作用戶
adduser es passwd es4. 增加資源分配
增加資源分配,資源分配不夠進程會自動關閉服務
vim /etc/security/limits.conf * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 40965. 內核參數
vim /etc/sysctl.conf添加內容:
vm.max_map_count=2621456. 刷新 配置
sysctl -p為了演示方便,這里演示采用偽集群配置,本文末尾附上,集群配置
二、node1節點
使用root用戶操作
2.1. 重命名
cd /app mv elasticsearch-7.15.2 elasticsearch-node12.1. 編輯配置
cd /app/elasticsearch-node1/config/ vim elasticsearch.yml- 添加以下內容:
- 具體調整地方
第1處
第2處
第3處
第4處
三、node2節點
使用root用戶操作
3.1. 復制node-1
cd /app cp elasticsearch-node1/ elasticsearch-node2 -r3.2. 修改配置
cd /app/elasticsearch-node2/config/ vim elasticsearch.yml- 調整內容如下:
- 具體調整地方
第1處
修改node名稱:
第2處
四、node3節點
使用root用戶操作
4.1. 復制node-1
cd /app cp elasticsearch-node1/ elasticsearch-node3 -r3.2. 修改配置
cd /app/elasticsearch-node3/config/ vim elasticsearch.yml- 調整內容如下:
- 具體調整地方
第1處
#修改node名稱: node.name: node-3
第2處
五、賦予權限和啟動
使用root用戶操作
5.1. 賦予權限
cd /app chown es.es elasticsearch-node1/ -R chown es.es elasticsearch-node2/ -R chown es.es elasticsearch-node3/ -R5.2. 切換用戶
su - es5.3. es啟動node1
cd /app/elasticsearch-node1/bin/elasticsearch -d5.4. es啟動node2
cd /app/elasticsearch-node2/bin/elasticsearch -d5.5. es啟動node3
cd /app/elasticsearch-node3/bin/elasticsearch -d5.6. 防火墻配置
- 第1種:關閉防火墻
- 第2種:防火墻允許9200/9201/9202端口訪問
六、服務驗證
6.1. 本機驗證
curl http://192.168.159.134:9200/_cat/health6.2. 瀏覽器驗證
http://192.168.159.134:9200/_cat/health http://192.168.159.134:9200/_cat/health七、集群配置
| 192.168.159.134 | 9200 | node1 |
| 192.168.159.135 | 9200 | node2 |
| 192.168.159.136 | 9200 | node3 |
7.1. node1
在192.168.159.134服務器操作
cluster.name: dianping-app node.name: node-1 path.data: /app/elasticsearch-7.15.2/data path.logs: /app/elasticsearch-7.15.2/logs network.host: 0.0.0.0 http.port: 9200 transport.tcp.port: 9300 http.cors.enabled: true http.cors.allow-origin: "*" discovery.seed_hosts: ["192.168.159.134:9200", "192.168.159.135:9200", "192.168.159.136:9300"] cluster.initial_master_nodes: ["192.168.159.134:9200", "192.168.159.135:9200", "192.168.159.136:9300"]7.2. node2
在192.168.159.135服務器操作
cluster.name: dianping-app node.name: node-2 path.data: /app/elasticsearch-7.15.2/data path.logs: /app/elasticsearch-7.15.2/logs network.host: 0.0.0.0 http.port: 9200 transport.tcp.port: 9300 http.cors.enabled: true http.cors.allow-origin: "*" discovery.seed_hosts: ["192.168.159.134:9200", "192.168.159.135:9200", "192.168.159.136:9300"] cluster.initial_master_nodes: ["192.168.159.134:9200", "192.168.159.135:9200", "192.168.159.136:9300"]7.1. node3
在192.168.159.136服務器操作
cluster.name: dianping-app node.name: node-3 path.data: /app/elasticsearch-7.15.2/data path.logs: /app/elasticsearch-7.15.2/logs network.host: 0.0.0.0 http.port: 9200 transport.tcp.port: 9300 http.cors.enabled: true http.cors.allow-origin: "*" discovery.seed_hosts: ["192.168.159.134:9200", "192.168.159.135:9200", "192.168.159.136:9300"] cluster.initial_master_nodes: ["192.168.159.134:9200", "192.168.159.135:9200", "192.168.159.136:9300"]總結
以上是生活随笔為你收集整理的Elasticsearch7.15.2 分布式集群安装(linux环境)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Docker JFrog Artifac
- 下一篇: Vue Bootstrap OSS 实现