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)

 CentOS 7下安装部署Elasticsearch7.3.1_第1张图片

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

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

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

CentOS 7下安装部署Elasticsearch7.3.1_第2张图片

  • 切换到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

CentOS 7下安装部署Elasticsearch7.3.1_第3张图片

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

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

CentOS 7下安装部署Elasticsearch7.3.1_第4张图片

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

你可能感兴趣的:(CentOS 7下安装部署Elasticsearch7.3.1)