随机生成密码用auto, 自己设置用 interactive

[root@njfdkb4bmk3b elasticsearch]# ./bin/elasticsearch-setup-passwords -h
Sets the passwords for reserved users
Commands
--------
auto - Uses randomly generated passwords
interactive - Uses passwords entered by a user
Non-option arguments:
command              
Option             Description        
------             -----------        
-E <KeyValuePair>  Configure a setting
-h, --help         Show help          
-s, --silent       Show minimal output
-v, --verbose      Show verbose output
[root@cfeeab4bb0eb elasticsearch]# ./bin/elasticsearch-setup-passwords auto
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
The passwords will be randomly generated and printed to the console.
Please confirm that you would like to continue [y/N]y
Changed password for user apm_system
PASSWORD apm_system = YxVzeT9B2jEDUjYp66Ws
Changed password for user kibana
PASSWORD kibana = 8NnThbj0N02iDaTGhidU
Changed password for user logstash_system
PASSWORD logstash_system = 9nIDGe7KSV8SQidSk8Dj
Changed password for user beats_system
PASSWORD beats_system = qeuVaf1VEALpJHfEUOjJ
Changed password for user remote_monitoring_user
PASSWORD remote_monitoring_user = DtZCrCkVTZsinRn3tW3D
Changed password for user elastic
PASSWORD elastic = q5f2qNfUJQyvZPIz57MZ

进入es的机器·

docker exec -it elasticsearch /bin/bash

创建一个临时的超级用户 RyanMiao

./bin/elasticsearch-users useradd ryan -r superuser
Enter new password: 
ERROR: Invalid password...passwords must be at least [6] characters long
[root@cfeeab4bb0eb elasticsearch]# ./bin/elasticsearch-users useradd ryan -r superuser
Enter new password: 
Retype new password: 

用这个用户去修改elastic用户的密码:

curl -XPUT -u ryan:ryan123 http://localhost:9200/_xpack/security/user/elastic/_password -H 
"Content-Type: application/json" -d '
  "password": "q5f2qNfUJQyvZPIz57MZ"

参考:http://www.likecs.com/show-99086.html

原文链接:
https://blog.csdn.net/qq_35425070/article/details/106096987 随机生成密码用auto, 自己设置用 interactive [root@njfdkb4bmk3b elasticsearch]# ./bin/elasticsearch-setup-passwords -h Sets the passwords for reserved users Commands -------- auto - Uses randomly genera  Elasticsearch 是一个开源的分布式 RESTful 搜索和分析引擎,具有现代、快速、分布式、可扩展、容错等优点。Elasticsearch 借助了 Apache Lucene 的能力,让你拥有更强的把控力,可以索引海量数据,并进行搜索。 一、环境准备 1.1 创建用户和组  Elasticsearch 5 版本开始,出于系统安全考虑设置,不再允许直接使用 root 用户启动了,会报 can not run elasticsearch as root 异常信息,所以需要将 Elasticsear 这里写目录标题前言一、elasticsearch设置密码二、kibana配置elasticsearch密码三、elasticsearch-head配置密码 之前在docker中安装过elasticsearch和elasticsearchhead以及kibana都没有配置密码,在此记录下设置过程。 一、elasticsearch设置密码 参考 官方 二、kibana配置elasticsearch密码 三、elasticsearch-head配置密码 当我们安装完ElasticSearch的时候发现,访问过程中我们没有任何安全认证就可以直接访问并操作。如果是生产环境,端口向外暴露的话,那么对数据的安全性是无法得到保障的。 一般解决方案有 开启ElasticSearch认证插件,访问的时候添加账密不就好了 当然也可以通过nginx作代理防护 本文主要讲解通过启用X-Pack来设置ElasticSearch的访问密码。 集群与单据环境都适合次方法 集群与单据环境配置的区别就是,集群需要在某一台生成证书然后拷贝到其它节点目录下。 集群环境重设 编辑 config/ elasticsearch.yml文件。2.将下载下来的安装包传入到需要配置密码的服务器中。如果不是相同的版本会报错,页面会显示main问题。1.下载和es相同版本的x-pack。5.修改elastic的默认密码。3.在es中安装xpack插件。记住x-pack插件无需解压。接下来中途会要你选择y即可。查询之前启动的elastic。kill -9 进程号。添加如下配置开启密码