docker-compose如何安装skywalking
作者:Niklauson
这篇文章主要介绍了docker-compose如何安装skywalking问题,
docker-compose安装skywalking
我是在centos7的虚拟机中安装的
首先要安装docker、 docker-compose (这俩尽量安装新一点的版本,否则不支持version3.8的yml)。
虚拟机内存要尽量设置大一点,最好是4G.
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
如果docker-compose不支持version3.8
需要升级。(我升级到的是2.7.0)
上述文件中volumes挂载路径提前创建好
并创建elasticsearch.yml和alarm-settings.yml,不然后续安装的过程中会报错,
报错的大概意思是:
docker-compose把elasticsearch.yml和alarm-settings.yml当成文件夹去创建了。
在elasticsearch.yml配置
network.host: 0.0.0.0和 indices.breaker.total.use_real_memory: false, 否则oap会连接es失败
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。