Linux环境操作(三)Elasticsearch集群搭建 和 Kibana安装以及问题解决方案

 

 

1.安装包下载

1)Elasticsearch官网: https://www.elastic.co/products/elasticsearch

2.安装

1)解压文件夹

tar -zxvf elasticsearch-5.2.2.tar.gz

2)创建Data和logs文件夹 在es目录下

mkdir data
mkdir logs

3)切换到conf文件夹下,配置elasticsearch.yml

vim elasticsearch.yml

需要配置的位置如图:

配置详情见代码片段: 

 

  1. cluster.name: 为集群的名称,可以任意组成,如果集群名称设置成相同的,则启动时自动组成集群
  2. node.name:可以随意取,但是集群内的各个节点不能相同
  3. 修改后的每行前面不能有空格,修改后的“:”后面必须有一个空格
  4.  
 ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: bolz
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: b-4
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /home/es/es/data
#
# Path to log files:

path.logs: /home/es/es/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.16.130
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.

## ---------------------------------- Network -----------------------------------
##
## Set the bind address to a specific IP (IPv4 or IPv6):
##
#network.host: 192.168.16.130
##
## Set a custom port for HTTP:
##
##http.port: 9200
##
## For more information, consult the network module documentation.
#
discovery.zen.ping.unicast.hosts: ["192.168.16.128","192.168.16.129","192.168.16.130"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 2
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.

3.配置linux系统环境

  1. 切换到root环境下:编辑limits.conf 添加类似如下内容
    vim /etc/security/limits.conf
    添加如下内容:
    * soft nofile 65536
    * hard nofile 131072
    * soft nproc 2048
    * hard nproc 4096
    
     
  2. 进入limits.d目录下修改配置文件
    im /etc/security/limits.d/90-nproc.conf
    修改如下内容:
    * soft nproc 1024
    #修改为
    * soft nproc 2048
    

    执行命令: sysctl –p

如果执行sysctl –p报错:  net.bridge......"is an unknown key

则 执行:

modprobe bridge

lsmod | grep bridge

然后,重新启动elasticsearch,即可启动成功。

或者执行sysctl –e –p

之后再次执行 sysctl –p

4.启动集群:

bin/elasticsearch     需要在每一个节点上启动集群

查看集群状态:

curl -XGET 'http://192.168.16.128:9200/_cluster/state?pretty'

 

发布了4 篇原创文章 · 获赞 0 · 访问量 3834

猜你喜欢

转载自blog.csdn.net/wei_weiwei/article/details/96876420