源码安装和DOCKER都出现同样的问题,连接不上数据库,数据库类型为MYSQL,是远程的阿里云RDS,我在本地使用工具可以成功连接数据库,并且确认可以手动创建数据表,说明连接参数是正确的,且有授权,但在安全NOCOBASE的过程中,出现以下错误,数据库中也没有创建任何表。
2024-08-11T03:18:55.398867853Z copying…
2024-08-11T03:19:01.738899451Z yarn run v1.22.19
2024-08-11T03:19:01.775310962Z $ nocobase create-nginx-conf
2024-08-11T03:19:02.181655998Z Done in 0.45s.
2024-08-11T03:19:02.236352765Z nginx started
2024-08-11T03:19:02.415933667Z yarn run v1.22.19
2024-08-11T03:19:02.439222421Z $ nocobase start --quickstart
2024-08-11T03:19:03.218189416Z 2024-08-11T03:19:03: PM2 log: Launching in no daemon mode
2024-08-11T03:19:03.239092917Z 2024-08-11T03:19:03: PM2 log: App [index:0] starting in -fork mode-
2024-08-11T03:19:03.245854896Z 2024-08-11T03:19:03: PM2 log: App [index:0] online
2024-08-11T03:19:05.556549963Z Gateway IPC Server running at /app/nocobase/storage/gateway.sock
2024-08-11T03:19:05.556613513Z Gateway HTTP Server running at http://0.0.0.0:13000/
2024-08-11T03:19:05.704940402Z {“level”:“info”,“message”:“add app main into supervisor”,“meta”:{},“module”:“application”,“submodule”:“supervisor”,“method”:“addApp”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:05”}
2024-08-11T03:19:15.713648232Z {“level”:“warn”,“message”:“attempt 1/9: Unable to connect to the database: connect ETIMEDOUT”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:15”}
2024-08-11T03:19:15.713665602Z {“level”:“warn”,“message”:“will retry in 50ms…”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:15”}
2024-08-11T03:19:25.769720469Z {“level”:“warn”,“message”:“attempt 2/9: Unable to connect to the database: connect ETIMEDOUT”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:25”}
2024-08-11T03:19:25.772025893Z {“level”:“warn”,“message”:“will retry in 100ms…”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:25”}
2024-08-11T03:19:33.895253266Z {“level”:“warn”,“message”:“attempt 3/9: Unable to connect to the database: getaddrinfo EAI_AGAIN rm-******.mysql.rds.aliyuncs.com”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:33”}
2024-08-11T03:19:33.895792671Z {“level”:“warn”,“message”:“will retry in 200ms…”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:33”}
2024-08-11T03:19:44.097962363Z {“level”:“warn”,“message”:“attempt 4/9: Unable to connect to the database: connect ETIMEDOUT”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:44”}
2024-08-11T03:19:44.097986635Z {“level”:“warn”,“message”:“will retry in 400ms…”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:44”}
2024-08-11T03:19:54.500054259Z {“level”:“warn”,“message”:“attempt 5/9: Unable to connect to the database: connect ETIMEDOUT”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:54”}
2024-08-11T03:19:54.500069768Z {“level”:“warn”,“message”:“will retry in 800ms…”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:19:54”}
2024-08-11T03:20:05.306483430Z {“level”:“warn”,“message”:“attempt 6/9: Unable to connect to the database: connect ETIMEDOUT”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:20:05”}
2024-08-11T03:20:05.312875087Z {“level”:“warn”,“message”:“will retry in 1600ms…”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:20:05”}
2024-08-11T03:20:16.915771854Z {“level”:“warn”,“message”:“attempt 7/9: Unable to connect to the database: connect ETIMEDOUT”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:20:16”}
2024-08-11T03:20:16.915824540Z {“level”:“warn”,“message”:“will retry in 3200ms…”,“meta”:{},“module”:“database”,“submodule”:“”,“method”:“auth”,“app”:“main”,“reqId”:“122b353f-799a-4fcb-bc9a-8178d6806caf”,“dataSourceKey”:“main”,“timestamp”:“2024-08-11 03:20:16”}
docker-compose配置
environment:
# 应用的密钥,用于生成用户 token 等
# 如果 APP_KEY 修改了,旧的 token 也会随之失效
# 可以是任意随机字符串,并确保不对外泄露
- APP_KEY=nocobase
# 数据库类型,支持 postgres, mysql, mariadb, sqlite
- DB_DIALECT=mysql
# 数据库主机,可以替换为已有的数据库服务器 IP
- DB_HOST=rm-******.mysql.rds.aliyuncs.com
# 数据库服务器连接端口
- DB_PORT=3306
# 数据库名
- DB_DATABASE=nocobase
# 数据库用户
- DB_USER=nocobase
# 数据库密码
- DB_PASSWORD=nocobase@123456
# 仅 MySQL(或 MariaDB)有效
- DB_TIMEZONE=+08:00
# 数据库表名、字段名是否转为 snake case 风格
- DB_UNDERSCORED=true
volumes:
- /data/container-data/nocobase/storage:/app/nocobase/storage
ports:
- "13000:80"
望指教,感谢!