一、安装JDK
1.卸载CentOS自带jdk
rpm -qa|grep java
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.242.b08-0.el8_1.x86_64
2.验证一下是还有jdk
rpm -qa|grep java
java -version
3.安装jdk
sudo yum search java-11
sudo yum install java-11-openjdk.x86_64 -y
二、安装ES7.13.2
1. 下载ES安装包
cd /usr/local
mkdir elastic7_13_2
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.2-x86_64.rpm
rpm -ivh elasticsearch-7.13.2-x86_64.rpm
2. 修改配置yml文件
Elasticsearch 数据存储在 /var/lib/elasticsearch
目录
配置文件在/etc/elasticsearch
目录
cd /etc/elasticsearch/
vi elasticsearch.yml
修改elasticsearch.yml, 开启远程访问连接 开启账号密码登录,内容如下:
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
network.host: 0.0.0.0
http.port: 9200 (端口)
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
添加配置xx.options
cd jvm.options.d/
touch xx.options
vi xx.options
填入配置内容如下,限制使用的内存大小
-Xms768m
-Xmx768m
3.设置开机启动
sudo systemctl daemon-reload # 重新加载systemd程序的配置文件
sudo systemctl enable elasticsearch.service # 设置开机自启动
sudo systemctl disable elasticsearch.service # 删除开机自启动
sudo systemctl start elasticsearch.service # 启动服务
sudo systemctl restart elasticsearch # 重启服务
4.生成账号密码
到ES安装路径下使用elasticsearch-setup-passwords interactive
命令生成用户密码 ( rpm -qal |grep elasticsearch
查找ES安装路径)
/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
5.测试访问
本地测试访问
curl -X GET "localhost:9200/"
远程测试访问
防火墙开启9200端口(在新开的elasticsearch域)
sudo firewall-cmd --new-zone=elasticsearch --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=elasticsearch --add-source=192.168.0.106/32 --permanent //只允许远程ip 192.168.0.106访问9200端口
sudo firewall-cmd --zone=elasticsearch --add-port=9200/tcp --permanent
sudo firewall-cmd --reload
防火墙开启5601端口(公共域)
sudo firewall-cmd --zone=public --add-port=5601/tcp --permanent
sudo firewall-cmd --reload
查看防火墙某个端口是否开放
firewall-cmd --query-port=9200/tcp
6. 其它命令
删除ES7.13.2
sudo systemctl stop elasticsearch.service
sudo yum remove elasticsearch 或 rpm -e elasticsearch #删除es
三、安装Kibana 7.13.2
1.下载Kibana安装包
cd /usr/local/elastic7_13_2
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.13.2-x86_64.rpm
2.rpm包下载完成后直接执行如下
rpm -ivh kibana-7.13.2-x86_64.rpm
3.修改配置文件
vi /etc/kibana/kibana.yml
# 找到server.host: 这行,修改如下:
server.host: "0.0.0.0"
# 找到elasticsearch.hosts: 这行,修改如下:
elasticsearch.hosts: ["http://localhost:9200"] # 此处ip地址为服务器内网IP地址。端口为es端口
elasticsearch.username: "kibana_system"
elasticsearch.password: "123456"
# 找到i18n.locale:这行,修改如下:
i18n.locale: "zh-CN" #此处是修改为中文
4.设置开机启动
sudo systemctl daemon-reload # 重新加载systemd程序的配置文件
sudo systemctl enable kibana.service # 设置开机自启动
sudo systemctl start kibana.service # 启动服务
sudo systemctl restart kibana # 重启服务
# 防火墙开启5601端口(公共域)
sudo firewall-cmd --zone=public --add-port=5601/tcp --permanent
sudo firewall-cmd --reload
5.其它命令
删除kibana7.13.2
sudo systemctl disable kibana.service 删除开机启动
sudo systemctl stop kibana.service
sudo yum remove kibana 或 rpm -e kibana 删除kibana