docker部署nacos2.2.3
配置数据源
创建数据库
mysql> CREATE DATABASE nacos DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected, 2 warnings (0.00 sec)
导入数据
https://github.com/alibaba/nacos/blob/master/distribution/conf/mysql-schema.sql
docker-compose.yaml
version: "3.8"
services:
nacos:
image: nacos/nacos-server:v2.2.3
container_name: nacos
restart: on-failure
environment:
- NACOS_AUTH_ENABLE=true
- PREFER_HOST_MODE=hostname
- MODE=standalone
- SPRING_DATASOURCE_PLATFORM=mysql
- MYSQL_SERVICE_HOST=mysql
- MYSQL_SERVICE_DB_NAME=nacos
- MYSQL_SERVICE_PORT=3306
- MYSQL_SERVICE_USER=nacos
- MYSQL_SERVICE_PASSWORD=nacos
- MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
- NACOS_AUTH_IDENTITY_KEY=222
- NACOS_AUTH_IDENTITY_VALUE=2xxx
- NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789
volumes:
- ./logs/:/home/nacos/logs
ports:
- "8848:8848"
- "9848:9848"
networks:
- nacos
networks:
nacos:
driver: bridge
ipam:
config:
- subnet: 172.31.25.0/24
参考文档
https://nacos.io/zh-cn/docs/v2/quickstart/quick-start.html