目錄
- 準(zhǔn)備工作
- 安裝elasticsearch
- 修改系統(tǒng)參數(shù)
- 啟動elasticsearch
- 創(chuàng)建持久化目錄 并拷貝數(shù)據(jù)
- docker-compose編排部署es,skywalking
- agent部署
- 總結(jié)
準(zhǔn)備工作
下載源碼包,下面會用到agent
https://archive.apache.org/dist/skywalking/6.6.0/apache-skywalking-apm-6.6.0.tar.gz
拉取鏡像
docker pull elasticsearch:7.5.1 docker pull apache/skywalking-oap-server:6.6.0-es7 docker pull apache/skywalking-ui:6.6.0
安裝elasticsearch
修改系統(tǒng)參數(shù)
vi /etc/sysctl.conf vm.max_map_count=262144 #調(diào)整參數(shù) sysctl -p #刷新參數(shù)
啟動elasticsearch
docker run -d --name=es7 \ -p 9200:9200 -p 9300:9300 \ -e "discovery.type=single-node" elasticsearch:7.5.1
創(chuàng)建持久化目錄 并拷貝數(shù)據(jù)
mkdir -p /data/elasticsearch docker cp es7:/usr/share/elasticsearch/data /data/elasticsearch/ docker cp es7:/usr/share/elasticsearch/logs /data/elasticsearch/ docker rm -f es7
docker-compose編排部署es,skywalking
創(chuàng)建編排文件
cd /data && touch docker-compose.yml tar -zxvf apache-skywalking-apm-6.6.0.tar.gz #解壓源碼以便后續(xù)使用agent
編輯編排文件
version: '3' networks: cq-data-security: ##我這里選擇了已有網(wǎng)卡,與我java項目網(wǎng)卡一致可以容器之間相互通信,具體需求看自己 external: true services: es7: image: elasticsearch:7.5.1 container_name: es7 expose: - 9200 - 9300 restart: always volumes: - /data/elasticsearch/data:/usr/share/elasticsearch/data - /data/elasticsearch/logs:/usr/share/elasticsearch/logs environment: - TZ=Asia/Shanghai - LANG=en_US.UTF-8 - discovery.type=single-node networks: cq-data-security: ipv4_address: 172.62.0.51 skywalking-oap-server: image: apache/skywalking-oap-server:6.6.0-es7 container_name: skywalking-oap-server expose: - 12800 - 11800 privileged: true restart: always environment: - TZ=Asia/Shanghai - LANG=en_US.UTF-8 - SW_STORAGE=elasticsearch - SW_STORAGE_ES_CLUSTER_NODES=172.62.0.51:9200 networks: cq-data-security: ipv4_address: 172.62.0.52 skywalking-ui: image: apache/skywalking-ui:6.6.0 container_name: skywalking-ui ports: - 28080:8080 privileged: true restart: always environment: - SW_OAP_ADDRESS=172.62.0.52:12800 networks: cq-data-security: ipv4_address: 172.62.0.53
docker-compose up -d 直接啟動即可
訪問localhost:28080 ui訪問
agent部署
cd /data cp -r apache-skywalking-apm-bin/agent /你的項目目錄/dockerfile所在目錄
#編輯dockerfile將以下參數(shù)加入dockerfile RUN mkdir /root/agent COPY ./agent /root/agent
#修改java應(yīng)用啟動參數(shù)
java -javaagent:/root/agent/skywalking-agent.jar=agent.service_name=group_module -Dskywalking.collector.backend_service=172.62.0.52:11800 -jar /root/group-module-1.0-SNAPSHOT.jar --server.port=8890
至此客戶端和服務(wù)端部署完成,可以打開ui界面進(jìn)行訪問
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持。