目录

Elastic_search-添加帐号密码

# 编辑elasticsearch.yml

elasticsearch.yml中追加内容

# 设置必须要登录
xpack.security.enabled: true
# 设置加密方式
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
1
2
3
4
5

# 重启es

# 生成帐号密码

如果你的服务器是Centos7,可以直接执行

/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
1

否则可以通过命令寻找

find / -name 'elasticsearch-setup-passwords'
1

# 输入密码

此时你的终端中会出现提示输入对应帐号的密码即可。

提示

Your cluster health is currently RED. This means that some cluster data is unavailable and your cluster is not fully functional.

It is recommended that you resolve the issues with your cluster before running elasticsearch-setup-passwords. It is very likely that the password changes will fail when run against an unhealthy cluster.

Do you want to continue with the password setup process [y/N]Y

Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user. You will be prompted to enter passwords as the process progresses. Please confirm that you would like to continue [y/N]Y

Enter password for [elastic]: Reenter password for [elastic]: Enter password for [apm_system]: Reenter password for [apm_system]: Enter password for [kibana_system]: Reenter password for [kibana_system]: Enter password for [logstash_system]: Reenter password for [logstash_system]: Enter password for [beats_system]: Reenter password for [beats_system]: Enter password for [remote_monitoring_user]:

# 简单加密

警告

ajax连接极度不安全,所以我做了一个简单加密。但是仍不推荐这么做

1.点击我打开网页进行加密 (opens new window)

2.输入格式:elastic:password

3.此时你会得到一串字符串,这就是我们需要使用的帐号密码加密串。

# ajax设置

在你的header中添加

Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==
1

提示

注意Basic和后面的字符串中需要有个空格,我被这个耽搁了半个小时

上次更新: 2024-01-03, 13:22:13
最近更新
01
2023年度总结
01-03
02
MongoDB的简单的常用语法
12-11
03
cetnos7通过nfs共享磁盘文件
11-24
更多文章>