mysql独立开发_nacos的mysql独立部署

1. 相关资料

2. 独立mysql部署

mysql版本 5.7+

2.1 初始化数据库

独立安装mysql, 创建数据库nacos, 执行脚本 nacos-db.sql

2.2 docker部署 nacos-server

docker run -d \

-v /standalone-logs/:/home/nacos/logs

-v ./custom.properties:/home/nacos/init.d/custom.properties

-e PREFER_HOST_MODE=ip \

-e MODE=standalone \

-e SPRING_DATASOURCE_PLATFORM=mysql \

-e MYSQL_MASTER_SERVICE_HOST=10.5.96.32 \

-e MYSQL_MASTER_SERVICE_PORT=3306 \

-e MYSQL_MASTER_SERVICE_USER=root \

-e MYSQL_MASTER_SERVICE_PASSWORD=123456 \

-e MYSQL_MASTER_SERVICE_DB_NAME=nacos \

-e MYSQL_SLAVE_SERVICE_HOST=从数据库ip \

-p 7110:8848 \

-p 7111:9555 \

--name nacos1 \

nacos/nacos-server

访问 http://10.5.96.62:7110/nacos , 默认用户名密码 nacos/nacos, 界面如下:

92b9544e5101a08396ca93bdb0fab525.png

查看 http://10.5.96.62:7110/nacos/actuator/prometheus 是否有信息返回。

2.3 docker部署prometheus

docker run -d \

-v ./prometheus-standalone.yaml:/etc/prometheus/prometheus.yml \

-p 7120:9090 \

-- name prom/prometheus:latest \

prometheus1

下载 prometheus.yml。ip端口使用默认,无需更改,即使对外端口已经改变。

2.4 docker 部署grafana

docker run -d \

-p 7130:3000 \

-- name grafana/grafana:latest

grafana1

查看 http://10.5.96.62:7130/ ,默认用户名密码:admin/admin , 界面如下:

c693c1c5306afac3701c340a9ceef7f2.png

3. docker-compose 部署脚本

version: "2"

services:

nacos:

image: nacos/nacos-server:latest

container_name: nacos1

volumes:

- ./standalone-logs/:/home/nacos/logs

- ./custom.properties:/home/nacos/init.d/custom.properties

ports:

- 7110:8848

- 7111:9555

environment:

- "PREFER_HOST_MODE=ip"

- "MODE=standalone"

- "SPRING_DATASOURCE_PLATFORM=mysql"

- "MYSQL_SERVICE_HOST=10.5.96.32"

- "MYSQL_SERVICE_PORT=3306"

- "MYSQL_SERVICE_USER=root"

- "MYSQL_SERVICE_PASSWORD=Mysql@0000"

- "MYSQL_SERVICE_DB_NAME=nacos"

restart: on-failure

prometheus:

container_name: prometheus1

image: prom/prometheus:latest

volumes:

- ./prometheus-standalone.yaml:/etc/prometheus/prometheus.yml

ports:

- 7120:9090

depends_on:

- nacos

restart: on-failure

grafana:

container_name: grafana1

image: grafana/grafana:latest

ports:

- 7130:3000

restart: on-failure

//启动容器

docker-compose -f nacos.yaml up

//停止并删除容器

docker-compose -f nacos.yaml down

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值