下载包(官网下载)

elasticsearch-7.6.2-linux-x86\_64.tar.gz

kibana-7.6.2-linux-x86\_64.tar.gz

解压

tar zxvf elasticsearch-7.6.1-linux-x86_64.tar.gz
tar zxvf kibana-7.6.1-linux-x86_64.tar.gz

移动解压后资源文件

sudo mv elasticsearch-7.6.1 /usr/local/
sudo mv kibana-7.6.1 /usr/local/

新增用户组与用户运行es

groupadd es
useradd es -g es -p 123456

权限给到root之外的用户组

chown -R es:es /usr/local/elasticsearch/

编辑es配置文件

vim /usr/local/elasticsearch/config/elasticsearch.yml

# 直接加进去就好 不用动原有带#的
# 配置为0.0.0.0可从任意IP访问ES 
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
#集群配置要加不然会报错
discovery.seed_hosts: ["192.168.188.128"]
cluster.initial_master_nodes: ["node-1"]

kibana 配置

server.port: 5601
# 配置为0.0.0.0可从任意IP访问Kibana
server.host: "0.0.0.0"
# # 7.x.x之后kibana就提供了可汉化的配置项
i18n.locale: "zh-CN"

elasticsearch.hosts: ["http://192.168.188.128:9200"]
kibana.index: ".kibana"
#默认30000
elasticsearch.requestTimeout: 90000

启动ES && kibana

/usr/local/elasticsearch/bin/elasticsearch
/usr/local/elasticsearch-7.6.2/bin/elasticsearch

常见报错解决:

  1. ES Exception in thread "main" 2023-08-03 20:16:40,107 main ERROR No Log4j 2 
# 原因 应该log4j 没有安装

yum install -y log4j
  1. Exception in thread "main" java.nio.file.AccessDeniedException: /u  
    出现这个是权限问题 如果参照chown -R命令
  2. max file descriptors \[4096] for elasticsearch process is too low, increase to at least \[65536]
vim /etc/security/limits.conf

# 前面的ES是用户的标识 
es soft nofile 65535
es hard nofile 65537
  1. Es the default discovery settings are unsuitable for production use; 
#加上就不会报错了
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]