---------------------------------- Cluster -----------------------------------
#设定集群名称
cluster.name: elk4devops
------------------------------------ Node ------------------------------------
#设定节点名称,此处使用的是 hostname
node.name: es1
----------------------------------- Paths ------------------------------------
#设定 es 服务器数据目录
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
修改用户最大进程数
编辑/etc/security/limits.conf文件
-
hard nproc 4096
-
soft nproc 4096
修改最大文件句柄数
执行命令
sysctl -w vm.max_map_count=262144
以普通用户身份启动节点
===================================================================
分别访问三个节点的HTTP服务地址,出现后续json格式信息代表集群搭建成功
192.168.122.128:9200
{
“name” : “es1”,
“cluster_name” : “elk4devops”,
“cluster_uuid” : “CAeXdMahQ5qz6Xf8BuzxXw”,
“version” : {