单机milvusdb部署standalone-monitoring
环境:
OS:Centos 7
milvusdb:standalone 2.4.6
前提条件:
已经部署好了milvusdb
1.下载相应文件
https://github.com/milvus-io/milvus-docs/tree/v2.4.x
下载整个软件包,解压后将milvus-docs-2.4.x\assets\standalone-monitoring这个目录单独拷贝出来
2.standalone-monitoring目录需要相应处理
milvus-docs-2.4.x\assets\standalone-monitoring\grafana ##整个目录原封不动,直接拷贝到部署目录 /home/middle/milvus
milvus-docs-2.4.x\assets\standalone-monitoring\prometheus ##整个目录原封不动,直接拷贝到部署目录 /home/middle/milvus
milvus-docs-2.4.x\assets\standalone-monitoring\docker-compose.yml ##因为之前部署了的,只能修改,把grafana和prometheus部分加入
milvus-docs-2.4.x\assets\standalone-monitoring\milvus.yaml ##因为之前部署了的,若没有改动的话,可以直接覆盖
3.我这里只修改docker-compose.yml
新增如下内容
prometheus:
image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/prometheus:v3.0.1
container_name: prometheus
user: root
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- 9090:9090
restart: unless-stopped
volumes:
- ./prometheus:/etc/prometheus
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/prometheus:/prometheus
grafana:
image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/grafana:11.4.0
container_name: grafana
user: root
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=grafana
volumes:
- ./grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
- ./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/main.yml
- ./grafana/dashboards:/var/lib/grafana/dashboards
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/grafana:/var/lib/grafana
若宿主机上部署了langfuse的话,它使用的端口是3000,那么的话,grafana的映射端口需要修改,比如修改如下:
grafana:
image: grafana/grafana:11.4.0
container_name: grafana
user: root
ports:
- 3030:3000
前面是宿主机端口,后面是容器端口,只修改宿前面的主机端口
镜像可以加载到本地
导出镜像
docker save -o /soft/milvus/grafana-11.4.0.tar.gz c0b69935a246
docker save -o /soft/milvus/prometheus-v3.0.1.tar.gz 24c1b63a5674
加载镜像
docker load -i grafana-11.4.0.tar.gz
docker tag c0b69935a246 grafana/grafana:11.4.0
docker load -i prometheus-v3.0.1.tar.gz
docker tag 24c1b63a5674 prom/prometheus:v3.0.1
配置文件可以这样定义
prometheus:
image: prom/prometheus:v3.0.1
grafana:
image: grafana/grafana:11.4.0
4.停掉原来的
[root@host135 milvus]#cd /home/middle/milvus
[root@host135 milvus]#docker-compose down
5.启动
[root@host135 milvus]#cd /home/middle/milvus
[root@host135 milvus]#docker-compose up -d
6.登录grafana
192.168.1.135:3000
账号密码:
admin/grafana