<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
使用docker安裝elastic search和kibana,版本均為7.17.1
去dockerhub看具體版本,這裡用7.17.1
docker pull elasticsearch:7.17.1 docker pull kibana:7.17.1
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms256m -Xmx256m" elasticsearch:7.17.1
引數說明
確保成功啟動
docker ps
執行
mkdir -p /data/elasticsearch/{config,data,logs,plugins} yml
將容器內檔案拷貝出來
docker cp elasticsearch:/usr/share/elasticsearch/config /data/elasticsearch docker cp elasticsearch:/usr/share/elasticsearch/logs /data/elasticsearch docker cp elasticsearch:/usr/share/elasticsearch/data /data/elasticsearch docker cp elasticsearch:/usr/share/elasticsearch/plugins /data/elasticsearch
設定elasticsearch.yml的內容
vi /data/elasticsearch/config/elasticsearch.yml
確保有以下幾個設定,原有的設定可以不改動
cluster.name: "docker-cluster" network.hosts:0.0.0.0 # 跨域 http.cors.allow-origin: "*" http.cors.enabled: true http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
docker stop elasticsearch docker rm elasticsearch
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -v /data/elasticsearch/logs:/usr/share/elasticsearch/logs -v /data/elasticsearch/data:/usr/share/elasticsearch/data -v /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins -v /data/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml elasticsearch:7.17.1
等docker容器起來一分鐘左右,再存取9200 埠,會返回
因為安裝的是V7版本的,預設沒開啟x-pack(v8預設開啟),所以能直接存取
[root@iZuf6ai62xce7wexx4wwi9Z config]# curl "http://localhost:9200" { "name" : "6a1036c69d59", "cluster_name" : "docker-cluster", "cluster_uuid" : "0zgLiGhESGKQYTYy9gH4iA", "version" : { "number" : "7.17.1", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "e5acb99f822233d62d6444ce45a4543dc1c8059a", "build_date" : "2022-02-23T22:20:54.153567231Z", "build_snapshot" : false, "lucene_version" : "8.11.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } [root@iZuf6ai62xce7wexx4wwi9Z config]#
docker run -d --name kibana -p 5601:5601 kibana:7.17.1
mkdir -p /data/kibana/config docker cp kibana:/usr/share/kibana/config /data/kibana/
在本地就能看到拷貝出來的kibana.yml檔案,
vim /data/kibana/config/kibana.yml
修改設定為
# # ** THIS IS AN AUTO-GENERATED FILE ** # # Default Kibana configuration for docker target server.host: "0" server.shutdownTimeout: "5s" elasticsearch.hosts: [ "http://localhost:9100" ] # 記得修改ip monitoring.ui.container.elasticsearch.enabled: true i18n.locale: "zh-CN"
停掉舊的
docker stop kibana docker rm kibana
重新啟動掛載了地址的新的容器
docker run -d --name kibana -p 5601:5601 -v /data/kibana/config:/usr/share/kibana/config kibana:7.17.1
存取kibana發現需要token
進入es容器獲取token
docker exec -it {elastic_search_container_id} /bin/bash bin/elasticsearch-create-enrollment-token --scope kibana
拷貝token到kibana的ui上輸入
進入kibana容器獲取token
docker exec -it kibana /bin/bash # 執行生成驗證碼命令 bin/kibana-verification-code
進入es容器
docker exec -it {elastic_search_container_id} /bin/bash bin/elasticsearch-reset-password --username elastic -i
後面就使用elastic賬戶和密碼登入kibana
es開啟x-pack
vim /data/elasticsearch/config/elasticsearch.yml
增加以下xpack.security.enabled
cluster.name: "docker-cluster-01" network.host: 0.0.0.0 http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type # 此處開啟xpack xpack.security.enabled: true
重啟es容器
docker restart elasticsearch
進入es容器修改密碼
docker exec -ti elasticsearch /bin/bash /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
然後會分別讓重置以下的密碼,這裡重置成123456
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]: passwords must be at least [6] characters long Try again. 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]: Reenter password for [remote_monitoring_user]: Changed password for user [apm_system] Changed password for user [kibana_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]
重置完畢之後帶上使用者就可以存取了
[root@k8s-master ~]# curl localhost:9200 -u elastic Enter host password for user 'elastic': { "name" : "cd52e7fbacd1", "cluster_name" : "docker-cluster", "cluster_uuid" : "0S-V9zElSie_zXtcDRssAQ", "version" : { "number" : "8.1.2", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "31df9689e80bad366ac20176aa7f2371ea5eb4c1", "build_date" : "2022-03-29T21:18:59.991429448Z", "build_snapshot" : false, "lucene_version" : "9.0.0", "minimum_wire_compatibility_version" : "7.17.0", "minimum_index_compatibility_version" : "7.0.0" }, "tagline" : "You Know, for Search" } [root@k8s-master ~]#
修改組態檔
vi /data/kibana/config/kibana.yml
# # ** THIS IS AN AUTO-GENERATED FILE ** # # Default Kibana configuration for docker target server.host: "0" server.shutdownTimeout: "5s" elasticsearch.hosts: [ "http://172.17.0.3:9200" ] monitoring.ui.container.elasticsearch.enabled: true i18n.locale: "zh-CN" # 此處設定elastic的使用者名稱和密碼 elasticsearch.username: elastic elasticsearch.password: "123456"
重啟容器
docker restart kibana
docker run -d --name=elasticsearch-head -p 9100:9100 mobz/elasticsearch-head:5-alpine
連線叢集 不能連localhost:9200,而是
http://{ip}:9200/
後續帶x-pack的認證資訊的存取
url上帶上使用者名稱密碼
http://{ip}:9100/?auth_user=elastic&auth_password=123456
到此這篇關於docker安裝elastic search和kibana的實現的文章就介紹到這了,更多相關docker安裝elastic search和kibana內容請搜尋it145.com以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援it145.com!
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45