安装准备
Elk平台环境 |
|
系统 |
版本 |
服务器操作系统 |
Centos release 7 |
ElasticSearch |
7.3 |
Logstash |
7.3 |
Kibana |
7.3 |
Jdk |
1.8 |
首先请在elk-server机器上JDK8;
在ELK官方文档中(https://www.elastic.co/guide/en/elasticsearch/hadoop/7.2/requirements.html),推荐的JDK版本为8。
直接wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" url没用
官方需要注册登录才能下载,注册的时候确认收邮件是个麻烦事,晚上收不到邮件,第二天下午重新试试,
https://profile.oracle.com/myprofile/account/confirmation.jspx
发送确认邮件几分钟才收到。
下载程序的时候开发者模式抓包获取下载地址再wget下载:
[root@home ~]# wget https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-linux-x64.tar.gz?AuthParam=1565600312_8f514ec7562f08667c0333e6d383281c
--2019-08-12 16:51:59-- https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-linux-x64.tar.gz?AuthParam=1565600312_8f514ec7562f08667c0333e6d383281c
Resolving download.oracle.com (download.oracle.com)... 23.35.180.41
Connecting to download.oracle.com (download.oracle.com)|23.35.180.41|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 195094741 (186M) [application/x-gzip]
Saving to: ‘jdk-8u221-linux-x64.tar.gz?AuthParam=1565600312_8f514ec7562f08667c0333e6d383281c’
100%[======================================>] 195,094,741 11.3MB/s in 21s
2019-08-12 16:52:20 (8.78 MB/s) - ‘jdk-8u221-linux-x64.tar.gz?AuthParam=1565600312_8f514ec7562f08667c0333e6d383281c’ saved [195094741/195094741]
[root@home ~]# ls
jdk-8u221-linux-x64.tar.gz?AuthParam=1565600312_8f514ec7562f08667c0333e6d383281c
[root@home ~]#mv jdk-8u221-linux-x64.tar.gz\?AuthParam\=1565600312_8f514ec7562f08667c0333e6d383281c jdk-8u221-linux-x64.tar.gz
tar -zxvf jdk-8u221-linux-x64.tar.gz
mv jdk1.8.0_221/ /usr/local/
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib/dt.JAVA_HOME/lib/tools.jar:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${PATH}
vim /etc/profile
source /etc/profile
java -version
成功之后显示:
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
Elasticsearch安装
此软件包可在Elastic许可下免费使用。它包含开源和免费商业功能以及付费商业功能。 开始为期30天的试用,试用所有付费商业功能。
https://www.elastic.co/cn/downloads/
https://www.elastic.co/guide/en/elasticsearch/reference/7.3/rpm.html#rpm-repo
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cd /etc/yum.repos.d/
vim elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
sudo yum install elasticsearch
也可以手动下载安装:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.0-linux-x86_64.tar.gz
tar -zxvf elasticsearch-7.3.0-linux-x86_64.tar.gz
...
其余的自行百度
遇到的问题:
Installed:
elasticsearch.x86_64 0:7.3.0-1
Complete!
[root@home yum.repos.d]# systemctl start elasticsearch.service
[root@home yum.repos.d]# curl http://127.0.0.1:9200
curl: (7) Failed connect to 127.0.0.1:9200; Connection refused
[root@home yum.repos.d]# service elasticsearch status -l
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2019-08-12 22:48:11 CST; 1min 20s ago
Docs: http://www.elastic.co
Process: 24305 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 24305 (code=exited, status=1/FAILURE)
Aug 12 22:48:11 home elasticsearch[24305]: error:
Aug 12 22:48:11 home elasticsearch[24305]: OpenJDK 64-Bit Server VM warning:....
Aug 12 22:48:11 home elasticsearch[24305]: OpenJDK 64-Bit Server VM warning:...)
Aug 12 22:48:11 home elasticsearch[24305]: at org.elasticsearch.tools.launch...)
Aug 12 22:48:11 home elasticsearch[24305]: at org.elasticsearch.tools.launch...)
Aug 12 22:48:11 home elasticsearch[24305]: at org.elasticsearch.tools.launch...)
Aug 12 22:48:11 home elasticsearch[24305]: at org.elasticsearch.tools.launch...)
Aug 12 22:48:11 home systemd[1]: elasticsearch.service: main process exited...RE
Aug 12 22:48:11 home systemd[1]: Unit elasticsearch.service entered failed ...e.
Aug 12 22:48:11 home systemd[1]: elasticsearch.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
yum clean all
yum install elasticsearch logstash kibana -y
cd /etc/logstash/
cp logstash-sample.conf logstash.conf
systemctl start logstash
systemctl start elasticsearch
systemctl start kibana
systemctl start logstash
Failed to start logstash.service: Unit not found.
未完待续...
参考:
ELK YUM方式快速安装
https://www.jianshu.com/p/81f516fa121a
Install Elasticsearch with RPM
https://www.elastic.co/guide/en/elasticsearch/reference/7.3/rpm.html#rpm-repo
ELK 系列一、Centos 7 安装ELK6.2.3
https://blog.csdn.net/wu2700222/article/details/82792708
如何在CentOS 7上安装Elasticsearch,Logstash和Kibana(ELK堆栈)
https://cloud.tencent.com/developer/article/1434686