CentOS 7下安装部署Elasticsearch7.3.1

elasticsearch简介

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文检索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。

搭建环境

1)JDK11环境
2)CentOS7.IP地址:192.168.3.76
3)elasticsearch7.3.1 

  • es最新软件软件包可在官方网站下载:https://www.elastic.co/downloads/elasticsearch

安装好java,具体安装方法就不细说了。

部署elasticsearch7.3.1

  • 首先在官网当中下载es的软件包,本文采用压缩包解压缩安装方式启动服务。

  • 值得注意的是,在es5.0版本后不支持与logstash和kibana2.x版本的混用,且安全级别的提升,使得es在后续的版本中不允许使用root用户启动,因此我们需要创建另外独立账户专供es使用。并且需要在root权限下将该特定环境准备好。
  • 创建独立用户与组(root用户下创建设定)
  • 解压命令:tar -zxvf elasticsearch-7.3.1-linux-x86_64.tar.gz

groupadd ela 创建ela组
useradd -g ela ela 创建ela用户,并且加入ela组
passwd ela 为ela用户设定登录密码
visudo(或者vim /etc/sudoers)

 

添加一行:ela    ALL=(ALL)     ALL  是得ela用户拥有执行权限

  • 为了让ela用户拥有对elasticsearch执行权限,在root用户权限下解压后,需要将软件包更改属主属组。

chown -R ela.ela /opt/elasticsearch-7.3.1/
ls -l /opt/elasticsearch-7.3.1/

  • 切换到ela用户,编辑配置文件,准备启动es

su ela
 sudo vi /opt/elasticsearch-7.3.1/config/elasticsearch.yml

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ 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/es-data
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# 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"]
#
# 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: true

 

编辑完成配置文件后,数据目录以及日志文件目录需要创建

sudo mkdir -p /data/es-data
sudo mkdir -p /var/log/elasticsearch
sudo chown -R ela.ela /data/
sudo chown -R ela.ela /var/log/elasticsearch

  • 准备工作完成,启动es

 ./elasticsearch 后面可以跟上-d后台执行

运行成功后我们浏览器打开:192.168.3.76:9200

出现如上界面即安装成功,访问时记得关闭防火墙!!!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值