您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關(guān)Docker中怎么部署elasticsearch,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
version: '2' services: elasticsearch: image: elasticsearch:7.12.0 container_name: es01 environment: - "discovery.type=single-node" - "ES_JAVA_OPTS=-Xmx256m -Xms256m" - xpack.security.enabled=true - xpack.license.self_generated.type=basic - xpack.security.transport.ssl.enabled=true volumes: - /opt/docker/elasticsearch/data:/usr/share/elasticsearch/data:rw - /opt/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins - /opt/docker/elasticsearch/logs:/usr/share/elasticsearch/logs ports: - "9200:9200" - "9300:9300" networks: - elk networks: elk: driver: bridge
繼部署單機(jī),快速使用后,設(shè)置密碼只需要加上xpack相關(guān)配置即可
重啟容器(docker-compose restart)后,進(jìn)入容器生成密碼
# 進(jìn)入容器 root# docker exec -it es01 /bin/bash # 在容器內(nèi),執(zhí)行自動(dòng)生成密碼命令 [root@8b97a00d4223 elasticsearch]# bin/elasticsearch-setup-passwords auto Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,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 = *** Changed password for user kibana_system PASSWORD kibana_system = *** Changed password for user kibana PASSWORD kibana = *** Changed password for user logstash_system PASSWORD logstash_system = *** Changed password for user beats_system PASSWORD beats_system = *** Changed password for user remote_monitoring_user PASSWORD remote_monitoring_user = *** Changed password for user elastic PASSWORD elastic = ***
至此密碼已經(jīng)設(shè)置成功,可以使用對(duì)應(yīng)用戶名和密碼訪問了,***為自動(dòng)生成的密碼,記住即可。
若要重置密碼,修改配置,注釋掉這一行配置后重啟容器:
#- xpack.security.enabled=true
然后訪問
curl -XGET "http://localhost:9200/_cat/indices?pretty" -H 'Content-Type: application/json'
會(huì)出現(xiàn)一個(gè)索引: .security-7 ,刪除即可
curl -XDELETE http://localhost:9200/.security-7
看完上述內(nèi)容,你們對(duì)Docker中怎么部署elasticsearch有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。