nacos-group / nacos-docker

This project contains a Docker image meant to facilitate the deployment of Nacos .
1.43k stars 908 forks source link

2.2.3 部署nacos集群是否不能设置为embedded存储模式 #395

Open billyyoyo opened 7 months ago

billyyoyo commented 7 months ago

部署nacos集群是否不能设置为embedded存储模式,用mysql一切正常

根据nacose-ip.yml修改:

nacos dev env

NACOS_SERVERS=172.16.238.10:8848 172.16.238.11:8848 172.16.238.12:8848 NACOS_AUTH_ENABLE=true EMBEDDED_STORAGE=embedded

SPRING_DATASOURCE_PLATFORM=mysql

MYSQL_SERVICE_HOST=172.100.0.1

MYSQL_SERVICE_DB_NAME=nacos

MYSQL_SERVICE_PORT=3306

MYSQL_SERVICE_USER=xxxx

MYSQL_SERVICE_PASSWORD=xxxx

MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

NACOS_AUTH_IDENTITY_KEY=2222 NACOS_AUTH_IDENTITY_VALUE=2xxx NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789

nacos.log Caused by: com.alibaba.nacos.api.exception.runtime.NacosRuntimeException: errCode: 500, errMsg: java.lang.NullPointerException at com.alibaba.nacos.config.server.service.repository.embedded.DistributedDatabaseOperateImpl.queryOne(DistributedDatabaseOperateImpl.java:237)

protocol-raft.log 2024-03-08 16:41:15,515 ERROR Failed to join the cluster, retry... java.lang.IllegalStateException: Fail to get leader of group nacos_config, Unknown leader, Unknown leader, Unknown leader at com.alipay.sofa.jraft.core.CliServiceImpl.getPeers(CliServiceImpl.java:605)

ghost commented 7 months ago

有同样的疑问:

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
        at com.alibaba.nacos.Nacos.main(Nacos.java:48)
...
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'basicAuthenticationFilter' defined in class path resource [com/alibaba/nacos/prometheus/filter/PrometheusAuthFilter.class]: Unsatisfied dependency expressed through method 'basicAuthenticationFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosAuthConfig' defined in URL [jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/default-auth-plugin-2.3.0.jar!/com/alibaba/nacos/plugin/auth/impl/NacosAuthConfig.class]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosUserDetailsServiceImpl': Unsatisfied dependency expressed through field 'userPersistService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalUserPersistServiceImpl': Invocation of init method failed; nested exception is java.lang.RuntimeException: java.lang.RuntimeException: [db-load-error]load jdbc.properties error
secbr commented 5 months ago

部署nacos集群是否不能设置为embedded存储模式,用mysql一切正常

根据nacose-ip.yml修改: #nacos dev env NACOS_SERVERS=172.16.238.10:8848 172.16.238.11:8848 172.16.238.12:8848 NACOS_AUTH_ENABLE=true EMBEDDED_STORAGE=embedded #SPRING_DATASOURCE_PLATFORM=mysql #MYSQL_SERVICE_HOST=172.100.0.1 #MYSQL_SERVICE_DB_NAME=nacos #MYSQL_SERVICE_PORT=3306 #MYSQL_SERVICE_USER=xxxx #MYSQL_SERVICE_PASSWORD=xxxx #MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true NACOS_AUTH_IDENTITY_KEY=2222 NACOS_AUTH_IDENTITY_VALUE=2xxx NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789

nacos.log Caused by: com.alibaba.nacos.api.exception.runtime.NacosRuntimeException: errCode: 500, errMsg: java.lang.NullPointerException at com.alibaba.nacos.config.server.service.repository.embedded.DistributedDatabaseOperateImpl.queryOne(DistributedDatabaseOperateImpl.java:237)

protocol-raft.log 2024-03-08 16:41:15,515 ERROR Failed to join the cluster, retry... java.lang.IllegalStateException: Fail to get leader of group nacos_config, Unknown leader, Unknown leader, Unknown leader at com.alipay.sofa.jraft.core.CliServiceImpl.getPeers(CliServiceImpl.java:605)

实测通过embedded存储模式可以实现集群的功能,注意基于内嵌数据库存在的启动命令为: sh startup.sh -p embedded,其中参数是-p而不是-m

secbr commented 5 months ago

有同样的疑问:

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
        at com.alibaba.nacos.Nacos.main(Nacos.java:48)
...
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'basicAuthenticationFilter' defined in class path resource [com/alibaba/nacos/prometheus/filter/PrometheusAuthFilter.class]: Unsatisfied dependency expressed through method 'basicAuthenticationFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosAuthConfig' defined in URL [jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/default-auth-plugin-2.3.0.jar!/com/alibaba/nacos/plugin/auth/impl/NacosAuthConfig.class]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosUserDetailsServiceImpl': Unsatisfied dependency expressed through field 'userPersistService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalUserPersistServiceImpl': Invocation of init method failed; nested exception is java.lang.RuntimeException: java.lang.RuntimeException: [db-load-error]load jdbc.properties error

实测通过embedded存储模式可以实现集群的功能,注意基于内嵌数据库存在的启动命令为: sh startup.sh -p embedded,其中参数是-p而不是-m