简体   繁体   中英

Can't connect to mongodb on remote but can on local

I'm trying to connect my node.js server (on ec2 instance) to my mongodb server (on ec2 instance but not the same). All works fine, i can connect to my mongodb with mongo on local but my node.js can't. Event if i try to type this command :

mongo <ec2-instance>/<dbname> -u <username> -p <password> --authenticationDatabase <dbname>

i get this error :

E QUERY [thread1] Error: couldn't connect to server :27017, connection attempt failed : connect@src/mongo/shell/mongo.js:237:13 @(connect):1:6 exception: connect failed

2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] MongoDB starting : pid=2888 port=27017 dbpath=/data/db 64-bit host=ip-172-31-23-145
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] db version v3.4.9
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] git version: 876ebee8c7dd0e2d992f36a848ff4dc50ee6603e
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.0-fips 29 Mar 2010
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] allocator: tcmalloc
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] modules: none
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] build environment:
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten]     distmod: amazon
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten]     distarch: x86_64
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten]     target_arch: x86_64
    2018-02-15T10:37:08.017+0000 I CONTROL  [initandlisten] options: {}
    2018-02-15T10:37:08.017+0000 W -        [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
    2018-02-15T10:37:08.042+0000 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
    2018-02-15T10:37:08.042+0000 W STORAGE  [initandlisten] Recovering data from the last clean checkpoint.
    2018-02-15T10:37:08.042+0000 I STORAGE  [initandlisten]
    2018-02-15T10:37:08.042+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
    2018-02-15T10:37:08.042+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
    2018-02-15T10:37:08.042+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=3480M,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),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
    2018-02-15T10:37:08.065+0000 E STORAGE  [initandlisten] WiredTiger error (1) [1518691028:65354][2888:0x7f4adae46e00], file:collection-2--1305918998266443804.wt, WT_SESSION.open_cursor: /data/db/collection-2--1305918998266443804.wt: handle-open: open: Operation not permitted
    2018-02-15T10:37:08.065+0000 I -        [initandlisten] Invariant failure: ret resulted in status UnknownError: 1: Operation not permitted at src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp 95
    2018-02-15T10:37:08.065+0000 I -        [initandlisten]

    ***aborting after invariant() failure


    2018-02-15T10:37:08.076+0000 F -        [initandlisten] Got signal: 6 (Aborted).

Here is what i got when i try to start mongod on my instance..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM