Nodejs-MongoDB connection error: openssl
MongoDB Atlas에서 갑자기 [Alert] You're nearing the maximum connections threshold 라는 제목으로 메일이 왔다.
내용을 보아하니 You are receiving this alert email because connections to your cluster(s) have exceeded your threshold, and is nearing the connection limit for the M0 cluster... 라는 내용이다. MongoDB를 연결해서 쓰고 있는 Node.js 프로젝트 로그를 보아하니 아래 메시지가 있었다. 분명 잘 구동되던 것이었는데!
mongo connection error! 00216A5BF87F0000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1605:SSL alert number 80
달라진게 있다면, node.js 프로젝트를 구동하는 IP주소가 바뀌었다는 것!
IP주소가 바뀐 상태에서 기존에 허용해놓은 IP주소가 아닌 다른 IP주소로 프로젝트를 구동하고 계속 DB에 접속을 시도해서 커넥션만 늘어나고 연결이 되지 않을 것으로 보인다.
MongoDB(https://mongodb.com/)에 접속해서 현재 프로젝트를 띄우는 IP주소를 추가해주도록 하자.
- Projects 탭 > Project Name 목록에서 프로젝트 선택 > Network Access 탭 > ADD IP ADDRESS(우측 상단) > ip 주소 추가
모든 IP주소에서 접속을 허용하기 위해서 0.0.0.0으로 추가해주었다.
다시 프로젝트를 확인해보면 DB에 정상적으로 연결된 것을 확인할 수 있다.