docker-compose安装skywalking

  1. 我是在centos7的虚拟机中安装的,首先要安装docker、 docker-compose (这俩尽量安装新一点的版本,否则不支持version3.8的yml)。虚拟机内存要尽量设置大一点,最好是4G.
  2. docker-compose.yml 如下
version: '3.8'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.4.2
    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
      - "TZ=Asia/Shanghai"
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g -XX:-UseConcMarkSweepGC -XX:-UseCMSInitiatingOccupancyOnly -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=75"
    volumes:
      - ./elasticsearch/logs:/usr/share/elasticsearch/logs
      - ./elasticsearch/data:/usr/share/elasticsearch/data
      - ./elasticsearch/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    ulimits:
      memlock:
        soft: -1
        hard: -1

  oap:
    image: apache/skywalking-oap-server:8.9.1
    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
      TZ: Asia/Shanghai
      JAVA_OPTS: "-Xms1g -Xmx1g -XX:-UseConcMarkSweepGC -XX:-UseCMSInitiatingOccupancyOnly -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=75"
      SW_KAFKA_FETCHER_SERVERS: 192.168.229.139:9092
      SW_KAFKA_FETCHER: 'default'
      SW_KAFKA_FETCHER_PARTITIONS_FACTOR: '1'
    volumes:
     - ./oap/conf/alarm-settings.yml:/skywalking/config/alarm-settings.yml

  ui:
    image: apache/skywalking-ui:8.9.1
    container_name: ui
    depends_on:
      oap:
        condition: service_healthy
    links:
      - oap
    ports:
      - "8080:8080"
    environment:
      SW_OAP_ADDRESS: http://oap:12800
      TZ: Asia/Shanghai


  1. 如果docker-compose不支持version3.8,需要升级。(我升级到的是2.7.0)

  2. 上述文件中volumes 挂载路径提前创建好,并创建elasticsearch.yml和alarm-settings.yml,不然后续安装的过程中会报错,报错的大概意思是:docker-compose把elasticsearch.yml和alarm-settings.yml当成文件夹去创建了。

  3. 在elasticsearch.yml 配置 network.host: 0.0.0.0和 indices.breaker.total.use_real_memory: false, 否则oap会连接es失败

你可能感兴趣的:(java,docker,skywalking,elasticsearch)