win 之 mongo安装

一、得到MongoDBphp

 《 从同事处获得的是两个exe的,故只需配置一下data的路劲便可html

  %cd%\mongod.exe --dbpath %cd%\mongodata
pause 》web

————————————————————————————————mongodb

2014-05-07 以前xp退役,换成win7以后,以前的不能用了(不知道什么缘由)...shell

因此顺便更新一下:apache

Mongodb下载:http://www.mongodb.org/downloads浏览器

D:\>cd Mongodb

D:\Mongodb>cd bin

D:\Mongodb\bin>mongod.exe --install --logpath=D:\Mongodb\log\log.txt --dbpath=D:
\Mongodb\db
2014-05-07T15:07:09.755+0800 log file "D:\Mongodb\log\log.txt" exists; moved to
"D:\Mongodb\log\log.txt.2014-05-07T07-07-09".
####
在log.txt中能看到
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB"'.
###

D
:\Mongodb\bin>net start mongodb MongoDB 服务正在启动 . MongoDB 服务已经启动成功。 D:\Mongodb\bin>mongo MongoDB shell version: 2.6.1 connecting to: test Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user >

 打开http://127.0.0.1:27017/,服务器

能够看到It looks like you are trying to access MongoDB over HTTP on the native driver port.less

打开另一个命令窗口ui

D:\Mongodb\bin>mongo
MongoDB shell version: 2.6.1
connecting to: test
>

即链接到mongodb

PS:

1)期间遇到报错:Error connecting to the Service Control Manager:....

用管理员的身份运行便可

2)中止MongoDB Service。

net stop MongoDB

3)删除MongoDB Service。

d:\Mongodb\bin\>mongod --remove

二、配置php-mongo

  下载php_mongo.dll,版本是php5.2 vc6(对应apache) vc9(对应iis);

  Note:个人环境虽然是apache,可是提示Fatal error: Class 'Mongo' not found,看到php.net上有人说他改用了vc9就能够了,因此尝试了一下,成功了!

  修改php.ini extension=php_mongo.dll

  重启apache

三、启动mongo服务

  cmd进入mongo的安装目录,输入mongod.exe -dbpath ./mongodata 服务端启动成功

  cmd进入mongo的安装目录,输入mongo.exe 客户端启动成功

服务器端:

...

Mon Mar 31 15:19:19.156 [initandlisten] waiting for connections on port 27017
Mon Mar 31 15:19:19.156 [websvr] admin web console waiting for connections on po
rt 28017
Mon Mar 31 15:20:11.562 [initandlisten] connection accepted from 127.0.0.1:3197
#1 (1 connection now open)//出如今客户端启动后
Mon Mar 31 15:20:18.781 [PeriodicTask::Runner] task: DBConnectionPool-cleaner to
ok: 21ms

 

客户端:

                                                                       
MongoDB shell version: 2.4.5
connecting to: test                                                    
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
Server has startup warnings:
Mon Mar 31 15:19:18.687 [initandlisten]
Mon Mar 31 15:19:18.687 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary
.
Mon Mar 31 15:19:18.687 [initandlisten] **       32 bit builds are limited to le
ss than 2GB of data (or less with --journal).
Mon Mar 31 15:19:18.687 [initandlisten] **       Note that journaling defaults t
o off for 32 bit and is currently off.
Mon Mar 31 15:19:18.687 [initandlisten] **       See http://dochub.mongodb.org/c
ore/32bit
Mon Mar 31 15:19:18.687 [initandlisten]
Mon Mar 31 15:19:18.687 [initandlisten] ** NOTE: your operating system version d
oes not support the method that MongoDB
Mon Mar 31 15:19:18.687 [initandlisten] **       uses to detect impending page f
aults.
Mon Mar 31 15:19:18.687 [initandlisten] **       This may result in slower perfo
rmance for certain use cases
Mon Mar 31 15:19:18.687 [initandlisten]
>

 Mongo 命令:

  http://www.cnblogs.com/xusir/archive/2012/12/24/2830957.html

  http://ithead.iteye.com/blog/1466081

  http://blog.csdn.net/zhengshqing/article/details/8686847

  http://my.oschina.net/u/572987/blog/99760

  http://runfriends.iteye.com/blog/1830749

  批量插入 batchInsert: http://www.cnblogs.com/wangtao_20/p/3273679.html

 其余可能的问题:

  http://www.myexception.cn/database/614108.html

Win7 32下运行MongoDB出错:couldn't connect to server 127.0.0.1 shell/mongo.js:84

第一次在Win7 32下安装了MongoDB,第一次安装(具体安装能够去博客园上找资料不少)一切都能运行成功,可是问题出现了在我从新再去启动MongoDB时系统提 示我 couldn't connect to server 127.0.0.1 shell/mongo.js:84,问题一直不知道怎么回事?最后问题获得解决

  • 缘由:mongodb不正常关闭形成的mongodb被锁定
  • 解决方案:将标识锁定的文件mongod.lock删除,通常这个文件在你安装MongoDB时建立的Data目录下;

从新运行Mongo,此时再去看看data目录下,已经从新又生成一个mongod.lock文件,不用担忧这个,在此刻你已经发现没有出错提示,在浏览器输入http://localhost:27017去看看。

http://localhost:28017去看看

注意若是你在Win7 64或者Linux系统下也遇到这样的问题,应该是同一类问题,具体解决方案应该相同。

相关文章
相关标签/搜索