美文网首页
搭建skywalking

搭建skywalking

作者: luckXiaofei | 来源:发表于2023-08-29 17:46 被阅读0次

    docker启动

    启动oap服务

    docker run -d --name skywalking-oap 
    --restart always  -e TZ=Asia/Shanghai  
    -p 12800:12800 -p 11800:11800 
    apache/skywalking-oap-server
    

    启动skywalking-ui

    docker run -d --name skywalking-ui  
    --restart=always  -e TZ=Asia/Shanghai  
    -p 8080:8080  --link skywalking-oap:oap  
    -e SW_OAP_ADDRESS=http://oap:12800  
    apache/skywalking-ui
    

    集成探针启动jar包

    # -javaagent  探针jar包的路径
    # -Dskywalking.agent.service_name 服务的名称,随意取
    # -Dskywalking.collector.backend_service 指定oap服务的ip地址
    
    #普通方式启动
    java 
    -javaagent://app/skywalking-agent.jar 
    -Dskywalking.agent.service_name=ruoyi 
    -Dskywalking.collector.backend_service=127.0.0.1:11800 
    -jar xxxx.jar
    
    #nohup方式启动
    nohup java  
    -javaagent://app/skywalking-agent.jar 
    -Dskywalking.agent.service_name=ruoyi 
    -Dskywalking.collector.backend_service=127.0.0.1:11800
    -jar   ${JAR_NAME}   >> $LOG_PATH 2>&1 &
    

    docker-compose启动

    ES_VERSION=7.4.2
    OAP_IMAGE=skywalking/oap:latest
    UI_IMAGE=skywalking/ui:latest
    
    version: '3.8'
    services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch-oss:${ES_VERSION}
        container_name: elasticsearch
        ports:
          - "9200:9200"
        healthcheck:
          test: [ "CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1" ]
          interval: 30s
          timeout: 10s
          retries: 3
          start_period: 10s
        environment:
          - discovery.type=single-node
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        ulimits:
          memlock:
            soft: -1
            hard: -1
    
      oap:
        image: ${OAP_IMAGE}
        container_name: oap
        depends_on:
          elasticsearch:
            condition: service_healthy
        links:
          - elasticsearch
        ports:
          - "11800:11800"
          - "12800:12800"
        healthcheck:
          test: [ "CMD-SHELL", "/skywalking/bin/swctl ch" ]
          interval: 30s
          timeout: 10s
          retries: 3
          start_period: 10s
        environment:
          SW_STORAGE: elasticsearch
          SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
          SW_HEALTH_CHECKER: default
          SW_TELEMETRY: prometheus
          JAVA_OPTS: "-Xms2048m -Xmx2048m"
    
      ui:
        image: ${UI_IMAGE}
        container_name: ui
        depends_on:
          oap:
            condition: service_healthy
        links:
          - oap
        ports:
          - "8080:8080"
        environment:
          SW_OAP_ADDRESS: http://oap:12800
          SW_ZIPKIN_ADDRESS: http://oap:9412
    
    

    参考:

    skywalking官网:https://skywalking.apache.org/docs/

    相关文章

      网友评论

          本文标题:搭建skywalking

          本文链接:https://www.haomeiwen.com/subject/nnxomdtx.html