mongodb를 처음 설치 하고 테스트를 시작 한다.
1. download : http://www.mongodb.org
2. extract tar : tar xvzf mongodb-osx-x86_64-2.2.3.tgz
3. move it to my folder : move ....
4. setup env var
5. init mongod
5.1. sudo mkdir -p /data/db
5.2 sudo chown `id -u` /data/db
5.3 mongod
아래와 같이 시작 시켜 봅니다.
~$ cd /Users/mulder/devApp/mongodb-osx-x86_64-2.2.3 mongodb-osx-x86_64-2.2.3$ mongodb-osx-x86_64-2.2.3$ cd bin bin$ ls bsondump* mongod* mongoexport* mongoimport* mongoperf* mongos* mongostat* mongo* mongodump* mongofiles* mongooplog* mongorestore* mongosniff* mongotop* bin$ ./mongod ./mongod --help for help and startup options Tue Feb 26 11:53:12 [initandlisten] MongoDB starting : pid=47379 port=27017 dbpath=/data/db/ 64-bit host=youngsung.aromasoft.com Tue Feb 26 11:53:12 [initandlisten] Tue Feb 26 11:53:12 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 Tue Feb 26 11:53:12 [initandlisten] db version v2.2.3, pdfile version 4.5 Tue Feb 26 11:53:12 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08 Tue Feb 26 11:53:12 [initandlisten] build info: Darwin bs-osx-106-x86-64-1.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49 Tue Feb 26 11:53:12 [initandlisten] options: {} Tue Feb 26 11:53:12 [initandlisten] journal dir=/data/db/journal Tue Feb 26 11:53:12 [initandlisten] recover : no journal files present, no recovery needed Tue Feb 26 11:53:12 [websvr] admin web console waiting for connections on port 28017 Tue Feb 26 11:53:12 [initandlisten] waiting for connections on port 27017 Tue Feb 26 11:53:26 [initandlisten] connection accepted from 127.0.0.1:49859 #1 (1 connection now open) Tue Feb 26 11:54:25 [FileAllocator] allocating new datafile /data/db/test.ns, filling with zeroes... Tue Feb 26 11:54:25 [FileAllocator] creating directory /data/db/_tmp Tue Feb 26 11:54:26 [FileAllocator] done allocating datafile /data/db/test.ns, size: 16MB, took 0.937 secs Tue Feb 26 11:54:26 [FileAllocator] allocating new datafile /data/db/test.0, filling with zeroes... Tue Feb 26 11:54:28 [FileAllocator] done allocating datafile /data/db/test.0, size: 64MB, took 1.392 secs Tue Feb 26 11:54:28 [FileAllocator] allocating new datafile /data/db/test.1, filling with zeroes... Tue Feb 26 11:54:28 [conn1] build index test.test { _id: 1 } Tue Feb 26 11:54:28 [conn1] build index done. scanned 0 total records. 0 secs Tue Feb 26 11:54:28 [conn1] insert test.test keyUpdates:0 locks(micros) w:2380398 2380ms Tue Feb 26 11:54:31 [FileAllocator] done allocating datafile /data/db/test.1, size: 128MB, took 2.749 secs Tue Feb 26 11:54:37 [conn1] end connection 127.0.0.1:49859 (0 connections now open)
아래는 mongo가 동작 하는지 확인 하는 절차 입니다.
~$ mongo MongoDB shell version: 2.2.3 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 > show dbs; local (empty) > shows Tue Feb 26 11:53:45 ReferenceError: shows is not defined (shell):1 > use test; switched to db test > db.test.find(); > db.test.save ( { a: 1, b:2 } ); > db.test.find(); { "_id" : ObjectId("512c23e19b5cdd1a61b9a4a5"), "a" : 1, "b" : 2 } > exit bye ~$
자.... mongo 로 여행을 가시죠. :)