Nacos Docker
Clone 项目
git clone https://github.com/nacos-group/nacos-docker.git
cd nacos-docker
单机模式 Derby
standalone-derby.yaml
version: "2"
services:
nacos:
image: nacos/nacos-server:latest
container_name: nacos-standalone
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
volumes:
- ./standalone-logs/:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8848:8848"
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus/prometheus-standalone.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
depends_on:
- nacos
restart: on-failure
grafana:
container_name: grafana
image: grafana/grafana:latest
ports:
- 3000:3000
restart: on-failure
docker-compose -f example/standalone-derby.yaml up
如果希望使用MySQL5.7
docker-compose -f example/standalone-mysql-5.7.yaml up
集群模式
docker-compose -f example/cluster-hostname.yaml up
验证nacos
link:http://127.0.0.1:8848/nacos/
用户名/密码:nacos/nacos
验证prometheus
通过访问http://{ip}:9090/graph可以看到prometheus的采集数据,在搜索栏搜索nacos_monitor可以搜索到Nacos数据说明采集数据成功
搭建grafana图形化展示metrics数据
用户名/密码:admin/admin
添加数据源
Configuration > Data Sources
Add data source
点击 Save & Test.
添加仪表盘
点击 + 图标,选择 Create Dashboard, 然后点击 Add new panel
在 New Dashboard/Edit Panel 视图, 转到 Query 选项卡.
选择 -- Grafana -- 数据源.
点击保存
添加一个名称