• docker-compose安装skywalking


    先下载docker-compose

    [root@test wgr]# curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   638  100   638    0     0    610      0  0:00:01  0:00:01 --:--:--   611
    100 15.4M  100 15.4M    0     0  2445k      0  0:00:06  0:00:06 --:--:-- 3643k
    [root@test wgr]# chmod +x /usr/local/bin/docker-compose
    [root@test wgr]# docker-compose
    

    因为我本地已经有一套skywalking,便要修改一下端口:

    version: '3.3'
    services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:6.8.5
        container_name: elasticsearch2
        restart: always
        ports:
          - 9201:9201
          - 9301:9301
        environment:
          discovery.type: single-node
        ulimits:
          memlock:
            soft: -1
            hard: -1
      oap:
        image: skywalking/oap
        container_name: oap
        depends_on:
          - elasticsearch
        links:
          - elasticsearch
        restart: always
        ports:
          - 11801:11800
          - 12801:12800
        environment:
          SW_STORAGE: elasticsearch
          SW_STORAGE_ES_CLUSTER_NODES: elasticsearch2:9201
      ui:
        image: skywalking/ui
        container_name: ui
        depends_on:
          - oap
        links:
          - oap
        restart: always
        ports:
          - 9090:8080
        environment:
          SW_OAP_ADDRESS: oap:12801
    

    常用&重要命令

    • images
      指定为镜像名称或镜像 ID。如果镜像在本地不存在,Compose 将会尝试拉取这个镜像。
    image: apache/skywalking-oap-server:6.5.0
    image: apache/skywalking-ui:6.5.0
    
    • ports
      暴露端口信息。
      使用宿主端口:容器端口 (HOST:CONTAINER) 格式,或者仅仅指定容器的端口(宿主将会随机选择端口)都可以,端口字符串都使用引号包括起来的字符串格式。
    ports: 
        - "3000" 
        - "8080:8080" 
        - "127.0.0.1:8001:8001"
    
    • volumes
      数据卷所挂载路径设置。可以设置为宿主机路径(HOST:CONTAINER)或者数据卷名称(VOLUME:CONTAINER),并且可以设置访问模式 (HOST:CONTAINER:ro)。
    volumes:
          - /app/skywalking/elasticsearch/data:/usr/share/elasticsearch/data:rw
          - conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    123
    version: "3"
    services:
      my_src:
        image: mysql:8.0
        volumes:
          - mysql_data:/var/lib/mysql
    volumes:
      mysql_data:
    
    • ulimits
      指定容器的 ulimits 限制值。
      例如,指定最大进程数为 65535,指定文件句柄数为 20000(软限制,应用可以随时修改,不能超过硬限制) 和 40000(系统硬限制,只能 root 用户提高)。
    ulimits:
       nproc: 65535
       nofile:
         soft: 20000
         hard: 40000
    
    • depends_on
      解决容器的依赖、启动先后的问题。以下例子中会先启动 redis mysql 再启动 web
    version: '3'
    services:
      web:
        build: .
        depends_on:
          - db
          - redis	  
      redis:
        image: redis	
      db:
        image: mysql
    
    • environment
      设置环境变量。你可以使用数组或字典两种格式。
    environment:
          SW_STORAGE: elasticsearch
          SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
          
    environment:
          - SW_STORAGE= elasticsearch
          - SW_STORAGE_ES_CLUSTER_NODES=elasticsearch:9200
    
    • restart
      指定容器退出后的重启策略为始终重启。该命令对保持服务始终运行十分有效,在生产环境中推荐配置为 always 或者 unless-stopped
      restart: always
    [root@test wgr]# docker-compose  up -d
    Creating elasticsearch2 ... done
    Creating oap            ... done
    Creating ui             ... done
    [root@test wgr]# docker-compose ps
         Name                   Command               State                                 Ports
    ----------------------------------------------------------------------------------------------------------------------------
    elasticsearch2   /usr/local/bin/docker-entr ...   Up      9200/tcp, 0.0.0.0:9201->9201/tcp, 9300/tcp, 0.0.0.0:9301->9301/tcp
    oap              sh docker-entrypoint.sh          Up      0.0.0.0:11801->11800/tcp, 0.0.0.0:12801->12800/tcp
    ui               sh docker-entrypoint.sh          Up      0.0.0.0:9090->8080/tcp
    [root@test wgr]# netstat -nltp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1056/sshd
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1250/master
    tcp6       0      0 :::18080                :::*                    LISTEN      2011/java
    tcp6       0      0 :::12800                :::*                    LISTEN      1992/java
    tcp6       0      0 :::12801                :::*                    LISTEN      3053/docker-proxy
    tcp6       0      0 :::9090                 :::*                    LISTEN      3204/docker-proxy
    tcp6       0      0 :::9200                 :::*                    LISTEN      1809/docker-proxy
    tcp6       0      0 :::9201                 :::*                    LISTEN      2939/docker-proxy
    tcp6       0      0 :::9300                 :::*                    LISTEN      1796/docker-proxy
    tcp6       0      0 :::9301                 :::*                    LISTEN      2925/docker-proxy
    tcp6       0      0 :::22                   :::*                    LISTEN      1056/sshd
    tcp6       0      0 :::11800                :::*                    LISTEN      1992/java
    tcp6       0      0 :::11801                :::*                    LISTEN      3069/docker-proxy
    tcp6       0      0 ::1:25                  :::*                    LISTEN      1250/master
    

    image-20200805103418950

  • 相关阅读:
    SQL结构化查询语言
    数据库主外键
    SQL数据库数据类型详解
    注释和特殊符号
    文本装饰
    列表样式
    网页背景
    SQL数据库数据类型详解
    数据库主外键
    Update 语句
  • 原文地址:https://www.cnblogs.com/dalianpai/p/13438349.html
Copyright © 2020-2023  润新知