CentOS系统环境搭建(十七)——elasticsearch设置密码

centos系统环境搭建专栏🔗点击跳转

elasticsearch设置密码

没有密码是很不安全的一件事😭

文章目录

1.设置密码

关于Elasticsearch的安装请看CentOS系统环境搭建(十二)------CentOS7安装Elasticsearch。这些只是让你关闭与重启es,关闭与重启es若你有自己的方法不必参考本文。

先关掉elasticsearch

bash 复制代码
cd /usr/local/elasticsearch-7.17.6/bin
bash 复制代码
./killes.sh

编辑elasticsearch.yml

bash 复制代码
vim /usr/local/elasticsearch-7.17.6/config/elasticsearch.yml

最下面写上

bash 复制代码
#设置密码后的访问配置
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true

后台启动(重启es),记得切换非root用户

bash 复制代码
sh /usr/local/elasticsearch-7.17.6/bin/elasticsearch -d

设置密码

bash 复制代码
/usr/local/elasticsearch-7.17.6/bin/elasticsearch-setup-passwords interactive

指令elasticsearch-setup-passwords位于你es安装目录bin里,执行后会让你开始设置你的自定义密码,一定要牢记密码。

2.登录elasticsearch

进入es页面会出现如图提示,es用户名默认为elastic,而密码是你刚刚设置的。这样输入正确后才能看到这个页面。

3.登录kibana

关于kibana的安装请看CentOS系统环境搭建(十五)------CentOS安装Kibana。这些只是让你关闭与重启kibana,关闭与重启kibana若你有自己的方法不必参考本文。

先关闭kibana

bash 复制代码
kill $(ps -ef | grep kibana | grep -v grep | awk '{print $2}')

编辑kibana.yml

bash 复制代码
vim /usr/local/kibana-7.17.6-linux-x86_64/config/kibana.yml

末尾添加

bash 复制代码
elasticsearch.username: "kibana"
elasticsearch.password: "你开始设置你的自定义密码"

后台启动

bash 复制代码
nohup /usr/local/kibana-7.17.6-linux-x86_64/bin/kibana &

访问网页,它将要求你输入登录用户名和密码

这里的用户名同样默认为elastic,而密码是你刚刚设置的。

登录后便可正常使用kibana。

4.登录elasticsearch-head

复制代码
http://ip:9100/?auth_user=elastic&auth_password=你设置的密码

这里是同样的,用户名默认为elastic,而密码是你刚刚设置的。

然后你将如图没设置密码时一样正常访问。

这里的诀窍在于步骤一的伏笔,这也是elasticsearch-head如何设置密码登录的诀窍。

相关推荐
@泽栖3 小时前
ES数据聚合
elasticsearch·搜索引擎
keson要进步3 小时前
CICD实战(一) -----Jenkins的下载与安装
运维·ci/cd·centos·自动化·jenkins
張萠飛7 小时前
Linux下如何使用shell脚本导出elasticsearch中某一个index的数据为本地csv文件
linux·运维·elasticsearch
LanLance9 小时前
ES101系列09 | 运维、监控与性能优化
java·运维·后端·elasticsearch·云原生·性能优化·golang
疯狂的沙粒12 小时前
如何通过git命令查看项目连接的仓库地址?
大数据·git·elasticsearch
IT成长日记15 小时前
Elasticsearch集群手动分片分配指南:原理与实践
大数据·elasticsearch·手动分片分配
啵啵学习1 天前
Linux 里 su 和 sudo 命令这两个有什么不一样?
linux·运维·服务器·单片机·ubuntu·centos·嵌入式
龙仔7251 天前
华为云CentOS配置在线yum源,连接公网后,逐步复制粘贴,看好自己对应的版本即可,【新手必看】
linux·centos·华为云
tiging1 天前
centos实现SSH远程登录
linux·centos·ssh
Elastic 中国社区官方博客1 天前
Elastic 获得 AWS 教育 ISV 合作伙伴资质,进一步增强教育解决方案产品组合
大数据·人工智能·elasticsearch·搜索引擎·云计算·全文检索·aws