안녕하세요 저는 지금 mongo DB 연결 부분을 듣고 있습니다. MongoDB Atlas에서 계정도 만들고 DB도 만들었는데 파이썬에서 계속 ServerSelectionTimeoutError가 발생하고 있습니다. 문제 원인을 찾으려고 찾아봤지만 아무리 해도 나오지 않네요ㅠㅠ 뭐가 문제일까요?
아래에 작성한 코드와 오류코드, mongoDB DB 생성창 캡처해서 보내드립니다!
from pymongo import MongoClient
client = MongoClient('mongodb+srv://test:sparta@cluster0.ylahq.mongodb.net/Cluster0?retryWrites=true&w=majority')
db = client.test
#sparta - password
doc = {
'name':'bob',
'age':27
}
db.users.insert_one(doc)
raise ServerSelectionTimeoutError 이후 이미지 상 짤린 오류 내용:
pymongo.errors.ServerSelectionTimeoutError: cluster0-shard-00-00.ylahq.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131),cluster0-shard-00-01.ylahq.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131),cluster0-shard-00-02.ylahq.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131), Timeout: 30s, Topology Description: <TopologyDescription id: 62d987f56e02ed2bd7d33cac, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('cluster0-shard-00-00.ylahq.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-00.ylahq.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)')>, <ServerDescription ('cluster0-shard-00-01.ylahq.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-01.ylahq.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)')>, <ServerDescription ('cluster0-shard-00-02.ylahq.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-02.ylahq.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)')>]>
mongoDB Database Deployments
netword access
database acess (edit을 눌러 패스워드를 sparta로 변경 확인 후 update user 버튼 클릭)
커넥트 창
커넥션 스트링 복사 내용:
mongodb+srv://test:<password>@cluster0.ylahq.mongodb.net/?retryWrites=true&w=majority