1 安装elasticsearch-7.1.1
官网下载elasticsearch,官网地址:Past Releases of Elastic Stack Software | Elastic,
1.1 安装环境:
centos7
jdk-9.0.1
elasticsearch-7.1.1
1.2 拷贝到服务器的/opt文件夹下并解压,然后修改配置文件
#
# 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: myes
#
# ------------------------------------ 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: /path/to/data
#
# Path to log files:
# 日志存放位置
path.logs: /path/to/logs
#
# ----------------------------------- 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):
# ip地址
network.host: 192.168.0.1
#
# 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:
# 7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举master,单节点时只需写当前节点
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
2 安装过程中问题记录
2.1 不能以root管理员账号启动,需要用普通账号启动
解决:创建普通账号,切换到普通账号之后启动即可
[root@192 /]# adduser kuiyou
[root@192 /]# passwd kuiyou
Changing password for user kuiyou.
New password:
2.2 普通账号启动报错
解决:查询es宿主
[kuiyou@192 elasticsearch-1]$ ll config/
es的宿主是root账号,需要切换es的宿主机,用root账号切换
[root@192 elasticsearch-1]# chown -R kuiyou:kuiyou /opt/elasticsearch-1
然后再查询
[kuiyou@192 elasticsearch-1]$ ll config/
2.3 max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]问题
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
解决:修改/etc/security/limits.conf,增加以下内容
* soft nofile 65536
* hard nofile 65536
2.4 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]问题
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决:修改/etc/sysctl.conf,加入vm.max_map_count=655360
重新加载/etc/sysctl.conf配置,使之生效
[root@192 etc]# sysctl -p
2.5 Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release 问题
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
垃圾回收器版本过低,进入 elasticsearch config配置文件中修改jvm.options