給docker創(chuàng)建的elasticsearch容器添加密碼簡(jiǎn)單步驟
一、修改配置文件
1.進(jìn)入容器
docker exec -it elasticsearch bash
2.啟用認(rèn)證
vi config/elasticsearch.yml#添加如下內(nèi)容
http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-headers: Authorization xpack.security.enabled: true xpack.security.transport.ssl.enabled: true
3.保存后,退出容器,重啟ES
docker restart elasticsearch
二、設(shè)置用戶密碼
1.上一步重啟ES容器后,再次進(jìn)入容器:
docker exec -it elasticsearch /bin/bash
2.再次進(jìn)入容器后,執(zhí)行以下命令
./bin/elasticsearch-setup-passwords interactive
出現(xiàn):Initiating the setup of passwords for reserved users elastic,apm_system,kibana,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]
上邊英文大概的意思是:你如果確定開(kāi)啟密碼的話,需要設(shè)置以下六種賬戶的密碼(建議設(shè)置成一樣的)
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]: Reenter password for [kibana]: 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]: Reenter password for [remote_monitoring_user]: Changed password for user [apm_system] Changed password for user [kibana] Changed password for user [logstash_system] Changed password for user [beats_system] Changed password for user [remote_monitoring_user] Changed password for user [elastic]
3.完成以上的設(shè)置后,需要再次重啟ES容器
docker restart es
三、驗(yàn)證
http://127.0.0.1:9200/
附:docker elasticsearch 設(shè)置隨機(jī)密碼
1. 進(jìn)入容器內(nèi)部, 我es 服務(wù)得命名為elasticsearch,改為你自己命名得es容器即可
docker exec -it elasticsearch /bin/bash # 進(jìn)入容器內(nèi)部
2. 進(jìn)入配置文件夾
cd config/

3. 在elasticsearch.yml 添加下面得內(nèi)容, 編輯命令 vi elasticserch.yml
xpack.security.enabled: true xpack.license.self_generated.type: basic xpack.security.transport.ssl.enabled: true
4. 重啟服務(wù),并再次進(jìn)入容器內(nèi)部
docker restart elasticsearch
5. 輸入自動(dòng)生成密碼命令即可 生成密碼
# 查看密碼生成策略 ./bin/elasticsearch-setup-passwords -h # 這個(gè)為自動(dòng)生成密碼 命令 ./bin/elasticsearch-setup-passwords auto 出現(xiàn)這個(gè)選擇 輸入y 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
總結(jié)
到此這篇關(guān)于給docker創(chuàng)建的elasticsearch容器添加密碼的文章就介紹到這了,更多相關(guān)docker elasticsearch容器添加密碼內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
淺談Docker運(yùn)行Tensorboard和jupyter的方法
本篇文章主要介紹了淺談Docker 運(yùn)行Tensorboard 和 jupyter的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-03-03
在 docker 之間導(dǎo)出導(dǎo)入鏡像的方法
本篇文章主要介紹了在 docker 之間導(dǎo)出導(dǎo)入鏡像的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-07-07
docker-compose教程之安裝使用和快速入門(mén)
這篇文章主要介紹了docker-compose教程之安裝使用和快速入門(mén),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01
Docker使用Qwen2.5-0.5B-Instruct搭建個(gè)人專(zhuān)屬AI聊天機(jī)器人
本文介紹了如何在星圖GPU平臺(tái)上自動(dòng)化部署Qwen2.5-0.5B-Instruct鏡像,快速搭建個(gè)人專(zhuān)屬AI聊天機(jī)器人,通過(guò)簡(jiǎn)單的Docker命令即可完成部署,實(shí)現(xiàn)智能對(duì)話功能,感興趣的可以了解一下2026-04-04
docker鏡像導(dǎo)入的實(shí)現(xiàn)方法
如果服務(wù)器網(wǎng)絡(luò)不好或者pull不下來(lái)鏡像,只能進(jìn)行導(dǎo)入,本文主要介紹了docker鏡像導(dǎo)入的實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的可以了解一下2023-09-09
如何解決docker鏡像在不同cpu架構(gòu)上運(yùn)行容器報(bào)錯(cuò)問(wèn)題
文章主要介紹了如何查看本地Docker鏡像的CPU架構(gòu)類(lèi)型,并提供了解決x86鏡像無(wú)法在ARM CPU上運(yùn)行的問(wèn)題的方法,通過(guò)在Dockerfile中使用`--platform`參數(shù)指定CPU架構(gòu),可以在構(gòu)建鏡像時(shí)選擇正確的版本,從而解決架構(gòu)不匹配的問(wèn)題2024-12-12

