centOs6.5安装elasticsearch7.1.1

一、下载

https://www.elastic.co/cn/downloads/past-releases#elasticsearch

二、安装

elasticsearch7.1.1需要jdk1.8,所以需要先安装jdk1.8

然后将elasticsearch-7.1.1-linux-x86_64.tar.gz解压在服务器/data/elasticsearch-7.1目录下

修改配置文件:

在进入解压文件,找到bin目录,然后 vi elasticsearch,在文件前面增加JAVA_HOME的配置,路径为之前安装的jdk1.8的路径,如下:

然后修改confing下的配置文件elasticsearch.yml,配置文件如下:

# ======================== 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: renjiao_elasticsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# 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: /data/elasticsearch-7.1/elasticsearch-7.1.1/data
#
# Path to log files:
#
path.logs: /data/elasticsearch-7.1/elasticsearch-7.1.1/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: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1","node-2"]
#
# For more information, consult the discovery and cluster formation 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.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: truei
#支持跨域访问,支持es head的访问
http.cors.enabled: true
http.cors.allow-origin: "*"

其中需要注意的配置:

cluster.name:集群名字

path.data:数据位置

path.logs:日志位置

bootstrap.memory_lock: false (见后面报错信息解释)

bootstrap.system_call_filter: false(见后面报错信息解释)

network.host: 0.0.0.0

http.port: 9200  端口

cluster.initial_master_nodes: ["node-1","node-2"]

如果需要其他浏览器端的elasticsearch-head-master访问,则需要放开下面的配置:

network.host: 0.0.0.0

cluster.initial_master_nodes: ["node-1","node-2"]

并增加如下配置:

#支持跨域访问,支持es head的访问
http.cors.enabled: true
http.cors.allow-origin: "*"

否则elasticsearch-head-master无法连接。

三、启动过程报错:

1、can not run elasticsearch as root

解决:

  • 创建用户:elasticsearch

       # adduser elasticsearch

  • 创建用户密码,需要输入两次

         # passwd elasticsearch
          密码为:Elasticsearch@123

  • 将对应的文件夹权限赋给该用户

        # chown -R elasticsearch /data/elasticsearch-7.1/elasticsearch-7.1.1

  • 切换至elasticsearch用户

        # su elasticsearch

  • 进入启动目录启动 /usr/local/elasticsearch-6.0.0/bin  

        使用后台启动方式:./elasticsearch -d

2、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决:

切换到root用户

执行命令:sysctl -w vm.max_map_count=262144

查看结果:sysctl -a|grep vm.max_map_count

显示:max_map_count = 262144

 

上述方法修改之后,如果重启虚拟机将失效,所以:

解决办法:

在   /etc/sysctl.conf文件最后添加一行

vm.max_map_count=262144

即可永久修改

3、system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

原因:
这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值