CentOS7 安装ElasticSearch

21 篇文章 0 订阅
5 篇文章 0 订阅


说明!ElasticSearch,Logstash,Kibana版本需要统一

一)、下载ElasticSearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.tar.gz

二)、解压ElasticSearch

tar -zxvf elasticsearch-6.5.4.tar.gz

三)、添加用户和用户组

groupadd elasticUser

# useradd -g 组名 用户名
useradd -g elasticUser elasticUser

不能直接以root用户运行ElasticSearch,否则会报错
在这里插入图片描述

四)、设置密码

passwd elasticUser

五)、给新用户授予权限

chown -R elasticUser:elasticUser /usr/local/ELK/elasticsearch-6.5.4

六)、编辑limits.conf 文件并添加内容

vim /etc/security/limits.conf

# soft nofile:单个用户可用的最大进程数量(软限制)
# hard nofile:单个用户可用的最大进程数量(硬限制)
root soft nofile 65535
root hard nofile 65535

# esUser
esUser  soft nofile 65536
esUser  hard nofile 65536

* soft nofile 65535
* hard nofile 65535

七)、编辑 sysctl.conf 文件并添加内容

vim /etc/sysctl.conf

# 文件包含限制一个进程可以拥有的 VMA(虚拟内存区域)的数量,默认是 65530
vm.max_map_count=262144

八)、最后执行命令

sysctl -p

九)、配置ElasticSearch

# 进入config目录,编辑elasticsearch.yml文件
# 添加配置时需注意配置文件":"后要有空格
/usr/local/ElasticSearch/elasticsearch-6.5.4/data
/usr/local/ElasticSearch/elasticsearch-6.5.4/logs

进入config目录,编辑elasticsearch.yml文件

添加配置时需注意配置文件":"后要有空格

#集群名称,起名为elasticsearch
#es启动后会将具有相同集群名字的节点放到一个集群下。
cluster.name:  elasticsearch

#
#节点名字。
node.name: "node1"

#
#数据存储位置,配置之后该目录会自动生成
path.data: /usr/local/elasticsearch/elasticsearch-6.5.4/data

#
#日志文件的路径,配置之后该目录会自动生成
path.logs: /usr/local/elasticsearch/elasticsearch-6.5.4/logs

#
#设置绑定的ip地址,可以是ipv4或ipv6的,默认为0.0.0.0
#network.bind_host: xxxxxx

#
#设置其它节点和该节点交互的ip地址,如果不设置它会自动设置,值必须是个真实的ip地址
#network.publish_host: xxxxxx

#
#同时设置bind_host和publish_host上面两个参数,该地址为默认地址
network.host: 0.0.0.0

#
#设置节点间交互的tcp端口,默认是9300
#transport.tcp.port: 9300

#
#设置是否压缩tcp传输时的数据,默认为false,不压缩
transport.tcp.compress: true

#
#设置对外服务的http端口,默认为9200
#http.port: 9200

#
#使用http协议对外提供服务,默认为true,开启
#http.enabled: false

#
#discovery.zen.ping.unicast.hosts:["节点1的 ip","节点2 的ip","节点3的ip"]
#这是一个集群中的主节点的初始列表,当节点(主节点或者数据节点)启动时使用这个列表进行探测
discovery.zen.ping.unicast.hosts: ["你的IP地址"]

#
#指定集群中的节点中有几个有master资格的节点。
#对于大集群可以写(2-4)。
discovery.zen.minimum_master_nodes: 1

#
#解决head的集群健康值问题,后续会安装head插件
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

在这里插入图片描述
在这里插入图片描述

十)、出现的问题

max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

vim /etc/security/limits.conf

# 打开文件的最大数目
* - nofile 65536
# 最大锁定内存地址空间
* - memlock unlimited

JVM内存不够问题

vim config/jvm.options
# 修改为以下配置或者更小
-Xms500m
-Xmx500m

十一)、防火墙开放9200,9300端口,并访问

# 编辑防火墙配置文件
vim /etc/sysconfig/iptables

# 开放9200,9300端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9200 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9300 -j ACCEPT

# 重启防火墙
systemctl restart iptables

访问:
http://ElasticSearch所在ip地址:9200?pretty

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值