MongoDB not working in Vagrant Centos Box

2019-06-03 12:10发布

问题:

I cant seem to fork off an instance of the MongoDB daemon when I am logged in to a Centos 7.1 Box. I have created the data/db folder and everytime I try to run

./bin/mongod --dbpath data/db

I get a mess of errors

2016-01-26T00:44:23.820+0000 I CONTROL  [initandlisten] MongoDB starting : pid=2735 port=27017 dbpath=data/db 64-bit host=localhost.localdomain
2016-01-26T00:44:23.820+0000 I CONTROL  [initandlisten] db version v3.2.1
2016-01-26T00:44:23.820+0000 I CONTROL  [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
2016-01-26T00:44:23.821+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2016-01-26T00:44:23.821+0000 I CONTROL  [initandlisten] modules: none
2016-01-26T00:44:23.821+0000 I CONTROL  [initandlisten] build environment:
2016-01-26T00:44:23.821+0000 I CONTROL  [initandlisten]     distarch: x86_64
2016-01-26T00:44:23.821+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2016-01-26T00:44:23.821+0000 I CONTROL  [initandlisten] options: { storage: { dbPath: "data/db" } }
2016-01-26T00:44:23.842+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(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),
2016-01-26T00:44:23.853+0000 E STORAGE  [initandlisten] WiredTiger (22) [1453769063:853352][2735:0x7f09f2eddcc0], connection: data/db/WiredTiger.wt: fsync: Invalid argument
2016-01-26T00:44:23.856+0000 I -        [initandlisten] Fatal Assertion 28561
2016-01-26T00:44:23.856+0000 I -        [initandlisten] 

***aborting after fassert() failure

The strange thing is I did it earlier and it worked. What could be the problem?

回答1:

It turns out that putting the downloaded mongodb database in the synced folder between the host machine and the virtual machine caused some type of permissions issue or configuration issue.

When you take it out of the synced folder - which most likely has the Vagrantfile - and put it in a folder thats not synced/shared it seems to work just fine. Thought id save someone the 5 hours I wasted :-)