# ES和Kibana设置账号密码


# 一、给ES设置账号密码

# 1、编辑config目录下的elasticsearch.yml文件

cd   cd /data0/es/elasticsearch-7.1.0/config/
vim  elasticsearch.yml
#添加如下内容
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

# 2、 设置密码


cd /data0/es/elasticsearch-7.1.0/bin/

./elasticsearch-setup-passwords interactive


命令执行后,会出现几句英文,大概的意思是:你如果确定开启密码的话,需要设置以下六种账户的密码elastic、apm_system、kibana、logstash_system、beats_system、remote_monitoring_user 输入y开始设置,六种密码设置完成后,需要再次重启ES容器

# 3、重启后,输入ES的访问地址:http://119.23.71.52:9200/这时已经提示让你输入账号密码了。

# 二、给Kibana设置账号密码

# 1、编辑config目录下的kibana.yml文件

 cd /data0/kibana/kibana-7.1.0-linux-x86_64/config/

vim kibana.yml


#添加以下内容
elasticsearch.username: "elastic"
elasticsearch.password: "你在es中设置的密码"

# 2、 重启kibana

ps -ef|grep kibana
ps -ef|grep 5601
都找不到

尝试 使用 fuser -n tcp 5601
kill -9 端口

ps -ef|grep node 或 netstat -anltp|grep 5601
启动即可 ./kibana
后台启动: nohup ./kibana >/dev/null 2>&1 &

Last Updated: 2/14/2023, 3:58:00 PM