Couldn't connect to server 127.0.0.1:27017, always changing port to random

388 views
Skip to first unread message

Alexandr R.

unread,
Aug 24, 2016, 7:19:55 PM8/24/16
to mongodb-user

Every time when i try to connect to MongoDB in Windows on port 27017, port changing to random port 51XXX. I already tried mongo --repair with deleting .lock file and I add mongo to firewall rules suggested in tutorial

Hers stacktrace of starting MongoDB server:


C:\mongodb\bin>mongod
2016-08-24T14:30:56.553+0300 I CONTROL  [initandlisten] MongoDB starting : pid=4
316 port=27017 dbpath=C:\data\db\ 64-bit host=alex
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten] targetMinOS: Windows 7/W
indows
Server 2008 R2
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten] db version v3.3.11-85-ga
0ce520
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten] git version: a0ce5202bd4
2b2f59a26a60d1dcfb501fbd13b2c
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten] OpenSSL version: OpenSSL
 
1.0.1p-fips 9 Jul 2015
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten] allocator: tcmalloc
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten] modules: none
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten] build environment:
2016-08-24T14:30:56.554+0300 I CONTROL  [initandlisten]     distmod: 2008plus-ss
l
2016-08-24T14:30:56.555+0300 I CONTROL  [initandlisten]     distarch: x86_64
2016-08-24T14:30:56.555+0300 I CONTROL  [initandlisten]     target_arch: x86_64
2016-08-24T14:30:56.555+0300 I CONTROL  [initandlisten] options: {}
2016-08-24T14:30:56.556+0300 I -        [initandlisten] Detected data files in C
:\data\db\ created by the 'wiredTiger' storage engine, so setting the active sto
rage engine to
'wiredTiger'.
2016-08-24T14:30:56.556+0300 I STORAGE  [initandlisten] wiredtiger_open config:
create
,cache_size=2471M,session_max=20000,eviction=(threads_max=4),config_base=f
alse
,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=sn
appy
),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),st
atistics_log
=(wait=0),
2016-08-24T14:30:57.173+0300 I CONTROL  [initandlisten]
2016-08-24T14:30:57.173+0300 I CONTROL  [initandlisten] ** NOTE: This is a devel
opment version
(3.3.11-85-ga0ce520) of MongoDB.
2016-08-24T14:30:57.173+0300 I CONTROL  [initandlisten] **       Not recommended
 
for production.
2016-08-24T14:30:57.174+0300 I CONTROL  [initandlisten]
2016-08-24T14:30:57.174+0300 I CONTROL  [initandlisten] ** WARNING: Access contr
ol
is not enabled for the database.
2016-08-24T14:30:57.174+0300 I CONTROL  [initandlisten] **          Read and wri
te access to data
and configuration is unrestricted.
2016-08-24T14:30:57.174+0300 I CONTROL  [initandlisten]
2016-08-24T14:30:57.176+0300 I NETWORK  [HostnameCanonicalizationWorker] Startin
g hostname canonicalization worker
2016-08-24T14:30:57.277+0300 W FTDC     [initandlisten] Failed to initialize Per
formance
Counters for FTDC: WindowsPdhError: PdhExpandCounterPathW failed with '
These objects are not detected on your computer.'
for counter '\Processor(_Total
)\% Idle Time'

2016-08-24T14:30:57.277+0300 I FTDC     [initandlisten] Initializing full-time d
iagnostic data capture
with directory 'C:/data/db/diagnostic.data'
2016-08-24T14:30:57.277+0300 I NETWORK  [thread1] waiting for connections on por
t
27017
2016-08-24T14:31:37.615+0300 I NETWORK  [thread1] connection accepted from 127.0
.0.1:51315 #1 (1 connection now open)
2016-08-24T14:31:37.615+0300 I NETWORK  [conn1] received client metadata from 12
7.0.0.1:51315 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "
MongoDB Internal Client"
, version: "3.3.11-85-ga0ce520" }, os: { type: "Windows"
, name: "Microsoft Windows 8", architecture: "x86_64", version: "6.2 (build 9200
)"
} }


My suggestion it's something with my network, maybe my ISP router because command netsh -anshowing redirect from local 27017 to foreign 51315 port. Here netsh -an command outputhttp://i.stack.imgur.com/nczAz.png

how resolve this problem ?


boncalo mihai

unread,
Aug 25, 2016, 2:20:28 PM8/25/16
to mongodb-user
ISP won't forward your port to another and if they would've done it you couldn't see with netstat -an

Can you post here what mongod.conf looks like ?
Reply all
Reply to author
Forward
0 new messages