docker-compos安装skywalking,es

1.docker-compose.yml

version: '3.9'
services:
  es:
    image: elasticsearch:7.13.3
    container_name: skywalking-es
    privileged: true
    networks:
      - net-es
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - ./es/data/:/usr/share/elasticsearch/data
    environment:
      - discovery.type=single-node
      - TZ=Asia/Shanghai
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    deploy:
     resources:
        limits:
           cpus: "2"
           memory: 1000M
        reservations:
           memory: 200M
  oap:
    image: apache/skywalking-oap-server:8.6.0-es7
    container_name: skywalking-oap
    restart: always
    deploy:
     resources:
        limits:
           cpus: "2"
           memory: 512M
        reservations:
           memory: 200M
    networks:
      - net-es
    depends_on:
      - es
    links:
      - es
    ports:
      - 11800:11800
      - 12800:12800
    environment:
      discovery.type: single-node
      TZ: Asia/Shanghai
      SW_STORAGE: elasticsearch7
      SW_STORAGE_ES_CLUSTER_NODES: es:9200
      #SW_ES_USER: elastic
      #SW_ES_USER_PASSWORD: wshoto@2020

  ui:
    image: apache/skywalking-ui:8.7.0
    container_name: skywalking-ui
    deploy:
     resources:
        limits:
           cpus: "2"
           memory: 512M
        reservations:
           memory: 200M
    networks:
      - net-es
    depends_on:
      - oap
    links:
      - oap
    restart: always
    ports:
      # WEB UI管理系统端口号
      - 18080:8080
    #设置环境,配置覆盖yml的配置
    environment:
      collector.ribbon.listOfServers: oap:12800
      # 默认账号:admin,配置默认密码:adminsou888!
      security.user.admin.password: admin888
networks:
  net-es:
    external: false

2.查看启动状态,如果es启动失败,应该是文件夹没权限

chmod -R 777 es*

3.重新启动

docker-compose up -d

4.访问ip:18080
docker-compos安装skywalking,es_第1张图片

5.下载代理进行测试:
https://skywalking.apache.org/downloads/
docker-compos安装skywalking,es_第2张图片

https://www.apache.org/dyn/closer.cgi/skywalking/8.7.0/apache-skywalking-apm-8.7.0.tar.gz
docker-compos安装skywalking,es_第3张图片

6.下载完后解压,把agent文件夹复制到一个没有中文的目录
docker-compos安装skywalking,es_第4张图片
7.使用idea写个springboot,helloword项目测试,在idea中配置如下:
docker-compos安装skywalking,es_第5张图片
配置skywalking的服务地址,同时配置被监控示例的项目名

-javaagent:D:\workdata\skywalkingagent\agent\skywalking-agent.jar
-DSW_AGENT_NAME=hellotest
-DSW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.0.12:11800

配置好后启动测试,请求微服务,然后刷新skywalking页面查看监控信息
docker-compos安装skywalking,es_第6张图片
8.jar包启动命令示例

java -javaagent:D:\workdata\skywalkingagent\agent\skywalking-agent.jar -DSW_AGENT_NAME=hellotest -DSW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.0.12:11800 -jar demo-0.0.1-SNAPSHOT.jar

9.项目工程中,增加打印skywalking链路追踪的traceId

<dependency>
    <groupId>org.apache.skywalkinggroupId>
    <artifactId>apm-toolkit-traceartifactId>
    <version>8.7.0version>
    <scope>providedscope>
dependency>

10.添加告警规则

你可能感兴趣的:(基础安装,docker,elasticsearch)