Hi I (think) just installed MongoDB to my local xampp machine.
I followed tutorials online and all seems to be done:
Moved pre-compiled
mongo.so
intoXAMPP/xampfiles/lib/php/php5.3/extensions/no-debug-non-zts-20090626/
Added this line of code into php.ini:
extension = mongo.so
Restarted Apache
Connected to localhost and I can see the mongo extension in
phpinfo()
Went to http://localhost:27017 to see mongo interface and couldn't connect to it (Firefox returns an error)
Then I downloaded the MongoHub client for mac osx to create/manage mongo databases, but it says socket error, and seems there is no connection to MongoDB
I (think) I installed also mongoDB itself
- I created a directory:
XAMPP/xampfiles/var/mongodb
- I excracted tar MongoDB package file under
var/mongodb
so now I havevar/mongodb/bin
- From
var/mongodb
I launched this command:
./bin/mongod
And it returned:
Sun Sep 11 22:40:32 [initandlisten] MongoDB starting : pid=946 port=27017 dbpath=/data/db/ 64-bit
Sun Sep 11 22:40:32 [initandlisten] db version v1.8.3, pdfile version 4.5
Sun Sep 11 22:40:32 [initandlisten] git versi开发者_JAVA技巧on: c206d77e94bc3b65c76681df5a6b605f68a2de05
Sun Sep 11 22:40:32 [initandlisten] build sys info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Sun Sep 11 22:40:32 [initandlisten] exception in initAndListen std::exception: dbpath (/data/db/) does not exist, terminating
Sun Sep 11 22:40:32 dbexit:
Sun Sep 11 22:40:32 [initandlisten] shutdown: going to close listening sockets...
Sun Sep 11 22:40:32 [initandlisten] shutdown: going to flush diaglog...
Sun Sep 11 22:40:32 [initandlisten] shutdown: going to close sockets...
Sun Sep 11 22:40:32 [initandlisten] shutdown: waiting for fs preallocator...
Sun Sep 11 22:40:32 [initandlisten] shutdown: closing all files...
Sun Sep 11 22:40:32 closeAllFiles() finished
Sun Sep 11 22:40:32 dbexit: really exiting now
Launching ./bin/mongo
also returns:
MongoDB shell version: 1.8.3
connecting to: test
Sun Sep 11 22:41:11 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:79
exception: connect failed
You have to start mongo with this command
mongod --dbpath=data
The --dbpath=data argument is where your database will be allocated, data is the path and could be something like /var/lib/mongodb/data or /data/mongodb.
And after that command you can go to http://localhost:27017 and see the mongodb monitor.
Good luck!
精彩评论