我是一个非常混乱,沮丧和坦率地失去的mongo新手...
我尝试过安装/卸载mongo,然后重新安装。有一点,它看起来像我按照教程一样工作但最终在我回到在我试图创建的节点应用程序中使用它之后不会。现在我已经安装了它,我创建了/ data / db但是当我去运行时它会一直失败" mongod"
name$ mongod
2015-06-28T15:13:34.503-0400 E NETWORK [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-06-28T15:13:34.503-0400 E NETWORK [initandlisten] addr already in use
2015-06-28T15:13:34.513-0400 I JOURNAL [initandlisten] journal dir=/data/db/journal
2015-06-28T15:13:34.513-0400 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2015-06-28T15:13:34.541-0400 I JOURNAL [durability] Durability thread started
2015-06-28T15:13:34.541-0400 I JOURNAL [journal writer] Journal writer thread started
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten] MongoDB starting : pid=4041 port=27017 dbpath=/data/db 64-bit host=Vickens-MBP.home
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten]
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten]
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] db version v3.0.4
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] git version: nogitversion
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] build info: Darwin yosemitevm.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] allocator: system
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] options: {}
2015-06-28T15:13:34.551-0400 I CONTROL [initandlisten] now exiting
2015-06-28T15:13:34.551-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-06-28T15:13:34.551-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-06-28T15:13:34.551-0400 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-06-28T15:13:34.551-0400 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-06-28T15:13:34.552-0400 I STORAGE [initandlisten] shutdown: final commit...
2015-06-28T15:13:34.555-0400 I JOURNAL [initandlisten] journalCleanup...
2015-06-28T15:13:34.555-0400 I JOURNAL [initandlisten] removeJournalFiles
2015-06-28T15:13:34.556-0400 I JOURNAL [initandlisten] Terminating durability thread ...
2015-06-28T15:13:34.663-0400 I JOURNAL [journal writer] Journal writer thread stopped
2015-06-28T15:13:34.663-0400 I JOURNAL [durability] Durability thread stopped
2015-06-28T15:13:34.664-0400 I STORAGE [initandlisten] shutdown: closing all files...
2015-06-28T15:13:34.665-0400 I STORAGE [initandlisten] closeAllFiles() finished
2015-06-28T15:13:34.665-0400 I STORAGE [initandlisten] shutdown: removing fs lock...
2015-06-28T15:13:34.665-0400 I CONTROL [initandlisten] dbexit: rc: 48
答案 0 :(得分:0)
看起来好像正在运行0.0.0.0:27017, 运行命令先杀死该进程
kill $(lsof -t -i:27017)
然后启动您的mongo服务器
sudo rm /var/lib/mongodb/mongod.lock
mongod --repair
sudo service mongodb start