인프런 커뮤니티 질문&답변

창훈님의 프로필 이미지
창훈

작성한 질문수

지금 당장 데브옵스 AWS

운영 DB 연결 테스트

1-4) 운영 DB 연결 테스트 에서 rds 연결에러

작성

·

579

0

$ npm run start

> saju-backend-nodejs@1.0.0 start

> cross-env NODE_ENV=prod PORT=3000 node server.js

3000 번 포트에서 대기중

ConnectionRefusedError [SequelizeConnectionRefusedError]: connect ECONNREFUSED 127.0.0.1:3306

at ConnectionManager.connect (C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:92:17)

at processTicksAndRejections (node:internal/process/task_queues:96:5)

at async ConnectionManager._connect (C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:222:24)

at async C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:174:32

at async ConnectionManager.getConnection (C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:197:7)

at async C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\sequelize.js:305:26

at async MySQLQueryInterface.tableExists (C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\dialects\abstract\query-interface.js:102:17)

at async Function.sync (C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\model.js:939:21)

at async Sequelize.sync (C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\node_modules\sequelize\lib\sequelize.js:377:9) {

parent: Error: connect ECONNREFUSED 127.0.0.1:3306

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {

errno: -4078,

code: 'ECONNREFUSED',

syscall: 'connect',

address: '127.0.0.1',

port: 3306,

fatal: true

},

original: Error: connect ECONNREFUSED 127.0.0.1:3306

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {

errno: -4078,

code: 'ECONNREFUSED',

syscall: 'connect',

address: '127.0.0.1',

port: 3306,

fatal: true

}

}

C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\server.js:29

throw new Error("Mysql 연결 에러!");

^

Error: Mysql 연결 에러!

at C:\Users\User\Desktop\saju\saju-backend-nodejs-master\saju-backend-nodejs-master\server.js:29:13

at processTicksAndRejections (node:internal/process/task_queues:96:5)

 

npm run start 하면 에러가 나요

컴퓨터를 껐다가 켜도 에러가 납니다..

코드는 아래와 같은데 틀린 부분이 있을까요?

JWT_SECRET= test2022

DEV_DB_HOST= saju-db-prod.c5d7ias6lj0q.ap-northeast-2.rds.amazonaws.com
DEV_DB_DATABASE= saju-db-prod
DEV_DB_USERNAME= admin
DEV_DB_PASSWORD= liUvR09EgxX5xgPU9ilE
DEV_DB_PORT= 3309

TEST_DB_HOST= 
TEST_DB_DATABASE=
TEST_DB_USERNAME= 
TEST_DB_PASSWORD= 

PROD_DB_HOST= 
PROD_DB_DATABASE= 
PROD_DB_USERNAME= 
PROD_DB_PASSWORD= 

PROD_DB_WRITER_HOST= 
PROD_DB_READER_HOST= 

SLACK_KEY= 

 

답변 1

1

창훈님의 프로필 이미지
창훈
질문자

오타가 있었네요!

해결했습니다!

창훈님의 프로필 이미지
창훈

작성한 질문수

질문하기