0


ElasticSearch、kibana设置账户密码;ElasticSearch对外访问

文章目录

前言

今天在linux服务器上搭建elasticsearch索引库,但这段时间正在搞护网行动,所以elasticsearch和kibana就不能裸奔了,所以这篇文章我写了如何设置账户密码

  • elasticsearch 使用版本7.6.2
  • kibana 使用版本7.6.2

1. 设置elasticsearch账户密码,并且允许外部访问

  • 修改 elasticsearch.yml
# ------------------------------------ Node ------------------------------------## Use a descriptive name for the node:#node.name: node-1## Add custom attributes to the node:##node.attr.rack: r1## ---------------------------------- Network -----------------------------------## Set the bind address to a specific IP (IPv4 or IPv6):#network.host: 0.0.0.0
## Set a custom port for HTTP:#http.port:9200#transport.host: localhost#transport.tcp.port: 9300## For more information, consult the network module documentation.## ---------------------------------- Discovery -----------------------------------cluster.initial_master_nodes:["node-1"]xpack.security.enabled:true#xpack.licence.self_generated.type: basicxpack.security.transport.ssl.enabled:true

修改完配置文件之后

重新启动elasticsearch
./elasticsearch-setup-passwords interactive # 在elasticsearch/bin目录下执行该命令,设置密码

在这里插入图片描述
将elasticsearch的9200端口对外开放,这里我直接关闭防火墙

systemctl stop firewalld

下图所示,这里我外部已经

可以访问9200

了,并且访问需要

账号密码

在这里插入图片描述
外部访问成功
在这里插入图片描述

2. 设置kibana账户密码

  • 编辑 kibana.yml
# The URLs of the Elasticsearch instances to use for all your queries.elasticsearch.hosts:["http://localhost:9200"]# When this setting's value is true Kibana uses the hostname specified in the server.host# setting. When the value of this setting is false, Kibana uses the hostname of the host# that connects to this Kibana instance.#elasticsearch.preserveHost: true# Kibana uses an index in Elasticsearch to store saved searches, visualizations and# dashboards. Kibana creates a new index if the index doesn't already exist.#kibana.index: ".kibana"# The default application to load.#kibana.defaultAppId: "home"# If your Elasticsearch is protected with basic authentication, these settings provide# the username and password that the Kibana server uses to perform maintenance on the Kibana# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which# is proxied through the Kibana server.elasticsearch.username:"elastic"elasticsearch.password:"123546"
重新启动kibana

,访问已经需要登录了
在这里插入图片描述


本文转载自: https://blog.csdn.net/weixin_43627706/article/details/125393511
版权归原作者 fate急速出击 所有, 如有侵权,请联系我们删除。

“ElasticSearch、kibana设置账户密码;ElasticSearch对外访问”的评论:

还没有评论