閫氳繃docker鎼缓ELK闆嗙兢
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了閫氳繃docker鎼缓ELK闆嗙兢相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%9f%a5%e7%9c%8b' title='鏌ョ湅'>鏌ョ湅 discover manage 涓ゅ彴 stash 鏈哄櫒 end 鏁欑▼
- 鍗曟満ELK锛屽彟澶栦袱鍙版湇鍔″櫒鍒嗗埆鏈変竴涓猠lasticsearch鑺傜偣锛岃繖鏍峰舰鎴愪竴涓?鑺傜偣鐨凟S闆嗙兢銆?/li>
- 鍙互鍏堝皾璇曞崟鐙惌寤篹s闆嗙兢鎴栧崟鏈篍LK
- https://www.cnblogs.com/lz0925/p/12018209.html // 鍗曟満ELK
- https://www.cnblogs.com/lz0925/p/12011026.html // 涓夎妭鐐筫s闆嗙兢
棣栧厛瀹夎docker 鍜?docker-compose
# 鏇存柊yum
yum update
# 绉婚櫎docker鏃х増鏈?濡傛灉鏈夌殑璇?
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
# 瀹夎绯荤粺渚濊禆
yum install -y yum-utils device-mapper-persistent-data lvm2
# 娣诲姞docker婧愪俊鎭紙涓嬭浇閫熷害姣旇緝蹇級
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 鏇存柊yum缂撳瓨
yum makecache fast
# 瀹夎docker-ce
yum -y install docker-ce
# 鍚姩docker鍚庡彴鏈嶅姟
sudo systemctl start docker
# 閰嶇疆闃块噷浜戦暅鍍忓姞閫熷櫒锛堝缓璁繘琛岄厤缃? 杩欓噷鍔犻€熷櫒鍦板潃浠呯敤浜庡睍绀猴紝鏃犲姞閫熷姛鑳斤紝璇蜂娇鐢ㄨ嚜宸辩殑闃块噷浜戝姞閫熷櫒锛屾暀绋嬭鐧惧害锛屽姞閫熷櫒鍏嶈垂锛? mkdir /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://6y4h812t.mirror.aliyuncs.com"]}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
# 瀹夎docker-compose
cd /usr/local/src
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
# 鑷虫锛宒ocker 鍜宒ocker-compose瀹夎瀹屾瘯锛?濡傛湁閿欒锛岃鐣欒█锛屾瘯绔熸槸涔嬪墠鍐欑殑鑷姩瀹夎鑴氭湰copy杩囨潵鐨勩€?/code>
棣栧厛鎼缓涓夎妭鐐笶S闆嗙兢锛屼互涓嬫楠ゅ潎闇€鍦ㄤ笁鍙版湇鍔″櫒鎵ц
- 1銆佷娇鐢╠ocker-compose锛屽缓绔嬪瓨鏀緔ml鏂囦欢鐨勭洰褰?/li>
寤虹珛鏂囦欢澶癸紝/root/elk锛堥殢鎰忓嵆鍙級
mkdir /root/elk
- 2銆佸垱寤篸ocker-compose.yml鏂囦欢
cd /root/elk
touch docker-compose.yml
-3銆乨ocker-compose.yml 鐨勬枃浠跺唴瀹瑰涓?/p>
version: '3'
services:
elasticsearch: # 鏈嶅姟鍚嶇О
image: elasticsearch:7.3.1 # 浣跨敤鐨勯暅鍍? container_name: elasticsearch # 瀹瑰櫒鍚嶇О
restart: always # 澶辫触鑷姩閲嶅惎绛栫暐
environment:
- node.name=41 # 鑺傜偣鍚嶇О锛岄泦缇ゆā寮忎笅姣忎釜鑺傜偣鍚嶇О鍞竴
- network.publish_host=172.168.50.41 # 鐢ㄤ簬闆嗙兢鍐呭悇鏈哄櫒闂撮€氫俊,鍏朵粬鏈哄櫒璁块棶鏈満鍣ㄧ殑es鏈嶅姟
- network.host=0.0.0.0 # 璁剧疆缁戝畾鐨刬p鍦板潃锛屽彲浠ユ槸ipv4鎴杋pv6鐨勶紝榛樿涓?.0.0.0锛? - discovery.seed_hosts=172.168.50.40,172.168.50.240,172.168.50.41 # es7.x 涔嬪悗鏂板鐨勯厤缃紝鍐欏叆鍊欓€変富鑺傜偣鐨勮澶囧湴鍧€锛屽湪寮€鍚湇鍔″悗鍙互琚€変负涓昏妭鐐? - cluster.initial_master_nodes=172.168.50.40,172.168.50.240,172.168.50.41 # es7.x 涔嬪悗鏂板鐨勯厤缃紝鍒濆鍖栦竴涓柊鐨勯泦缇ゆ椂闇€瑕佹閰嶇疆鏉ラ€変妇master
- cluster.name=es-cluster # 闆嗙兢鍚嶇О锛岀浉鍚屽悕绉颁负涓€涓泦缇? # - http.cors.enabled=true # 鏄惁鏀寔璺ㄥ煙锛屾槸锛歵rue // 杩欓噷璁剧疆涓嶈捣浣滅敤锛屼絾鏄彲浠ヨ繘鍏ュ鍣ㄩ噷闈㈠湪elasticsearch.yml 鏂囦欢涓坊鍔狅紝鎴栬€呭皢姝ゆ枃浠舵槧灏勫埌瀹夸富鏈鸿繘琛屼慨鏀癸紝鐒跺悗閲嶅惎锛岃В鍐宠法鍩? # - http.cors.allow-origin="*" # 琛ㄧず鏀寔鎵€鏈夊煙鍚? // 杩欓噷璁剧疆涓嶈捣浣滅敤锛屼絾鏄彲浠ヨ繘鍏ュ鍣ㄩ噷闈㈠湪elasticsearch.yml 鏂囦欢涓坊鍔狅紝鎴栬€呭皢姝ゆ枃浠舵槧灏勫埌瀹夸富鏈鸿繘琛屼慨鏀癸紝鐒跺悗閲嶅惎锛岃В鍐宠法鍩? - bootstrap.memory_lock=true # 鍐呭瓨浜ゆ崲鐨勯€夐」锛屽畼缃戝缓璁负true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" # 璁剧疆鍐呭瓨
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /root/elk/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml # 灏嗗鍣ㄤ腑es鐨勯厤缃枃浠舵槧灏勫埌鏈湴锛岃缃法鍩燂紝 鍚﹀垯head鎻掍欢鏃犳硶杩炴帴璇ヨ妭鐐? - esdata:/usr/share/elasticsearch/data # 瀛樻斁鏁版嵁鐨勬枃浠讹紝 娉ㄦ剰锛氳繖閲岀殑esdata涓?椤剁骇volumes涓嬬殑涓€椤广€? ports:
- 9200:9200 # http绔彛
- 9300:9300 # es鑺傜偣鐩存帴浜や簰鐨勭鍙o紝闈瀐ttp
volumes:
esdata:
driver: local # 浼氱敓鎴愪竴涓搴旂殑鐩綍鍜屾枃浠讹紝濡備綍鏌ョ湅锛屼笅闈㈡湁璇存槑銆?/code>
- 4銆佸彟澶栦袱鍙版湇鍔″櫒涔熺収鐫€杩欎釜閰嶇疆杩涜閰嶇疆锛屼絾IP锛屼互鍙婅妭鐐瑰悕绉伴渶瑕佹敼涓€涓嬪嵆鍙€?/li>
- 5銆佸唴瀛樿缃紝涓夊彴鏈嶅姟鍣ㄩ兘闇€瑕?/li>
涓ょ鏂瑰紡锛?1銆佹満鍣ㄩ噸鍚悗闇€鍐嶆璁剧疆
sysctl -w vm.max_map_count=262144
2銆佺洿鎺ヤ慨鏀归厤缃枃浠讹紝 杩涘叆sysctl.conf鏂囦欢娣诲姞涓€琛岋紙瑙e喅瀹瑰櫒鍐呭瓨鏉冮檺杩囧皬闂锛?
vi /etc/sysctl.conf
sysctl vm.max_map_count=262144
sysctl -p 绔嬪嵆鐢熸晥
-6銆乪s鐨勯厤缃枃浠?/p>
- 鍦ㄥ綋鍓嶇洰褰曚笅"/root/elk" 鎵ц vim elasticsearch.yml
- elasticsearch.yml 鍐呭濡備笅锛?/li>
network.host: 0.0.0.0
http.cors.enabled: true # 璁剧疆璺ㄥ煙锛屼富瑕佺敤浜巋ead鎻掍欢璁块棶es
http.cors.allow-origin: "*"
- 7銆佸惎鍔╡s闆嗙兢, 涓夊彴鏈嶅姟鍣ㄤ緷娆℃墽琛?docker-compose up -d
- 8銆佺劧鍚庤闂?http://172.168.50.41:9200/_cluster/health?pretty 鏌ョ湅鏄惁闆嗙兢姝e父杩愯, 姝e父杩愯浼氳繑鍥炲涓嬩俊鎭?/li>
{
"cluster_name" : "es-cluster",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 3,
"number_of_data_nodes" : 3,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
- 9銆佷娇鐢╤ead鐩戞帶es闆嗙兢
// 鎷夊彇闀滃儚
docker pull mobz/elasticsearch-head:5
// 鍚姩
docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5
- 10銆佸湪娴忚鍣ㄨ緭鍏ttp://IP:9100
娉ㄦ剰锛孖P鍦板潃瑕佷娇鐢ㄤ綘es鎵€鍦ㄦ湇鍔″櫒鐨勫湴鍧€锛岀劧鍚庣偣鍑昏繛鎺ワ紝鍑虹幇绫讳技鐨勬樉绀鸿鏄庯紝娌¢棶棰橈紝杩欓噷鏄笁涓妭鐐癸紝鏄熸槦浠h〃master銆?
濡傛灉鐐瑰嚮杩炴帴娌℃湁鍙嶅簲锛孎12鏌ョ湅network鏄?03锛屾垨鑰?00锛屼絾鏄痗onsole涓彁绀鸿法鍩燂紝閭d箞璇存槑璺ㄥ煙璁剧疆鐨勬湁闂锛岀洿鎺ヨ繘鍏ュ鍣ㄤ腑锛屼娇鐢?docker exec -it 瀹瑰櫒ID /bin/bash 锛屾鏌?usr/share/elasticsearch/config/elasticsearch.yml鏂囦欢锛屾槸鍚︽湁浠ヤ笅涓よ锛? http.cors.enabled: true
http.cors.allow-origin: "*"
- 涓婇潰璇村埌鐨勯《绾olumes锛?濡備綍鏌ョ湅鎸傝浇鍗峰湪瀹夸富鏈虹殑浣嶇疆鍛紵
# docker volume create elk_data // 鍒涘缓涓€涓嚜瀹氫箟瀹瑰櫒鍗? # docker volume ls // 鏌ョ湅鎵€鏈夊鍣ㄥ嵎
# docker volume inspect elk_data // 鏌ョ湅鎸囧畾瀹瑰櫒鍗疯鎯呬俊鎭? 鍖呮嫭鐪熷疄鐩綍
娉ㄦ剰锛?濡傛灉浣犺鍒犻櫎涓€涓寕杞藉嵎锛屾垨鑰呴噸鏂扮敓鎴愶紝璇锋墽琛屽垹闄ゅ嵎鎿嶄綔
# docker volume rm edc-nginx-vol // 鐩存帴鎵ц杩欎釜鍛戒护锛屽悓鏃朵細鍒犻櫎鏂囦欢锛屼絾鏄厛鍒犻櫎鏂囦欢鐨勮瘽锛屽繀椤绘墽琛屾鍛戒护锛屽惁鍒欏彲鑳藉鑷磋鑺傜偣鏃犳硶鍔犲叆闆嗙兢銆?/code>
浠ヤ笂閮藉畬鎴愶紝鍒檈s涓夎妭鐐归泦缇ゆ惌寤哄畬鎴愶紝涓嬮潰淇敼172.168.50.41鏈嶅姟鍣ㄧ殑/root/elk/docker-compose.yml鏂囦欢锛屼箣鍓嶅彧鏄痚s锛岀幇鍦ㄥ皢鏀寔ELK
ELK 鍓嶇疆宸ヤ綔, 鍗囩骇pip锛岄鍏堟媺鍙栬浣跨敤鐨勯暅鍍?/h3>
yum -y install epel-release
yum -y install python-pip
// 鏇存柊pip
pip install --upgrade pip
// 涓嬭浇elasticsearch锛宭ogstash锛宬ibana锛?鑷猠s5寮€濮嬶紝涓€鑸笁涓蒋浠剁殑鐗堟湰閮戒繚鎸佷竴鑷翠簡銆?
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.1.1 && docker pull docker.elastic.co/logstash/logstash:7.1.1 && docker pull docker.elastic.co/kibana/kibana:7.1.1
ELK鎼缓
- 1銆佸缓绔嬪瓨鏀緀lk閰嶇疆鏂囦欢鐨勭洰褰曪紝
cd /root/elk
vim docker-compose.yml // 浣滀负docker-compose鍚姩elk杩欎竴缁勫鍣ㄧ殑寮曞鏂囦欢
- 2銆乨ocker-compose.yml鏂囦欢鍐呭濡備笅
version: '3'
services:
elasticsearch: # 鏈嶅姟鍚嶇О
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1 # 浣跨敤鐨勯暅鍍? container_name: elasticsearch7.1.1 # 瀹瑰櫒鍚嶇О
environment: # 鐜鍙橀噺
- node.name=node-41 # 鑺傜偣鍚嶇О锛岄泦缇ゆā寮忎笅姣忎釜鑺傜偣鍚嶇О鍞竴
- network.publish_host=172.168.50.41 # 鐢ㄤ簬闆嗙兢鍐呭悇鏈哄櫒闂撮€氫俊,鍏朵粬鏈哄櫒璁块棶鏈満鍣ㄧ殑es鏈嶅姟
- network.host=0.0.0.0 # 璁剧疆缁戝畾鐨刬p鍦板潃锛屽彲浠ユ槸ipv4鎴杋pv6鐨勶紝榛樿涓?.0.0.0锛? - discovery.seed_hosts=172.168.50.40,172.168.50.240,172.168.50.41 # es7.x 涔嬪悗鏂板鐨勯厤缃紝鍐欏叆鍊欓€変富鑺傜偣鐨勮澶囧湴鍧€锛屽湪寮€鍚湇鍔″悗鍙互琚€変负涓昏妭鐐? - cluster.initial_master_nodes=172.168.50.40,172.168.50.240,172.168.50.41 # es7.x 涔嬪悗鏂板鐨勯厤缃紝鍒濆鍖栦竴涓柊鐨勯泦缇ゆ椂闇€瑕佹閰嶇疆鏉ラ€変妇master
- cluster.name=es-cluster # 闆嗙兢鍚嶇О锛岀浉鍚屽悕绉颁负涓€涓泦缇? #- http.cors.enabled=true # 鏄惁鏀寔璺ㄥ煙锛屾槸锛歵rue锛屼富瑕佺敤浜巋ead鎻掍欢璁块棶es锛岃繖閲岃缃笉璧蜂綔鐢紝鍘熷洜鏈煡锛屾垜浠細灏唀s鐨勯厤缃枃浠舵槧灏勫埌瀹夸富鏈鸿繘琛屼慨鏀? #- http.cors.allow-origin="*" # 琛ㄧず鏀寔鎵€鏈夊煙鍚嶏紝鏄細true锛岃繖閲岃缃笉璧蜂綔鐢紝鍘熷洜鏈煡锛屾垜浠細灏唀s鐨勯厤缃枃浠舵槧灏勫埌瀹夸富鏈鸿繘琛屼慨鏀? - bootstrap.memory_lock=true # 鍐呭瓨浜ゆ崲鐨勯€夐」锛屽畼缃戝缓璁负true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" # 璁剧疆鍐呭瓨澶у皬
volumes:
- esdata:/usr/share/elasticsearch/data # 璁剧疆es鏁版嵁瀛樻斁鐨勭洰褰? - /root/elk/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml # 鏄犲皠es瀹瑰櫒涓殑閰嶇疆鏂囦欢鍒板涓绘満
hostname: elasticsearch # 鏈嶅姟hostname
ulimits: # 鏄惁闄愬埗鍐呭瓨
memlock:
soft: -1
hard: -1
restart: always # 閲嶅惎绛栫暐
ports:
- 9200:9200 # http绔彛
- 9300:9300 # es鑺傜偣鐩存帴浜や簰鐨勭鍙o紝闈瀐ttp
kibana:
image: docker.elastic.co/kibana/kibana:7.1.1
container_name: kibana7.1.1
environment:
- elasticsearch.hosts=http://elasticsearch:9200 # 璁剧疆杩炴帴鐨別s鑺傜偣
hostname: kibana
depends_on:
- elasticsearch # 渚濊禆es鏈嶅姟锛屼細鍏堝惎鍔╡s瀹瑰櫒鍦ㄥ惎鍔╧ibana
restart: always
ports:
- 5601:5601 # 瀵瑰璁块棶绔彛
logstash:
image: docker.elastic.co/logstash/logstash:7.1.1
container_name: logstash7.1.1
hostname: logstash
restart: always
depends_on:
- elasticsearch
ports:
- 9600:9600
- 5044:5044
volumes: # 椤剁骇volumes
esdata:
driver: local # 浼氱敓鎴愪竴涓搴旂殑鐩綍鍜屾枃浠讹紝濡備綍鏌ョ湅锛屼笅闈㈡湁璇存槑銆?
- 褰撳墠鐩綍鎵ц docker-compose up -d 鍚姩ELK鏈嶅姟
鍑虹幇done琛ㄧず鎴愬姛锛宒ocker-compose logs 鏌ョ湅鏃ュ織锛堝垎鍒緭鍑篹lk涓変釜鏈嶅姟鐨勬棩蹇楋級鎵цdocker ps -a 鍙互鐪嬪埌涓変釜鏈嶅姟鐨勮繍琛岀姸鎬? 鍦ㄦ祻瑙堝櫒杈撳叆http://IP:5601/ 璁块棶kibana
- 鍙﹀娉ㄦ剰閫氳繃head杩炴帴ELK鏈嶅姟鍣ㄧ殑es锛岀湅鐪嬫槸鍚︽甯歌繛鎺ワ紝濡傛灉涓変釜es鑺傜偣閮芥甯革紝http://IP:5601涔熷彲浠ユ甯歌闂紝閭d箞ELK闆嗙兢鎼缓瀹屾垚銆?/li>
鎺ヤ笅鏉ワ紝鎴戜細鍐欎竴绡囦娇鐢ㄥ浣曚娇鐢‥LK鐨勬枃绔犮€傚啓濂藉悗鎴戜細灏嗘枃绔犲湴鍧€璐村湪姝ゅ銆?/h3>
yum -y install epel-release
yum -y install python-pip
// 鏇存柊pip
pip install --upgrade pip
// 涓嬭浇elasticsearch锛宭ogstash锛宬ibana锛?鑷猠s5寮€濮嬶紝涓€鑸笁涓蒋浠剁殑鐗堟湰閮戒繚鎸佷竴鑷翠簡銆?
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.1.1 && docker pull docker.elastic.co/logstash/logstash:7.1.1 && docker pull docker.elastic.co/kibana/kibana:7.1.1
cd /root/elk
vim docker-compose.yml // 浣滀负docker-compose鍚姩elk杩欎竴缁勫鍣ㄧ殑寮曞鏂囦欢
version: '3'
services:
elasticsearch: # 鏈嶅姟鍚嶇О
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1 # 浣跨敤鐨勯暅鍍? container_name: elasticsearch7.1.1 # 瀹瑰櫒鍚嶇О
environment: # 鐜鍙橀噺
- node.name=node-41 # 鑺傜偣鍚嶇О锛岄泦缇ゆā寮忎笅姣忎釜鑺傜偣鍚嶇О鍞竴
- network.publish_host=172.168.50.41 # 鐢ㄤ簬闆嗙兢鍐呭悇鏈哄櫒闂撮€氫俊,鍏朵粬鏈哄櫒璁块棶鏈満鍣ㄧ殑es鏈嶅姟
- network.host=0.0.0.0 # 璁剧疆缁戝畾鐨刬p鍦板潃锛屽彲浠ユ槸ipv4鎴杋pv6鐨勶紝榛樿涓?.0.0.0锛? - discovery.seed_hosts=172.168.50.40,172.168.50.240,172.168.50.41 # es7.x 涔嬪悗鏂板鐨勯厤缃紝鍐欏叆鍊欓€変富鑺傜偣鐨勮澶囧湴鍧€锛屽湪寮€鍚湇鍔″悗鍙互琚€変负涓昏妭鐐? - cluster.initial_master_nodes=172.168.50.40,172.168.50.240,172.168.50.41 # es7.x 涔嬪悗鏂板鐨勯厤缃紝鍒濆鍖栦竴涓柊鐨勯泦缇ゆ椂闇€瑕佹閰嶇疆鏉ラ€変妇master
- cluster.name=es-cluster # 闆嗙兢鍚嶇О锛岀浉鍚屽悕绉颁负涓€涓泦缇? #- http.cors.enabled=true # 鏄惁鏀寔璺ㄥ煙锛屾槸锛歵rue锛屼富瑕佺敤浜巋ead鎻掍欢璁块棶es锛岃繖閲岃缃笉璧蜂綔鐢紝鍘熷洜鏈煡锛屾垜浠細灏唀s鐨勯厤缃枃浠舵槧灏勫埌瀹夸富鏈鸿繘琛屼慨鏀? #- http.cors.allow-origin="*" # 琛ㄧず鏀寔鎵€鏈夊煙鍚嶏紝鏄細true锛岃繖閲岃缃笉璧蜂綔鐢紝鍘熷洜鏈煡锛屾垜浠細灏唀s鐨勯厤缃枃浠舵槧灏勫埌瀹夸富鏈鸿繘琛屼慨鏀? - bootstrap.memory_lock=true # 鍐呭瓨浜ゆ崲鐨勯€夐」锛屽畼缃戝缓璁负true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" # 璁剧疆鍐呭瓨澶у皬
volumes:
- esdata:/usr/share/elasticsearch/data # 璁剧疆es鏁版嵁瀛樻斁鐨勭洰褰? - /root/elk/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml # 鏄犲皠es瀹瑰櫒涓殑閰嶇疆鏂囦欢鍒板涓绘満
hostname: elasticsearch # 鏈嶅姟hostname
ulimits: # 鏄惁闄愬埗鍐呭瓨
memlock:
soft: -1
hard: -1
restart: always # 閲嶅惎绛栫暐
ports:
- 9200:9200 # http绔彛
- 9300:9300 # es鑺傜偣鐩存帴浜や簰鐨勭鍙o紝闈瀐ttp
kibana:
image: docker.elastic.co/kibana/kibana:7.1.1
container_name: kibana7.1.1
environment:
- elasticsearch.hosts=http://elasticsearch:9200 # 璁剧疆杩炴帴鐨別s鑺傜偣
hostname: kibana
depends_on:
- elasticsearch # 渚濊禆es鏈嶅姟锛屼細鍏堝惎鍔╡s瀹瑰櫒鍦ㄥ惎鍔╧ibana
restart: always
ports:
- 5601:5601 # 瀵瑰璁块棶绔彛
logstash:
image: docker.elastic.co/logstash/logstash:7.1.1
container_name: logstash7.1.1
hostname: logstash
restart: always
depends_on:
- elasticsearch
ports:
- 9600:9600
- 5044:5044
volumes: # 椤剁骇volumes
esdata:
driver: local # 浼氱敓鎴愪竴涓搴旂殑鐩綍鍜屾枃浠讹紝濡備綍鏌ョ湅锛屼笅闈㈡湁璇存槑銆?
鍑虹幇done琛ㄧず鎴愬姛锛宒ocker-compose logs 鏌ョ湅鏃ュ織锛堝垎鍒緭鍑篹lk涓変釜鏈嶅姟鐨勬棩蹇楋級鎵цdocker ps -a 鍙互鐪嬪埌涓変釜鏈嶅姟鐨勮繍琛岀姸鎬? 鍦ㄦ祻瑙堝櫒杈撳叆http://IP:5601/ 璁块棶kibana
以上是关于閫氳繃docker鎼缓ELK闆嗙兢的主要内容,如果未能解决你的问题,请参考以下文章