参考:Nacos适配达梦数据库(不修改源码),基于Docker-compose_nacos 达梦数据库-CSDN博客
该博主之后,发现启动Nacos报错找不到驱动
报错如下:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncNotifyService': Unsatisfied dependency expressed through field 'dumpService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalDumpService': Invocation of init method failed; nested exception is ErrCode:500, ErrMsg:Nacos Server did not start because dumpservice bean construction failure :
No DataSource set
更改jar版本之后的配置文件
Nacos V2.2.0
达梦驱动jar包版本:DmJdbcDriver18-8.1.3.62.jar
Docker-compose 配置文件:
version: "3.0"
services:
nacos:
image: nacos/nacos-server:v2.2.0
container_name: nacos
ports: # 映射端口
- "8848:8848"
- "9848:9848"
- "9849:9849"
environment:
MODE: standalone
JVM_XMS: 512m
JVM_XMX: 512m
JVM_XMN: 256m
DB_POOL_CONFIG_DRIVERCLASSNAME: dm.jdbc.driver.DmDriver
JAVA_OPT: "${JAVA_OPT} -Dloader.path=/home/nacos/libs"
volumes:
- /mydata/nacos/conf/application.properties:/home/nacos/conf/application.properties
- /mydata/nacos/libs/DmJdbcDriver18-8.1.3.62.jar:/home/nacos/libs/DmJdbcDriver18-8.1.3.62.jar
- /opt/server/nacos/logs/:/home/webjoin/logs/nacos/
privileged: true
restart: always
network_mode: "host"
下载驱动:
DmJdbcDriver18-8.1.3.62.jar 地址:仓库服务
搜索:DmJdbcDriver18
选择:DmJdbcDriver18-8.1.3.62.jar
### Specify local server's IP:
# nacos.inetutils.ip-address=
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
spring.datasource.platform=mysql
### Count of DB:
db.num=1
# Connect URL of DB:
# db.jdbcDriverName=dm.jdbc.driver.DmDriver
db.url.0=jdbc:dm://127.0.0.1:5236/feeTest-config
db.user=SYSDBA
db.password=SYSDBA
Docker-compose 运行命令
docker-compose -f /data/shell/docker-compose/nacos.yml up -d
以上配置 /data/shell/docker-compose/nacos.yml 是对应你的docker-compose 配置文件地址
2023-10-19 08:36:14,842 INFO Tomcat initialized with port(s): 8848 (http)
2023-10-19 08:36:14,924 INFO Root WebApplicationContext: initialization completed in 2668 ms
2023-10-19 08:36:17,908 INFO Adding welcome page: class path resource [static/index.html]
2023-10-19 08:36:18,495 WARN You are asking Spring Security to ignore Ant [pattern='/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.
2023-10-19 08:36:18,496 INFO Will not secure Ant [pattern='/**']
2023-10-19 08:36:18,524 INFO Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@64c2b546, org.springframework.security.web.context.SecurityContextPersistenceFilter@2c4ca0f9, org.springframework.security.web.header.HeaderWriterFilter@5c1bd44c, org.springframework.security.web.csrf.CsrfFilter@4da855dd, org.springframework.security.web.authentication.logout.LogoutFilter@551a20d6, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@7df587ef, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2755d705, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7e094740, org.springframework.security.web.session.SessionManagementFilter@18cc679e, org.springframework.security.web.access.ExceptionTranslationFilter@5db99216]
2023-10-19 08:36:18,551 INFO Exposing 1 endpoint(s) beneath base path '/actuator'
2023-10-19 08:36:18,602 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'
2023-10-19 08:36:18,631 INFO Nacos started successfully in stand alone mode. use external storage
2023-10-19 08:36:40,608 INFO Initializing Servlet 'dispatcherServlet'
2023-10-19 08:36:40,609 INFO Completed initialization in 1 ms
完成!