使用typeorm和aws rds aurora mysql示例的“握手不活动超时”

yrdbyhpb  于 2021-06-19  发布在  Mysql
关注(0)|答案(1)|浏览(702)

尝试使用typeorm连接到aws-rds-aurora-db-mysql Handshake inactivity timeout 错误。

code: 'PROTOCOL_SEQUENCE_TIMEOUT',
fatal: true,
timeout: 10000

尝试使用默认的10秒和我自己的15秒超时。 ormconfig.json 文件:

{
    "type": "mysql",
    "host": "host connection string",
    "port": 3306,
    "username": "xxxx",
    "password": "xxxx",
    "database": "xxxx",
    "synchronize": true,
    "logging": true,
    "connectTimeout": 15000,
    "entities": [
       "src/entity/**/*.ts"
    ],
    "migrations": [
       "src/migration/**/*.ts"
    ],
    "subscribers": [
       "src/subscriber/**/*.ts"
    ],
    "cli": {
       "entitiesDir": "src/entity",
       "migrationsDir": "src/migration",
       "subscribersDir": "src/subscriber"
    }
}

能够使用linux mysql客户端cli连接示例,甚至尝试在同一vpc中使用ecs连接数据库,但出现了相同的错误。

chhqkbe1

chhqkbe11#

这个问题最常见的过程是vpc和安全组规则的错误设置。试着为它写进/出规则。
有用的链接:*https://docs.aws.amazon.com/en_us/vpc/latest/userguide/vpc_securitygroups.html#defaultsecuritygroup *https://docs.aws.amazon.com/en_us/awscloudformation/latest/userguide/aws-properties-ec2-security-group-ingress.html

相关问题