写点什么

ElasticSearch 三节点集群搭建笔记(中心化版本)

  • 2022 年 5 月 07 日
  • 本文字数:2152 字

    阅读完需:约 7 分钟

| es1 | 192.168.122.128 | Manjaro 20.1 | ElasticSearch7.3 | 9200 | 9300 |


| es2 | 192.168.122.130 | CentOS 7.4 | ElasticSearch7.3 | 9200 | 9300 |


| es3 | 192.168.122.131 | CentOS 7.4 | ElasticSearch7.3 | 9200 | 9300 |


[](()二、配置文件


=====================================================================


es1

---------------------------------- Cluster -----------------------------------

#设定集群名称


cluster.name: elk4devops

------------------------------------ Node ------------------------------------

#设定节点名称,此处使用的是 hostname


node.name: es1

----------------------------------- Paths ------------------------------------

#设定 es 《一线大厂 Java 面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》无偿开源 威信搜索公众号【编程进阶路】 服务器数据目录


path.data: /var/lib/elasticsearch


#设定 es 服务器日志目录


path.logs: /var/log/elasticsearch

---------------------------------- Network -----------------------------------

#设定此节点加入网络的名称,这里使用的是 FQDN


network.host: 192.168.122.128

--------------------------------- Discovery ----------------------------------

#设定初始的 master 节点为 es1


cluster.initial_master_nodes: ["es1"]


discovery.seed_hosts: ["192.168.122.128"]

------------------------------- App Search ---------------------------------

#提前为 App Search 做好准备


action.auto_create_index: ".app-search--logs-,-.app-search-,+"


#http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type


http.cors.enabled: true


http.cors.allow-origin: "*"


http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE


http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"


es2

---------------------------------- Cluster -----------------------------------

cluster.name: elk4devops

------------------------------------ Node ------------------------------------

node.name: es2

----------------------------------- Paths ------------------------------------

path.data: /var/lib/elasticsearch


path.logs: /var/log/elasticsearch

---------------------------------- Network -----------------------------------

network.host: 192.168.122.130

--------------------------------- Discovery ----------------------------------

cluster.initial_master_nodes: ["es1"]


discovery.seed_hosts: ["192.168.122.128"]

------------------------------- App Search ---------------------------------

#提前为 App Search 做好准备


action.auto_create_index: ".app-search--logs-,-.app-search-,+"


#http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type


http.cors.enabled: true


http.cors.allow-origin: "*"


http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE


http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"


es3

---------------------------------- Cluster -----------------------------------

#设定集群名称


cluster.name: elk4devops

------------------------------------ Node ------------------------------------

#设定节点名称,此处使用的是 hostname


node.name: es3

----------------------------------- Paths ------------------------------------

#设定 es 服务器数据目录


path.data: /var/lib/elasticsearch


#设定 es 服务器日志目录


path.logs: /var/log/elasticsearch

---------------------------------- Network -----------------------------------

#设定此节点加入网络的名称,这里使用的是 FQDN


network.host: 192.168.122.131

--------------------------------- Discovery ----------------------------------

#设定初始的 master 节点为 es1


cluster.initial_master_nodes: ["es1"]


discovery.seed_hosts: ["192.168.122.128"]

------------------------------- App Search ---------------------------------

#提前为 App Search 做好准备


action.auto_create_index: ".app-search--logs-,-.app-search-,+"


#http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type


http.cors.enabled: true


http.cors.allow-origin: "*"


http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE


http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"


[](()三、其他细节


=====================================================================


创建数据及日志目录


mkdir -p /var/lib/elasticsearch


mkdir -p /var/log/elasticsearch


chmod 777 -R /var/lib/elasticsearch


chmod 777 -R /var/log/elasticsearch


关闭防火墙


执行命令


systemctl disable firewalld


systemctl stop firewalld


修改系统最大文件打开数


编辑/etc/security/limits.conf 文件


  • hard nofile 65536

  • soft nofile 65536


修改用户最大进程数

用户头像

还未添加个人签名 2022.04.13 加入

还未添加个人简介

评论

发布
暂无评论
ElasticSearch三节点集群搭建笔记(中心化版本)_程序员_爱好编程进阶_InfoQ写作社区