Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新版nacos容器无法正常启动 #15

Open
DiiD1999 opened this issue Mar 2, 2023 · 2 comments
Open

新版nacos容器无法正常启动 #15

DiiD1999 opened this issue Mar 2, 2023 · 2 comments

Comments

@DiiD1999
Copy link

DiiD1999 commented Mar 2, 2023

环境

  1. CentOS7.6
  2. 使用最新docker-compose.yaml,部署运行了nacos容器

现象

  1. 通过http://192.168.1.46:8848/nacos无法进入Nacos管理界面
  2. 其他docker容器如MySQLRocketMQ等都正常启动。
  3. 使用docker ps -a | grep nacos 命令查看nacos状态,发现nacos一直处于重启状态。命令结果如下
[root@slave1 ~]# docker ps -a | grep nacos
90fb3b7bc783   nacos/nacos-server:v2.2.0-slim             "bin/docker-startup.…"   2 hours ago   Restarting (1) Less than a second ago                                                                                                                       mall4cloud-nacos
  1. 使用vim /root/docker/nacos/logs/nacos.log查看日志发现,在nacos中存在以下错误Unknown column 'encrypted_data_key' in 'field list'.具体错误片段如下
2023-03-02 17:32:43,237 INFO

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2023-03-02 17:32:43,257 ERROR Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'memoryMonitor' defined in URL [jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-config-2.2.0.jar!/com/alibaba/nacos/config/server/monitor/MemoryMonitor.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is 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 :
PreparedStatementCallback; bad SQL grammar [SELECT id,data_id,group_id,tenant_id,app_name,content,md5,gmt_modified,type,encrypted_data_key FROM config_info WHERE id > ? ORDER BY id ASC LIMIT 0,1000]; nested exception is java.sql.SQLSyntaxErrorException: Unknown column 'encrypted_data_key' in 'field list'

原因

为保证用户敏感配置数据的安全,Nacos 提供了配置加密的新特性。降低了用户使用的风险,也不需要再对配置进行单独的加密处理。新版本的默认创建表的sql中已经添加该字段。

**而docker-compose.yml执行时在导入MySQLmall4cloud_nacos数据库与表结构并没有该字段。**导致nacos容器无法正常启动。

解决

数据库表 config_info、config_info_beta、his_config_info中需要新增字段 encrypted_data_key ,用来存储每一个配置项加密使用的秘钥。在mall4cloud_nacos数据库下执行以下语句

ALTER TABLE config_info ADD COLUMN `encrypted_data_key` text NOT NULL COMMENT '秘钥';
ALTER TABLE config_info_beta ADD COLUMN `encrypted_data_key` text NOT NULL COMMENT '秘钥';
ALTER TABLE his_config_info ADD COLUMN `encrypted_data_key` text NOT NULL COMMENT '秘钥';
@gz-yami
Copy link
Owner

gz-yami commented Mar 15, 2023

已解决

@zhx47
Copy link

zhx47 commented Mar 22, 2023

已解决

config_intoencrypted_data_key 字段定义为非空,但是插入语句给的是 null,貌似偷懒了啊,哈哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants