Я установил MongoDB на EC2, и он работает нормально в том же случае, используя localhost и private_ip. Но не может соединиться с другими экземплярами в том же VPC по частному IP и ни по общему IP. Также не удается подключиться с моей локальной машины:
Мой конфиг
systemLog:
destination: file
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
net:
bindIpAll: true
port: 27017
Я также пытался использовать bindIp: 0.0.0.0
вместо bindIpAll
. А также сохраняя оба, но не повезло
Журналы:
2019-01-09T09:52:38.015+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-01-09T09:52:38.018+0530 I CONTROL [main] Trying to start Windows service 'MongoDB'
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] MongoDB starting : pid=3540 port=27017 dbpath=c:\data\db 64-bit host=WIN-8MQFQQRJG01
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] db version v4.0.5
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] allocator: tcmalloc
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] modules: none
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] build environment:
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] distmod: 2008plus-ssl
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] distarch: x86_64
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] target_arch: x86_64
2019-01-09T09:52:38.020+0530 I CONTROL [initandlisten] options: { config: "C:\Program Files\MongoDB\Server\4.0\mongod.cfg", net: { bindIp: "0.0.0.0", bindIpAll: true, port: 27017 }, service: true, storage: { dbPath: "c:\data\db" }, systemLog: { destination: "file", path: "c:\data\log\mongod.log" } }
2019-01-09T09:52:38.021+0530 I STORAGE [initandlisten] Detected data files in c:\data\db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-01-09T09:52:38.021+0530 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-01-09T09:52:38.208+0530 I STORAGE [initandlisten] WiredTiger message [1547007758:207217][3540:140735772102784], txn-recover: Main recovery loop: starting at 17/6016 to 18/256
2019-01-09T09:52:38.352+0530 I STORAGE [initandlisten] WiredTiger message [1547007758:351194][3540:140735772102784], txn-recover: Recovering log 17 through 18
2019-01-09T09:52:38.434+0530 I STORAGE [initandlisten] WiredTiger message [1547007758:434196][3540:140735772102784], txn-recover: Recovering log 18 through 18
2019-01-09T09:52:38.506+0530 I STORAGE [initandlisten] WiredTiger message [1547007758:506194][3540:140735772102784], txn-recover: Set global recovery timestamp: 0
2019-01-09T09:52:38.934+0530 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-01-09T09:52:38.983+0530 I CONTROL [initandlisten]
2019-01-09T09:52:38.983+0530 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-01-09T09:52:38.983+0530 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-01-09T09:52:38.983+0530 I CONTROL [initandlisten]
2019-01-09T09:52:39.077+0530 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'c:/data/db/diagnostic.data'
2019-01-09T09:52:39.078+0530 I NETWORK [initandlisten] waiting for connections on port 27017
2019-01-09T09:52:39.079+0530 I STORAGE [initandlisten] Service running
Моя группа безопасности:
Я пытался сохранить входящие правила для своего IP-адреса, затем всех IP-адресов, но все равно не повезло.
C #
var client = new MongoClient("mongodb://35.174.171.19:27017");
var db = client.GetDatabase("test");
var result = await ListAsync<BsonDocument>(db, "table1");
Ошибка:
A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "3", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 3, EndPoint : "35.174.171.19:27017" }", EndPoint: "35.174.171.19:27017", State: "Disconnected", Type: "Unknown" }] }.
Примечание : Порт, учетные данные открыты для этого вопроса, тогда я буду защищать его .. поэтому не нужно беспокоиться о тестировании.