Centos中docker-compose安装夜莺n9ev5

1、下载

滴滴开源/nightingale(夜莺)

2、Centos环境设置

#关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
#关闭内核安全机制selinux
setenforce 0
#永久关闭
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
#yum安装git & epel-release & docker & docker-compose
yum -y install epel-release
yum -y install  git docker docker-compose
#git clone 夜莺
git clone https://github.com/didi/nightingale.git
正克隆到 'nightingale'...
remote: Enumerating objects: 18476, done.
remote: Counting objects: 100% (3713/3713), done.
remote: Compressing objects: 100% (1887/1887), done.
remote: Total 18476 (delta 1782), reused 3455 (delta 1669), pack-reused 14763
接收对象中: 100% (18476/18476), 31.39 MiB | 1.69 MiB/s, done.
处理 delta 中: 100% (8105/8105), done.
#启动docker服务
systemctl start docker & systemctl enable docker
#进入到夜莺的docker目录
cd nightingale/docker
#docker-compose 启动夜莺监控
docker-compose up -d

如果你使用docker-compose up -d 这一步报错

ERROR: Version in "./docker-compose.yaml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

说明你的docker-compose 版本低!这时候就要安装高版本的docker-compose

#卸载安装的低版本docker-compose 
yum -y remove docker-compose
#安装高版本docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

安装完重新执行docker-compose up -d 即可!

[root@MiWiFi-R3600-srv docker]# docker-compose -f docker-compose.yaml up -d
Creating network "docker_nightingale" with driver "bridge"
Creating redis      ... done
Creating mysql      ... done
Creating prometheus ... done
Creating ibex       ... done
Creating nserver    ... done
Creating agentd     ... done
Creating nwebapi    ... done
Creating categraf   ... done
[root@MiWiFi-R3600-srv docker]# docker ps
CONTAINER ID   IMAGE                              COMMAND                  CREATED          STATUS         PORTS                                                                                          NAMES
3aa9cd280fa0   flashcatcloud/categraf:latest      "/entrypoint.sh"         6 seconds ago    Up 5 seconds   0.0.0.0:8094->8094/tcp, :::8094->8094/tcp                                                      categraf
104258bd3d70   flashcatcloud/nightingale:latest   "sh -c '/wait && /ap…"   8 seconds ago    Up 5 seconds   0.0.0.0:18000->18000/tcp, :::18000->18000/tcp, 19000/tcp                                       nwebapi
17636bacc21d   flashcatcloud/nightingale:latest   "sh -c '/wait && /ap…"   8 seconds ago    Up 5 seconds   18000/tcp, 0.0.0.0:19000->19000/tcp, :::19000->19000/tcp                                       nserver
df06fa5d3579   ulric2019/ibex:0.3                 "/app/ibex agentd"       8 seconds ago    Up 5 seconds   10090/tcp, 20090/tcp                                                                           agentd
521bbc72b6e4   ulric2019/ibex:0.3                 "sh -c '/wait && /ap…"   9 seconds ago    Up 7 seconds   0.0.0.0:10090->10090/tcp, :::10090->10090/tcp, 0.0.0.0:20090->20090/tcp, :::20090->20090/tcp   ibex
97701196034a   prom/prometheus                    "/bin/prometheus --c…"   10 seconds ago   Up 8 seconds   0.0.0.0:9090->9090/tcp, :::9090->9090/tcp                                                      prometheus
35dd17d683b4   mysql:5.7                          "docker-entrypoint.s…"   10 seconds ago   Up 8 seconds   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp                                           mysql
08d4e1cc4eac   redis:6.2                          "docker-entrypoint.s…"   10 seconds ago   Up 8 seconds   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                      redis

待容器状态正常以后!我们访问ip:18000即可!

账号:root

密码:root.2020

3、使用现有的mysql、redis

1、修改 docker-compose.yaml

​​​​​​​

改完之后的代码如下:

version: "3.7"

networks:
  nightingale:
    driver: bridge

services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    hostname: prometheus
    restart: always
    environment:
      TZ: Asia/Shanghai
    volumes:
      - ./prometc:/etc/prometheus
    ports:
      - "9090:9090"
    networks:
      - nightingale
    command:
      - "--config.file=/etc/prometheus/prometheus.yml"
      - "--storage.tsdb.path=/prometheus"
      - "--web.console.libraries=/usr/share/prometheus/console_libraries"
      - "--web.console.templates=/usr/share/prometheus/consoles"
      - "--enable-feature=remote-write-receiver"
      - "--query.lookback-delta=2m"

  ibex:
    image: ulric2019/ibex:0.3
    container_name: ibex
    hostname: ibex
    restart: always
    environment:
      GIN_MODE: release
      TZ: Asia/Shanghai
 #     WAIT_HOSTS: mysql:3306
    ports:
      - "10090:10090"
      - "20090:20090"
    volumes:
      - ./ibexetc:/app/etc
    networks:
      - nightingale
    command: >
      sh -c "/wait && /app/ibex server"
    extra_hosts:
      - "mysql:192.168.1.44"
      - "redis:192.168.1.44"

  nwebapi:
    image: flashcatcloud/nightingale:latest
    container_name: nwebapi
    hostname: nwebapi
    restart: always
    environment:
      GIN_MODE: release
      TZ: Asia/Shanghai
 #     WAIT_HOSTS: mysql:3306, redis:6379
    volumes:
      - ./n9eetc:/app/etc
    ports:
      - "18000:18000"
    networks:
      - nightingale
    depends_on:
      - prometheus
      - ibex
    links:
      - prometheus:prometheus
      - ibex:ibex
    command: >
      sh -c "/wait && /app/n9e webapi"
    extra_hosts:
      - "mysql:192.168.1.44"
      - "redis:192.168.1.44"

  nserver:
    image: flashcatcloud/nightingale:latest
    container_name: nserver
    hostname: nserver
    restart: always
    environment:
      GIN_MODE: release
      TZ: Asia/Shanghai
 #     WAIT_HOSTS: mysql:3306, redis:6379
    volumes:
      - ./n9eetc:/app/etc
    ports:
      - "19000:19000"
    networks:
      - nightingale
    depends_on:
      - prometheus
      - ibex
    links:
      - prometheus:prometheus
      - ibex:ibex
    command: >
      sh -c "/wait && /app/n9e server"
    extra_hosts:
      - "mysql:192.168.1.44"
      - "redis:192.168.1.44"

  categraf:
    image: "flashcatcloud/categraf:latest"
    container_name: "categraf"
    hostname: "categraf01"
    restart: always
    environment:
      TZ: Asia/Shanghai
      HOST_PROC: /hostfs/proc
      HOST_SYS: /hostfs/sys
      HOST_MOUNT_PREFIX: /hostfs
    volumes:
      - ./categraf/conf:/etc/categraf/conf
      - /:/hostfs
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8094:8094/tcp"
    networks:
      - nightingale
    depends_on:
      - nserver
    links:
      - nserver:nserver

  agentd:
    image: ulric2019/ibex:0.3
    container_name: agentd
    hostname: agentd
    restart: always
    environment:
      GIN_MODE: release
      TZ: Asia/Shanghai
    volumes:
      - ./ibexetc:/app/etc
    networks:
      - nightingale
    depends_on:
      - ibex
    links:
      - ibex:ibex
    command:
      - "/app/ibex"
      - "agentd"

 这两个文件修改mysql和redis用户密码

 docker-compose重启即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值