Elasticsearch设置密码

news/2024/10/21 15:31:51/

Elasticsearch设置密码

    • 概述
    • ES开启认证
    • 配置密码
    • 访问开启安全认证的ES
      • curl
      • 浏览器直接访问
      • Kibana 配置 es认证
        • 直接配置用户名密码到 kibana.yml
        • 以kibana密钥的形式
        • 使用命令行启动参数形式指定用户名密码
    • 使用kibana 查看es用户

概述

ES默认没有开启安全组件,如果我们的es直接暴露在公网,那么开启认证是很有必要的。

ES开启认证

  • 修改 elasticsearch.yml
# 要么设置为单节点
discovery.type: single-node
# 要么按照错误提示,开启节点间ssl (肯定更推荐)
xpack.security.transport.ssl.enabled: true# 开启安全认证
xpack.security.enabled: true

如果只开启 xpack 安全认证,会出现以下错误

bootstrap check failure [1] of [1]: Transport SSL must be enabled if security is enabled on a [basic] license. 
Please set [xpack.security.transport.ssl.enabled] to [true] 
or disable security by 
setting [xpack.security.enabled] to [false]

配置密码

  • 启动es
  • 执行es提供的脚本,es会提示,给各个系统预留的用户设置密码,根据提示进行即可。
    Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user
# 根据提示,输入各个用户的密码
./bin/elasticsearch-setup-passwords interactive# 也可以让es,生成随机密码
./bin/elasticsearch-setup-passwords auto

在这里插入图片描述

访问开启安全认证的ES

curl

# 直接访问
[elastic@origin elasticsearch-7.14.0]$ curl 192.168.0.101:9200
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}[elastic@origin elasticsearch-7.14.0]$# 带上 用户名密码 (Http Basic 认证)
[elastic@origin elasticsearch-7.14.0]$ curl -u elastic:elastic 192.168.0.101:9200
{"name" : "origin.centos","cluster_name" : "elasticsearch","cluster_uuid" : "XVgPBZ78RdWRssPtuSeJTg","version" : {"number" : "7.14.0","build_flavor" : "default","build_type" : "tar","build_hash" : "dd5a0a2acaa2045ff9624f3729fc8a6f40835aa1","build_date" : "2021-07-29T20:49:32.864135063Z","build_snapshot" : false,"lucene_version" : "8.9.0","minimum_wire_compatibility_version" : "6.8.0","minimum_index_compatibility_version" : "6.0.0-beta1"},"tagline" : "You Know, for Search"
}

浏览器直接访问

在这里插入图片描述
输入用户名,密码后
在这里插入图片描述

Kibana 配置 es认证

直接配置用户名密码到 kibana.yml

编辑 kibana.yml

elasticsearch.username: "kibana_system"
elasticsearch.password: "kibana_system"

启动kibana,访问。
测试时,kibana.yml 中配置的用户,kibana_system 提示没有权限
在这里插入图片描述
直接用 kibana 更是提示用户名密码错误(后面才看到这个用户是过时内置用户),后面直接使用 elastic 用户登录成功。
在这里插入图片描述

以kibana密钥的形式

此种方式,无需用户名密码配置到kibana.yml 中。

# 创建密钥存储库
[elastic@origin kibana-7.14.0-linux-x86_64]$ ./bin/kibana-keystore create
Created Kibana keystore in /opt/kibana-7.14.0-linux-x86_64/config/kibana.keystore# 将 elasticsearch.username 添加到密钥库
[elastic@origin kibana-7.14.0-linux-x86_64]$ ./bin/kibana-keystore add elasticsearch.username
Enter value for elasticsearch.username: *******# 将 elasticsearch.password 添加到密钥库
[elastic@origin kibana-7.14.0-linux-x86_64]$ ./bin/kibana-keystore add elasticsearch.password
Enter value for elasticsearch.password: *******

使用命令行启动参数形式指定用户名密码

./bin/kibana --elasticsearch.username=elastic --elasticsearch.password=elastic 

使用kibana 查看es用户

首页 Stack Management > Security > Users
可以创建用户。
要使用kibana 面板的用户,至少需要 kibana admin 角色


http://www.ppmy.cn/news/439801.html

相关文章

黑苹果 声卡驱动 ID注入

黑苹果 声卡驱动 ID注入 1&#xff0c;黑苹果 声卡驱动 ID注入 1&#xff0c;黑苹果 声卡驱动 ID注入 <key>Audio</key><dict><key>AFGLowPowerState</key><true/><key>Inject</key><integer>15</integer><key…

服务器如何安装虚拟声卡,虚拟声卡安装方法和使用【图文教程】

导读&#xff1a;虚拟声卡可以在没有声卡机器的情况下&#xff0c;实现播放&#xff0c;是我们播放视频、音乐的好帮手。想要让视频音乐更方便的播放&#xff0c;就得使用虚拟声卡。仅仅一个软件就可以搞定&#xff0c;现在就让我们来看看它是怎么安装额呢?让我们用虚拟声卡来…

linux如何获取声卡信息,ubuntu下怎么查看声卡型号?

在Ubuntu上查看声卡型号执行如下命令&#xff1a; ~# lspci |grep -i audio ~/WorkSpace/mobvoi_test$ lspci |grep -i audio 02:02.0 Multimedia audio controller: Ensoniq ES1371 / Creative Labs CT2518/ES1373 (rev 02) 1、查看声卡信息 ~# cat /proc/asound/cards /WorkS…

嵌入式ARM下使用ALSA USB声卡

你好&#xff01;这里是风筝的博客&#xff0c; 欢迎和我一起多多交流。 使用Linux的一个好处就是里面集成了好多驱动&#xff0c;像USB声卡就是即插即用的&#xff0c;我们只需要下载一些使用库就ok、 我们现在要使用USB声卡&#xff0c;就需要alsa-lib和alsa-util的支持、 …

计算机视觉-语义分割: FCN DeepLab Unet

文章目录 1. 概要1.1 什么是语义分割1.2 语义分割作用1.3 全卷积网络1.4 反卷积1.5 上采样三种方式1.6 跳层结构 Skip Layer 2. FCN架构3. DeepLab-v13.1 改进点3.2 空洞卷积(Atrous/Dilated convolution) 4. U-Net参考 1. 概要 1.1 什么是语义分割 从像素水平上理解、识别图…

【技术选型】ActiveMQ、RocketMQ、RabbitMQ、Kafka对比

文章目录 概述几种MQ的对比综合以上对比后&#xff0c;有如下建议&#xff1a; 概述 MQ(Message Queue)&#xff0c;即消息队列。早已成为企业IT系统内部通信的核心手段。它具有低耦合、可靠投递、广播、流量控制、最终一致性等一系列功能&#xff0c;成为异步RPC的主要手段之…

【简单便捷】解决Ubuntu内存不足问题:Ubuntu16.0.4 进行内存扩容

文章目录 电脑环境前言一、总述二、先在标题&#xff1a;虚拟机-->设置上进行扩容三、扩容之后 打开终端 执行 sudo apt install gparted四、执行 sudo gparted五、扩容成功六、重启测试 可以看到大概率成功了。 电脑环境 Windows 11 专业版系统 前言 在开发初期&#xf…

基于Qt的光盘刻录开发

. 转载于:https://blog.51cto.com/weiyuqingcheng/1921369