0、环境准备
链接:jdk下载
提取码:26jw
链接:elasticsearch-6.6.0
提取码:fkb3
1、安装jdk环境
mkdir /opt/es-software
cd /opt/es-software
rpm -ivh jdk-8u102-linux-x64.rpm
java -version
2、安装elasticsearch
rpm -ivh elasticsearch-6.6.0.rpm
rpm -qc elasticsearch
3、简单介绍安装后的文件的作用
/etc/elasticsearch/elasticsearch.yml # es的主要配置文件
/etc/elasticsearch/jvm.options # 配置jvm虚拟机的内存信息
/etc/sysconfig/elasticsearch # 配置相关系统变量
/usr/lib/sysctl.d/elasticsearch.conf # 配置相关系统变量
/usr/lib/systemd/system/elasticsearch.service # es的服务程序
4、修改es的主配置文件
[root@es01 elasticsearch]# grep -Ev '^$|#' /etc/elasticsearch/elasticsearch.yml
node.name: wy01
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 10.0.0.11
http.port: 9200
systemctl start elasticsearch.service
systemctl enable elasticsearch.servic
5、服务启动后有报错
[2020-04-08T13:29:53,773][ERROR][o.e.b.Bootstrap ] [wy01] node validation exception
[1] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
#解决方法
systemctl edit elasticsearch
[Service]
LimitMEMLOCK=infinity
# 重新载入
systemctl daemon-reload
# 重新es服务
systemctl restart elasicsearch
# 查询端口
netstat -lntup
ss -lnt
# 命令行的方式检查
curl http://10.0.0.11:9200
curl http://localhost:9200
[root@wy ~]# systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/elasticsearch.service.d
└─override.conf
Active: failed (Result: exit-code) since Sat 2020-07-18 12:35:09 CST; 6s ago
Docs: http://www.elastic.co
Process: 1251 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 1251 (code=exited, status=1/FAILURE)
Jul 18 12:35:09 wy systemd[1]: Starting Elasticsearch...
Jul 18 12:35:09 wy elasticsearch[1251]: Java HotSpot(TM) 64-Bit Server VM warn...2)
Jul 18 12:35:09 wy elasticsearch[1251]: #
Jul 18 12:35:09 wy elasticsearch[1251]: # There is insufficient memory for the...e.
Jul 18 12:35:09 wy elasticsearch[1251]: # Native memory allocation (mmap) fail...y.
Jul 18 12:35:09 wy elasticsearch[1251]: # An error report file with more infor...s:
Jul 18 12:35:09 wy elasticsearch[1251]: # /var/log/elasticsearch/hs_err_pid1251.log
Jul 18 12:35:09 wy systemd[1]: elasticsearch.service: main process exited, co...URE
Jul 18 12:35:09 wy systemd[1]: Unit elasticsearch.service entered failed state.
Jul 18 12:35:09 wy systemd[1]: elasticsearch.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
修改/etc/elasticsearch/jvm.options
22 -Xms512m
23 -Xmx512m
[root@wy ~]# ss -lnatp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:* users:(("sshd",pid=1120,fd=3))
ESTAB 0 0 10.0.0.11:22 10.0.0.1:56831 users:(("sshd",pid=1194,fd=3))
ESTAB 0 52 10.0.0.11:22 10.0.0.1:56796 users:(("sshd",pid=1161,fd=3))
LISTEN 0 128 ::ffff:10.0.0.11:9200 :::* users:(("java",pid=1483,fd=183))
LISTEN 0 128 ::ffff:10.0.0.11:9300 :::* users:(("java",pid=1483,fd=182))
LISTEN 0 128 :::22 :::* users:(("sshd",pid=1120,fd=4))