1. 下载elasticsearch
喜欢使用最新版本的可以去官网下载最新版本,因为官网下载慢,总中断,这里我网盘分享一个7.2版本,方便下载。
elasticsearch官网:https://www.elastic.co/cn/
百度网盘链接:https://pan.baidu.com/s/1cWAwxoueGWllLZmkwcvgbg
提取码:a815
2. 安装部署
主机系统:Centos7
elasticsearch版本:7.2.0
将ES安装包移动到centos下进行安装,ES的安装比较简单,这里我们先做单节点的部署,分布式我们以后再进行配置。
[root@node1 ~]# rpm -ivh elasticsearch-7.2.0-x86_64.rpm //rpm安装ES
[root@node1 data]# mkdir /usr/bjxc/spartacus/data/es //准备数据存放目录
[root@master data]# chown -R elasticsearch:elasticsearch/usr/bjxc/spartacus/data/es/ //设置用户组
[root@node1 ~]# vim /etc/elasticsearch/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: cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node2
#
# 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: /usr/bjxc/spartacus/data/es/
#
#
# 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: ["node0"]
#
# 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
xpack.ml.enabled: false
xpack.security.enabled: false
===========================================配置文件内容结束=======================================
[root@node1 ~]# Service elasticsearch start //启动ES
[root@node1 ~]# Service elasticsearch status //查看服务启动状态
上图表示es服务启动正常,要查看es运行是否正常,可以通过web访问 http://IP地址:9200,查看运行状态