Windows Server 2008 R2 SP1 설치 MongoDB

본 고 는 Windows Server 2008 R2 SP1 에 MongoDB 1 을 설치 하 는 것 을 간단하게 소개 합 니 다. 버 전 은 설치 원본 파일 을 선택 하고 다운로드 합 니 다. 64 비트 운영 체제 이 고 2008 R2 에 설치 되 어 있 기 때문에 버 전 mongodb - win 32 - x86 을 선택 하 십시오.64 - 2008 plus - 2.2.2. zip, 독 자 는 자신의 실제 응용 환경 에 따라 선택 합 니 다.http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.2.2.zip
2. d: \ \ 로 압축 을 풀 고 mongodb 로 이름 을 바 꿉 니 다. 경 로 는 d: \ mongodb 3 이 고 데이터베이스 가 있 는 디 렉 터 리 를 설정 하여 디 렉 터 리 를 만 듭 니 다. \ \ data \ db 4, MongoDB 서 비 스 를 시작 합 니 다. 먼저 - help 를 통 해 도움말 을 볼 수 있 습 니 다. 
   
   
   
   
  1. C:\>d:\mongodb\bin\mongod.exe --help  
  2. Allowed options:  
  3.  
  4. General options:  
  5.   -h [ --help ]               show this usage information  
  6.   --version                   show version information  
  7.   -f [ --config ] arg         configuration file specifying additional options  
  8.   -v [ --verbose ]            be more verbose (include multiple times for more  
  9.                               verbosity e.g. -vvvvv)  
  10.   --quiet                     quieter output  
  11.   --port arg                  specify port number - 27017 by default  
  12.   --bind_ip arg               comma separated list of ip addresses to listen on  
  13.                               - all local ips by default  
  14.   --maxConns arg              max number of simultaneous connections - 20000 by  
  15.                               default  
  16.   --objcheck                  inspect client data for validity on receipt  
  17.   --logpath arg               log file to send write to instead of stdout - has  
  18.                               to be a file, not directory  
  19.   --logappend                 append to logpath instead of over-writing  
  20.   --pidfilepath arg           full path to pidfile (if not set, no pidfile is  
  21.                               created)  
  22.   --keyFile arg               private key for cluster authentication  
  23.   --auth                      run with security  
  24.   --cpu                       periodically show cpu and iowait utilization  
  25.   --dbpath arg                directory for datafiles - defaults to \data\db\  
  26.   --diaglog arg               0=off 1=W 2=R 3=both 7=W+some reads  
  27.   --directoryperdb            each database will be stored in a separate  
  28.                               directory  
  29.   --ipv6                      enable IPv6 support (disabled by default)  
  30.   --journal                   enable journaling  
  31.   --journalCommitInterval arg how often to group/batch commit (ms)  
  32.   --journalOptions arg        journal diagnostic options  
  33.   --jsonp                     allow JSONP access via http (has security  
  34.                               implications)  
  35.   --noauth                    run without security  
  36.   --nohttpinterface           disable http interface  
  37.   --nojournal                 disable journaling (journaling is on by default  
  38.                               for 64 bit)  
  39.   --noprealloc                disable data file preallocation - will often hurt  
  40.                               performance  
  41.   --noscripting               disable scripting engine  
  42.   --notablescan               do not allow table scans  
  43.   --nssize arg (=16)          .ns file size (in MB) for new databases  
  44.   --profile arg               0=off 1=slow2=all 
  45.   --quota                     limits each database to a certain number of files  
  46.                               (8 default)  
  47.   --quotaFiles arg            number of files allowed per db, requires --quota  
  48.   --repair                    run repair on all dbs  
  49.   --repairpath arg            root directory for repair files - defaults to  
  50.                               dbpath  
  51.   --rest                      turn on simple rest api  
  52.   --slowms arg (=100)         value of slow for profile and console log  
  53.   --smallfiles                use a smaller default file size  
  54.   --syncdelay arg (=60)       seconds between disk syncs (0=never, but not  
  55.                               recommended)  
  56.   --sysinfo                   print some diagnostic system information  
  57.   --upgrade                   upgrade db if needed  
  58.  
  59. Windows Service Control Manager options:  
  60.   --install                install Windows service  
  61.   --remove                 remove Windows service  
  62.   --reinstall              reinstall Windows service (equivalent to --remove  
  63.                            followed by --install)  
  64.   --serviceName arg        Windows service name  
  65.   --serviceDisplayName arg Windows service display name  
  66.   --serviceDescription arg Windows service description  
  67.   --serviceUser arg        account for service execution  
  68.   --servicePassword arg    password used to authenticate serviceUser  
  69.  
  70. Replication options:  
  71.   --oplogSize arg       size to use (in MB) for replication op log. default is  
  72.                         5% of disk space (i.e. large is good)  
  73.  
  74. Master/slave options:  
  75.   --master              master mode  
  76.   --slave               slave mode  
  77.   --source arg          when slave: specify master as <server:port> 
  78.   --only arg            when slave: specify a single database to replicate  
  79.   --slavedelay arg      specify delay (in seconds) to be used when applying  
  80.                         master ops to slave  
  81.   --autoresync          automatically resync if slave data is stale  
  82.  
  83. Replica set options:  
  84.   --replSet arg           arg is <setname>[/<optionalseedhostlist>]  
  85.   --replIndexPrefetch arg specify index prefetching if secondary)  
  86.                           [none|_id_only|all]  
  87.  
  88. Sharding options:  
  89.   --configsvr           declare this is a config db of a cluster; default port  
  90.                         27019; default dir /data/configdb  
  91.   --shardsvr            declare this is a shard db of a cluster; default port  
  92.                         27018  
  93.   --noMoveParanoia      turn off paranoid saving of data for moveChunk.  this  
  94.                         is on by default for now, but default will switch  

자세 한 내용 을 도 와 드 리 겠 습 니 다. 
   
   
   
   
  1. C:\ >d:\mongodb\bin\mongod.exe --dbpath=d:\data\db  
  2. Sun Dec 30 20:22:19 [initandlisten] MongoDB starting : pid=2512 port=27017 ddbpath=d:\data\db 64-bit host=WIN-6HB65GUTBNC  
  3.  
  4. Sun Dec 30 20:22:19 [initandlisten] db version v2.2.2, pdfile version 4.5  
  5. Sun Dec 30 20:22:19 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267  
  6. Sun Dec 30 20:22:19 [initandlisten] build info: windows sys.getwindowsversion(major=6minor=1build=7601platform=2,  
  7. service_pack='Service Pack 1'BOOST_LIB_VERSION=1_49 
  8. Sun Dec 30 20:22:19 [initandlisten] options: { dbpath: "d:\data\db" }  
  9. Sun Dec 30 20:22:19 [initandlisten] journal ddir=d:/data/db/journal  
  10. Sun Dec 30 20:22:19 [initandlisten] recover : no journal files present, no recovery needed  
  11. Sun Dec 30 20:22:19 [initandlisten] preallocating a journal file d:/data/db/journal/prealloc.1  
  12. Sun Dec 30 20:22:29 [initandlisten] preallocating a journal file d:/data/db/journal/prealloc.2  
  13. Sun Dec 30 20:22:39 [initandlisten] waiting for connections on port 27017  
  14. Sun Dec 30 20:22:39 [websvr] admin web console waiting for connections on port 28017  

출력 내용 을 통 해 MongoDB 의 프로 세 스 번호, 감청 포트 번호, 버 전 번호, 웹 액세스 포트 등 정 보 를 볼 수 있 습 니 다. 5. 브 라 우 저 를 통 해 현재 상태 통계 정 보 를 볼 수 있 습 니 다. 예 를 들 어:http://127.0.0.1:28017/
6 、 MongoDB 서비스 정지, Ctrl - C
   
   
   
   
  1. C:\Users\Administrator>d:\mongodb\bin\mongod.exe --dbpath=d:\data\db  
  2. Sun Dec 30 20:22:19 [initandlisten] MongoDB starting : pid=2512 port=27017 ddbpath=d:\data\db 64-bit host=WIN-6HB65GUTBNC  
  3.  
  4. Sun Dec 30 20:22:19 [initandlisten] db version v2.2.2, pdfile version 4.5  
  5. Sun Dec 30 20:22:19 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267  
  6. Sun Dec 30 20:22:19 [initandlisten] build info: windows sys.getwindowsversion(major=6minor=1build=7601platform=2,  
  7. service_pack='Service Pack 1'BOOST_LIB_VERSION=1_49 
  8. Sun Dec 30 20:22:19 [initandlisten] options: { dbpath: "d:\data\db" }  
  9. Sun Dec 30 20:22:19 [initandlisten] journal ddir=d:/data/db/journal  
  10. Sun Dec 30 20:22:19 [initandlisten] recover : no journal files present, no recovery needed  
  11. Sun Dec 30 20:22:19 [initandlisten] preallocating a journal file d:/data/db/journal/prealloc.1  
  12. Sun Dec 30 20:22:29 [initandlisten] preallocating a journal file d:/data/db/journal/prealloc.2  
  13. Sun Dec 30 20:22:39 [initandlisten] waiting for connections on port 27017  
  14. Sun Dec 30 20:22:39 [websvr] admin web console waiting for connections on port 28017  
  15. Sun Dec 30 20:32:19 Ctrl-C signal  
  16. Sun Dec 30 20:32:19 [consoleTerminate] got CTRL_C_EVENT, will terminate after current cmd ends  
  17. Sun Dec 30 20:32:19 [consoleTerminate] now exiting  
  18. Sun Dec 30 20:32:19 dbexit:  
  19. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: going to close listening sockets...  
  20. Sun Dec 30 20:32:19 [consoleTerminate] closing listening socket: 368  
  21. Sun Dec 30 20:32:19 [consoleTerminate] closing listening socket: 376  
  22. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: going to flush diaglog...  
  23. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: going to close sockets...  
  24. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: waiting for fs preallocator...  
  25. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: lock for final commit...  
  26. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: final commit...  
  27. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: closing all files...  
  28. Sun Dec 30 20:32:19 [consoleTerminate] closeAllFiles() finished  
  29. Sun Dec 30 20:32:19 [consoleTerminate] journalCleanup...  
  30. Sun Dec 30 20:32:19 [consoleTerminate] removeJournalFiles  
  31. Sun Dec 30 20:32:19 [consoleTerminate] shutdown: removing fs lock...  
  32. Sun Dec 30 20:32:19 dbexit: really exiting now  
  33.  

7. MongoDB 를 Windows 서비스 에 추가 하여 파일 D: \ mongodb \ \ logs \ \ mongodb. log 를 만 들 고 다음 명령 을 수행 합 니 다. d: \ mongodb \ \ bin \ mongodb. exe -- dbpath = d: \ \ data \ db -- logpath = d: \ mongodb \ logs \ \ mongodb. log – install
 
   
   
   
   
  1. C:\ >d:\mongodb\bin\mongod.exe --dbpath=d:\data\db --logpath=d:\mongodb\logs\mongodb.log --install  
  2. all output going to: d:\mongodb\logs\mongodb.log  
  3. log file [d:\mongodb\logs\mongodb.log] exists; copied to temporary file [d:\mongodb\logs\mongodb.log.2012-12-30T12-30-11] 

이 때 net start "Mongo DB" 를 통 해 서 비 스 를 시작 할 수 있 습 니 다. C: \ > net start "Mongo DB"
Mongo DB 서비스 가 시작 되 었 습 니 다.
net stop "Mongo DB" 를 통 해 서 비 스 를 닫 습 니 다. C: \ > net stop "Mongo DB" 에서 시스템 오류 109 가 발생 했 습 니 다.
파이프 가 끝 났 습 니 다.닫 을 때 오류 알림 이 있 을 수 있 습 니 다. bug 일 것 입 니 다. 무시 할 수 있 습 니 다. 영향 을 주지 않 지만 항상 기분 이 좋 지 않 습 니 다. MongoDB 팀 이 이 작은 bug 를 빨리 해결 하 기 를 바 랍 니 다.8. MongoDB 를 방문 하여 D: \ mongodb \ bin \ mongo. exe 를 더 블 클릭 하거나 cmd 명령 프롬프트 에 'D: \ mongodb \ bin \ mongo. exe' 를 입력 하면 접근 할 수 있 습 니 다. 
 
   
   
   
   
  1. C:\>d:\mongodb\bin\mongo.exe --help  
  2. MongoDB shell version: 2.2.2  
  3. usage: d:\mongodb\bin\mongo.exe [options] [db address] [file names (ending in .js)]  
  4. db address can be:  
  5.   foo                   foo database on local machine  
  6.   192.169.0.5/foo       foo database on 192.168.0.5 machine  
  7.   192.169.0.5:9999/foo  foo database on 192.168.0.5 machine on port 9999  
  8. options:  
  9.   --shell               run the shell after executing files  
  10.   --nodb                don't connect to mongod on startup - no 'db address'  
  11.                         arg expected  
  12.   --norc                will not run the ".mongorc.js" file on start up  
  13.   --quiet               be less chatty  
  14.   --port arg            port to connect to  
  15.   --host arg            server to connect to  
  16.   --eval arg            evaluate javascript  
  17.   -u [ --username ] arg username for authentication  
  18.   -p [ --password ] arg password for authentication  
  19.   -h [ --help ]         show this usage information  
  20.   --version             show version information  
  21.   --verbose             increase verbosity  
  22.   --ipv6                enable IPv6 support (disabled by default)  
  23.  
  24. file names: a list of files to run. files have to end in .js and will exit after unless --shell is specified  

다음은 서비스 로 시 작 될 때의 로그 내용 입 니 다. 
   
   
   
   
  1. Sun Dec 30 21:05:49 Trying to start Windows service 'MongoDB'  
  2. Sun Dec 30 21:05:49 Service running  
  3. Sun Dec 30 21:05:49 [initandlisten] MongoDB starting : pid=3884 port=27017 ddbpath=d:\data\db 64-bit host=WIN-6HB65GUTBNC  
  4. Sun Dec 30 21:05:49 [initandlisten] db version v2.2.2, pdfile version 4.5  
  5. Sun Dec 30 21:05:49 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267  
  6. Sun Dec 30 21:05:49 [initandlisten] build info: windows sys.getwindowsversion(major=6minor=1build=7601platform=2service_pack='Service Pack 1'BOOST_LIB_VERSION=1_49 
  7. Sun Dec 30 21:05:49 [initandlisten] options: { dbpath: "d:\data\db", logpath: "d:\mongodb\logs\mongodb.log", service: true }  
  8. Sun Dec 30 21:05:50 [initandlisten] journal ddir=d:/data/db/journal  
  9. Sun Dec 30 21:05:50 [initandlisten] recover : no journal files present, no recovery needed  
  10. Sun Dec 30 21:05:50 [initandlisten] waiting for connections on port 27017  
  11. Sun Dec 30 21:05:50 [websvr] admin web console waiting for connections on port 28017  
  12. Sun Dec 30 21:10:06 [initandlisten] connection accepted from 127.0.0.1:16061 #5 (1 connection now open)  
  13. Sun Dec 30 21:11:34 [initandlisten] connection accepted from 124.193.159.8:27974 #6 (2 connections now open)  
  14. Sun Dec 30 21:12:52 [serviceShutdown] got SERVICE_CONTROL_STOP request from Windows Service Control Manager, will terminate after current cmd ends  
  15. Sun Dec 30 21:12:52 [serviceShutdown] now exiting  
  16. Sun Dec 30 21:12:52 dbexit:   
  17. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: going to close listening sockets...  
  18. Sun Dec 30 21:12:52 [serviceShutdown] closing listening socket: 412  
  19. Sun Dec 30 21:12:52 [serviceShutdown] closing listening socket: 420  
  20. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: going to flush diaglog...  
  21. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: going to close sockets...  
  22. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: waiting for fs preallocator...  
  23. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: lock for final commit...  
  24. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: final commit...  
  25. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: closing all files...  
  26. Sun Dec 30 21:12:52 [serviceShutdown] closeAllFiles() finished  
  27. Sun Dec 30 21:12:52 [serviceShutdown] journalCleanup...  
  28. Sun Dec 30 21:12:52 [conn6] end connection 124.193.159.8:27974 (1 connection now open)  
  29. Sun Dec 30 21:12:52 [conn5] end connection 127.0.0.1:16061 (1 connection now open)  
  30. Sun Dec 30 21:12:52 [serviceShutdown] removeJournalFiles  
  31. Sun Dec 30 21:12:52 [serviceShutdown] shutdown: removing fs lock...  
  32. Sun Dec 30 21:12:52 [initandlisten] now exiting  
  33. Sun Dec 30 21:12:52 dbexit: ; exiting immediately  

좋은 웹페이지 즐겨찾기