设为首页 收藏本站
查看: 1264|回复: 0

[经验分享] Mongodb学习笔记1 安装及启动

[复制链接]

尚未签到

发表于 2015-7-7 12:41:26 | 显示全部楼层 |阅读模式
  官网:http://www.mongodb.org/
  下载:http://www.mongodb.org/downloads
  文档:http://www.mongodb.org/display/DOCS/Home
DSC0000.jpg
  安装运行环境:windows2003
  1)下载文件并解压目录(D:\Prog-mongodb\ )结构如下:
  1.1)根目录
DSC0001.jpg
  1.2)bin文件夹
DSC0002.jpg
  2)更改数据库默认目录:
  在根目中新建数据库文件目录 database 名字任意,原始默认目录为c:\data\db\  。
  在dos中 ,切换到 D:\Prog-mongodb 目录,执行如下命令
  $ bin\mongod.exe --dbpath --D:\Prog-mongodb\database   
  显示如下



D:\Prog-mongodb\bin>mongod.exe --dbpath D:\Prog-mongodb\database
Fri Oct 14 11:21:48
Fri Oct 14 11:21:48 warning: 32-bit servers don't have journaling enabled by def
ault. Please use --journal if you want durability.
Fri Oct 14 11:21:48
Fri Oct 14 11:21:48 [initandlisten] MongoDB starting : pid=4108 port=27017 dbpat
h=D:\Prog-mongodb\database 32-bit host=ijobs
Fri Oct 14 11:21:48 [initandlisten]
Fri Oct 14 11:21:48 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are
limited to about 2 gigabytes of data
Fri Oct 14 11:21:48 [initandlisten] **       see http://blog.mongodb.org/post/13
7788967/32-bit-limitations
Fri Oct 14 11:21:48 [initandlisten] **       with --journal, the limit is lower
Fri Oct 14 11:21:48 [initandlisten]
Fri Oct 14 11:21:48 [initandlisten] db version v2.0.0, pdfile version 4.5
Fri Oct 14 11:21:48 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027
caa406222
Fri Oct 14 11:21:48 [initandlisten] build info: windows (5, 1, 2600, 2, 'Service
Pack 3') BOOST_LIB_VERSION=1_42
Fri Oct 14 11:21:48 [initandlisten] options: { dbpath: "D:\Prog-mongodb\database
" }
Fri Oct 14 11:21:48 [websvr] admin web console waiting for connections on port 2 8017 Fri Oct 14 11:21:48 [initandlisten] waiting for connections on port 27017
Fri Oct 14 11:22:48 [clientcursormon] mem (MB) res:15 virt:45 mapped:0
Fri Oct 14 11:27:49 [clientcursormon] mem (MB) res:15 virt:45 mapped:0
Fri Oct 14 11:32:49 [clientcursormon] mem (MB) res:0 virt:45 mapped:0

Fri Oct 14 11:21:48 [websvr] admin web console waiting for connections on port 28017
为web管理端口,可通过http://localhost/28017 浏览

  页面信息如下:
  ---------------------------------------------------------------------

mongod.exe ijobs
  List all commands | Replica set status
  Commands: buildInfo cursorInfo features isMaster listDatabases replSetGetStatus serverStatus top

db version v2.0.0, pdfile version 4.5
git hash: 695c67dff0ffc361b8568a13366f027caa406222
sys info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LIB_VERSION=1_42
uptime: 584 seconds

  low level requires read lock

time to get readlock: 0ms
# databases: 1
replication:
master: 0
slave:  0

  clients

ClientOpIdActiveLockTypeWaitingSecsRunningOpNamespaceQueryclientmsgprogress

initandlisten
0

W


2004
local.system.namespaces
{ name: /^local.temp./ }
0.0.0.0:0




websvr
0

0


0







snapshotthread
0

0


0







clientcursormon
0

R


0






  dbtop (occurences|percent of elapsed)

NStotalReadsWritesQueriesGetMoresInsertsUpdatesRemoves
TOTAL
0
0%
0
0%
0
0%
0
0%
0
0%
0
0%
0
0%
0
0%

  write lock % time in write lock, by 4 sec periods


0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  write locked now: false

  Log

Fri Oct 14 11:21:48 [initandlisten] MongoDB starting : pid=4108 port=27017 dbpath=D:\Prog-mongodb\database 32-bit host=ijobs           11:21:48 [initand

  -----------------------------------------------
mongod 说明
-----------------------------------------------



D:\Prog-mongodb\bin>mongod.exe --help
Fri Oct 14 11:17:54
Fri Oct 14 11:17:54 ** NOTE: when using MongoDB 32 bit, you are limited to about
2 gigabytes of data
Fri Oct 14 11:17:54 **       see http://blog.mongodb.org/post/137788967/32-bit-l
imitations
Fri Oct 14 11:17:54 **       with --journal, the limit is lower
Fri Oct 14 11:17:54
Allowed options:
General options:
-h [ --help ]               show this usage information
--version                   show version information
-f [ --config ] arg         configuration file specifying additional options
-v [ --verbose ]            be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
--quiet                     quieter output
--port arg                  specify port number
--bind_ip arg               comma separated list of ip addresses to listen on
- all local ips by default
--maxConns arg              max number of simultaneous connections
--objcheck                  inspect client data for validity on receipt
--logpath arg               log file to send write to instead of stdout - has
to be a file, not directory
--logappend                 append to logpath instead of over-writing
--pidfilepath arg           full path to pidfile (if not set, no pidfile is
created)
--keyFile arg               private key for cluster authentication (only for
replica sets)
--auth                      run with security
--cpu                       periodically show cpu and iowait utilization
--dbpath arg                directory for datafiles
--diaglog arg               0=off 1=W 2=R 3=both 7=W+some reads
--directoryperdb            each database will be stored in a separate
directory
--journal                   enable journaling
--journalOptions arg        journal diagnostic options
--journalCommitInterval arg how often to group/batch commit (ms)
--ipv6                      enable IPv6 support (disabled by default)
--jsonp                     allow JSONP access via http (has security
implications)
--noauth                    run without security
--nohttpinterface           disable http interface
--nojournal                 disable journaling (journaling is on by default
for 64 bit)
--noprealloc                disable data file preallocation - will often hurt
performance
--noscripting               disable scripting engine
--notablescan               do not allow table scans
--nssize arg (=16)          .ns file size (in MB) for new databases
--profile arg               0=off 1=slow, 2=all
--quota                     limits each database to a certain number of files
(8 default)
--quotaFiles arg            number of files allower per db, requires --quota
--rest                      turn on simple rest api
--repair                    run repair on all dbs
--repairpath arg            root directory for repair files - defaults to
dbpath
--slowms arg (=100)         value of slow for profile and console log
--smallfiles                use a smaller default file size
--syncdelay arg (=60)       seconds between disk syncs (0=never, but not
recommended)
--sysinfo                   print some diagnostic system information
--upgrade                   upgrade db if needed
Windows Service Control Manager options:
--install                install mongodb service
--remove                 remove mongodb service
--reinstall              reinstall mongodb service (equivilant of mongod
--remove followed by mongod --install)
--serviceName arg        windows service name
--serviceDisplayName arg windows service display name
--serviceDescription arg windows service description
--serviceUser arg        user name service executes as
--servicePassword arg    password used to authenticate serviceUser
Replication options:
--fastsync            indicate that this instance is starting from a dbpath
snapshot of the repl peer
--oplogSize arg       size limit (in MB) for op log
Master/slave options:
--master              master mode
--slave               slave mode
--source arg          when slave: specify master as
--only arg            when slave: specify a single database to replicate
--slavedelay arg      specify delay (in seconds) to be used when applying
master ops to slave
--autoresync          automatically resync if slave data is stale
Replica set options:
--replSet arg         arg is [/]
Sharding options:
--configsvr           declare this is a config db of a cluster; default port
27019; default dir /data/configdb
--shardsvr            declare this is a shard db of a cluster; default port
27018
--noMoveParanoia      turn off paranoid saving of data for moveChunk.  this
is on by default for now, but default will switch

  
  3)以服务方法运行 mongodb
DSC0003.jpg
  D:\mongodb\bin>mongod --install --logpath d:\mongodb\logs\MongoDB.log --dbpath d
:\mongodb\db --directoryperdb --bind_ip 127.0.0.1
all output going to: d:\mongodb\logs\MongoDB.log
D:\mongodb\bin>net start MongoDB
Mongo DB 服务已经启动成功。
  
停止:net stop MongoDB (注意大小写)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-84128-1-1.html 上篇帖子: mongodb中的副本集搭建实践 下篇帖子: mongodb指南(翻译)(二十五)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表