赞
踩
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
使用docker-compose部署单机版nacos,并配置外部MySQL数据库(同样是docker-compose部署的MySQL),服务启动时提示java.lang.IllegalStateException: No DataSource set
。
version: '3.3' services: nacos: image: nacos/nacos-server:v2.2.3 container_name: nacos privileged: true restart: always volumes: - /etc/localtime:/etc/localtime - ./peer-finder:/home/nacos/plugins/peer-finder - ./data:/home/nacos/data - ./logs:/home/nacos/logs ports: - 18848:8848 environment: - MODE=standalone - PREFER_HOST_MODE=hostname - NACOS_AUTH_ENABLE=true - NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789 - NACOS_AUTH_IDENTITY_KEY=admin - NACOS_AUTH_IDENTITY_VALUE=admin - NACOS_SERVER_PORT=8848 - NACOS_APPLICATION_PORT=8848 - SPRING_DATASOURCE_PLATFORM=mysql - MYSQL_SERVICE_HOST=127.0.0.1 - MYSQL_SERVICE_PORT=3306 - MYSQL_SERVICE_DB_NAME=nacos - MYSQL_SERVICE_USER=root - MYSQL_SERVICE_PASSWORD={mysql_pwd} - MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
本例中,本地可以通过客户端连上数据库,故不存在数据库信息错误的问题。之后让nacos和mysql共用一个docker network,nacos可以正常启动
version: '3.3' services: nacos: image: nacos/nacos-server:v2.2.3 container_name: nacos privileged: true restart: always volumes: - /etc/localtime:/etc/localtime - ./peer-finder:/home/nacos/plugins/peer-finder - ./data:/home/nacos/data - ./logs:/home/nacos/logs ports: - 18848:8848 networks: - mysql_default environment: - MODE=standalone - PREFER_HOST_MODE=hostname - NACOS_AUTH_ENABLE=true - NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789 - NACOS_AUTH_IDENTITY_KEY=admin - NACOS_AUTH_IDENTITY_VALUE=admin - NACOS_SERVER_PORT=8848 - NACOS_APPLICATION_PORT=8848 - SPRING_DATASOURCE_PLATFORM=mysql - MYSQL_SERVICE_HOST=mysql - MYSQL_SERVICE_PORT=3306 - MYSQL_SERVICE_DB_NAME=nacos - MYSQL_SERVICE_USER=root - MYSQL_SERVICE_PASSWORD={mysql_pwd} - MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false networks: mysql_default: external: true
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。