ElasticSearch 7集群部署

@admin  May 10, 2020

环境规划

主机名服务ip地址
node-1Elasticsearch192.168.3.17
node-2Elasticsearch192.168.3.27
node-3Elasticsearch192.168.3.28
kibanakibana192.168.3.19
logstashlogstash192.168.3.4
cerebrocerebro192.168.3.17
  • 测试环境,就没有使用filebeat。

软件版本

服务版本
操作系统Centos7
Elasticsearch7.6
Kibana7.6
Logstash7.6
cerebro0.8.1
JDKjava-1.8.0-openjdk.x86_64

系统参数配置

ES所有节点服务器都执行如下配置。

[root@elasticsearch-17 software]# vim /etc/security/limits.conf
新增内容如下:
* hard nofile 65536
* soft nproc 2048
* hard nproc 4096
* soft memlock unlimited
* hard memlock unlimited
[root@elasticsearch-17 software]# vim /etc/sysctl.conf
vm.max_map_count=655360
fs.file-max=655360
[root@elasticsearch-17 software]#  sysctl -p 

因为是测试环境,没有部署内网DNS,所以就直接走hosts文件解析了(一样所有节点服务器都执行)。

[root@elasticsearch-17 software]#  vim /etc/hosts
192.168.3.17 node-1
192.168.3.27 node-2
192.168.3.28 node-3

部署ES

分别在node-1、node-2、node-3上面安装ES7.6.(下面步骤在node1-3上面都要执行)

[root@elasticsearch-17 software]#  yum -y install java-1.8.0-openjdk.x86_64
[root@elasticsearch-17 software]# java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
[root@elasticsearch-17 software]#  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm
[root@elasticsearch-17 software]#  rpm -ivh elasticsearch-7.6.2-x86_64.rpm
[root@elasticsearch-17 software]#  systemctl enable elasticsearch

修改ES配置文件

配置文件保持三台服务器一样(node.name要改成自己的)

[root@elasticsearch-17 software]# grep -vE '#' /etc/elasticsearch/elasticsearch.yml 
cluster.name: myels  # 集群名称
node.name: node-1   # 节点名称

path.data: /var/lib/elasticsearch  # 数据存储路径
path.logs: /var/log/elasticsearch  # ES日志存储路径
network.host: 0.0.0.0   # 监听地址
http.port: 9200     # http端口
discovery.seed_hosts: ["192.168.3.17", "192.168.3.27","192.168.3.28"] #集群主机列表
cluster.initial_master_nodes: ["node-1"] #启动全新的集群时需要此参数,再次重新启动时此参数可免。集群初始化master节点


http.cors.enabled: true  #是否开启跨域访问
http.cors.allow-origin: "*" #开启跨域访问后的地址限制,*表示无限制

启动ES

   [root@elasticsearch-17 software]#  systemctl enable elasticsearch
   [root@elasticsearch-17 software]#  systemctl start elasticsearch

检查ES集群和节点状态

[root@elasticsearch-17 software]# curl -XGET http://192.168.3.17:9200/_cat/nodes?v
ip           heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.3.27           29          80   0    0.00    0.01     0.05 dilm      *      node-2
192.168.3.28           45          84   0    0.00    0.01     0.05 dilm      -      node-3
192.168.3.17           65          89   0    0.00    0.01     0.05 dilm      -      node-1

部署配置cerebro

  [root@elasticsearch-17 software]# wget https://github.com/lmenezes/cerebro/releases/download/v0.8.1/cerebro-0.8.1.tgz
  [root@elasticsearch-17 software]#  tar -zxzf cerebro-0.8.1.tgz
  [root@elasticsearch-17 conf]# ../bin/cerebro
   [info] play.api.Play - Application started (Prod)
   [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

知我知行
知我知行


添加新评论