ElasticSearch安装
Download Kibana Free | Get Started Now | Elastic
Download Elasticsearch | Elastic
ElasticSearch入门之es的安装, es首次启动报错及解决方案 - 奥义,三千世界 - 博客园 (cnblogs.com)
ElasticSearch二进制安装
九、Linux二进制安装ElasticSearch集群_elasticsearch==8.14.2-CSDN博客
安装必要环境
yum install -y gcc git wget vim ntp lsof
yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel
修改系统配置文件
因为elasticSearch需要新增文件,可能会出现无法创建本地文件问题, 用户最多大创建文件数太小
vim /etc/security/limits.conf
#添加以下内容(带上*号)
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
vm可能不够也需要修改
vim /etc/sysctl.conf
#添加以下内容
vm.swappiness=1
vm.max_map_count=655360
#刷新配置文件
sysctl -p
新建es用户
ElasticSearch不能使用root用户启动,一般集群服务都需要有自己的用户。所以需要为其创建启动用户
useradd esuser
passwd esuser
输入重复密码: PassW0rd_1234
解压安装包,移动到/opt/elk
为用户赋权限 chown esuser:esuser -R /opt/elk
配置文件修改
# ======================== 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: 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: /opt/elasticsearch-8.14.3/data
#
# Path to log files:
#
path.logs: /opt/elasticsearch-8.14.3/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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#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"]
discovery.seed_hosts: ["127.0.0.1"]
# 是否支持跨域
http.cors.enabled: true
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#cluster.initial_master_nodes: ["node-1"]
#开启单点,非集群模式
discovery.type: single-node
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false
xpack.security.transport.ssl.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.enabled: true
到bin下./elasticsearch启动服务
修改密码
./elasticsearch-setup-passwords interactive
登录ip:9200验证
设置service
/etc/systemd/system/elasticsearch.service
[Unit]
Description=Elasticsearch #描述
After=network.target
[Service]
Type=simple
User=*** #es的启动用户
LimitMEMLOCK=infinity #es锁住内存
LimitNOFILE=65535 #文件句柄数限制
WorkingDirectory=/home/elasticsearch-7.3.0 #es安装目录
ExecStart=/home/elasticsearch-7.3.0/bin/elasticsearch #es启动项
Restart=on-failure #失败重启
[Install]
WantedBy=multi-user.target

浙公网安备 33010602011771号