Home [MongoDB] MongoDB 버전차이 연결 실패 에러
Post
Cancel

[MongoDB] MongoDB 버전차이 연결 실패 에러

MongoDB 버전차이 연결 실패 에러

서버와 서버 사이 ACL은 telnet으로 확인했을 때 접속이 잘 되었다.

하지만 몽고디비 접속이 안되었다.

접속 커맨드

1
2
3
$ mongo --host db_name/IP01:27017,IP02:27017,IP03:27017 --username name --password --authenticationDatabase DB_name DB_name
MongoDB shell version v3.4.13
Enter password:

에러로그

1
2
3
4
5
6
7
8
9
10
connecting to: mongodb://IP01:27017,IP02:27017,IP03:27017/DB_name?replicaSet=DB_name
2022-01-14T09:51:00.815+0000 I NETWORK [thread1] Starting new replica set monitor for DB_name/IP01:27017,IP02:27017,IP03:27017
2022-01-14T09:51:00.817+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to IP01:27017 (1 connections now open to IP01:27017 with a 5 second timeout)
2022-01-14T09:51:00.817+0000 I NETWORK [thread1] Successfully connected to IP02:27017 (1 connections now open to IP02:27017 with a 5 second timeout)
2022-01-14T09:51:00.843+0000 I NETWORK [thread1] Detected bad connection created at 1642153860816699 microSec, clearing pool for IP02:27017 of 0 connections
2022-01-14T09:51:00.843+0000 I NETWORK [thread1] Dropping all pooled connections to IP02:27017(with timeout of 5 seconds)
2022-01-14T09:51:00.843+0000 I NETWORK [thread1] Ending connection to host IP02:27017(with timeout of 5 seconds) due to bad connection status; 0 connections to that host remain open
2022-01-14T09:51:00.843+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Detected bad connection created at 1642153860816672 microSec, clearing pool for IP03:27017 of 0 connections
2022-01-14T09:51:00.843+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Dropping all pooled connections to IP03:27017(with timeout of 5 seconds)
2022-01-14T09:51:00.843+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Ending connection to host IP03:27017(with timeout of 5 seconds) due to bad connection status; 0 connections to that host remain open

처음에는 방화벽 문제인 줄 알았으나, 에러로그를 살펴보면 Connection은 처음에 성공적으로 확인되는 것을 볼 수 있다.

혹시 몰라서 MongoDB 서버의 버전과 클라이언트의 MongoDB 버전을 확인해봤더니 차이가 좀 났다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Original Client Version

$ mongo --version
MongoDB shell version v3.4.13
git version: fbdef2ccc53e0fcc9afb570063633d992b2aae42
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64



Updated Client Version

$ mongo --version
MongoDB shell version v5.0.5
Build Info: {
"version": "5.0.5",
"gitVersion": "d65fd89df3fc039b5c55933c0f71d647a54510ae",
"openSSLVersion": "OpenSSL 1.0.1e-fips 11 Feb 2013",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "rhel70",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}


Destination MongoDB Server version

$ mongo --version
MongoDB shell version v4.2.14
git version: 0e6db36e92d82cc81cbd40ffd607eae88dc1f09d
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64

MongoDB 서버의 버전은 4.2버전대였고, 접속 시도한 클라이언트의 버전은 3.4버전대였다.

둘 사이의 버전 차이가 커서 접속에 실패했던 부분이었다.

클라이언트를 5.0으로 업데이트하니 문제가 해결되었다.

참고 : https://www.mongodb.com/community/forums/t/unable-to-connect-to-cluster-no-primary-detected/90700/17

This post is licensed under CC BY 4.0 by the author.