旧版本Elasticsearch安装
安装Elasticsearch版本:5.5.3
一、安装JDK
jdk下载地址:https://www.oracle.com/java/technologies/downloads/
# 解压jdk
tar xf jdk-8u351-linux-x64.tar.gz
# 配置环境变量
vim /etc/profile
export JAVA_HOME=/data/soft/jdk1.8.0_351
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib
# 环境变量生效
source /etc/profile
# 查看java版本是否正确
java -version
java version "1.8.0_351"
Java(TM) SE Runtime Environment (build 1.8.0_351-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode)
二、安装Elasticsearch5.5.3
下载地址:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.3.tar.gz
1、安装ES
# 解压文件
tar xf elasticsearch-5.5.3.tar.gz -C /data1/env/
# 配置软链
ln -s /data1/env/elasticsearch-5.5.3 /data1/soft/elasticsearch
2、配置用户
# 创建es运行的用户,es不能直接运行在root用户下
id es >/dev/null 2>&1 || useradd es -u 1002 -s /bin/bash -d /data1/env/elasticsearch-5.5.3
# 目录修改用户权限
chown -R es:es /data1/env/elasticsearch-5.5.3
# max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 报错问题
vim /etc/sysctl.conf
# 在最后面添加
vm.max_map_count=262144
# 保存之后,执行生效
/sbin/sysctl -p
# 修改配置文件
vim /data1/soft/elasticsearch/config/elasticsearch.yml
node.name: es1 # 自定义名称
network.host: 0.0.0.0 # 开放访问
http.port: 9200 # 访问端口9200
3、安装密码组件
/data1/soft/elasticsearch/bin/elasticsearch-plugin install x-pack
配置密码
/data1/soft/elasticsearch/bin/setup-passwords interactive
4、配置启动文件
vim /lib/systemd/system/elasticsearch.service
[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Environment=ES_HOME=/data1/soft/elasticsearch
Environment=CONF_DIR=/data1/soft/elasticsearch/config
Environment=DATA_DIR=/data1/soft/elasticsearch/data
Environment=LOG_DIR=/data1/soft/elasticsearch/logs
Environment=PID_DIR=/data1/soft/elasticsearch
EnvironmentFile=-/etc/sysconfig/elasticsearch
WorkingDirectory=/data1/soft/elasticsearch
User=es
Group=es
#ExecStartPre=/data/soft/elasticsearch/bin/elasticsearch-systemd-pre-exec
ExecStart=/data1/soft/elasticsearch/bin/elasticsearch \
-p /data1/soft/elasticsearch/elasticsearch.pid \
--quiet
# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Specifies the maximum number of processes
LimitNPROC=65536
# Specifies the maximum number of bytes of memory that may be locked into RAM
# Set to "infinity" if you use the 'bootstrap.memory_lock: true' option
# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/sysconfig/elasticsearch
#LimitMEMLOCK=infinity
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM
# Send the signal only to the JVM rather than its control group
KillMode=process
# Java process is never killed
SendSIGKILL=no
# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
启动
systemctl start elasticsearch
正文到此结束
- 本文标签: Linux elk elasticsearch
- 版权声明: 本站原创文章,于2022年10月31日由 PGaZn发布,转载请注明出处
评论
登录后才能发表评论 登录/注册
0评论