Mongodb をインスコ




まずはこちらのページにしたがって yumリポジトリに追加

http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages

[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# cat 10gen.repo
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0

[root@localhost yum.repos.d]#

ヘタレなのでパッケージマネージャーでインスコ

めんどっちーの下を参考に root でディレクトリを作って、すぐサーバを起動

http://www.mongodb.org/display/DOCS/Quickstart+Unix

[root@localhost ~]# mkdir -p /data/db
[root@localhost ~]# cd /usr/bin
[root@localhost bin]# ./mongod
./mongod --help for help and startup options
Sun Oct 23 21:08:59 [initandlisten] MongoDB starting : pid=26177 port=27017 dbpath=/data/db/ 64-bit host=localhost.localdomain
Sun Oct 23 21:08:59 [initandlisten] db version v2.0.1, pdfile version 4.5
Sun Oct 23 21:08:59 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684
Sun Oct 23 21:08:59 [initandlisten] build info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
Sun Oct 23 21:08:59 [initandlisten] options: {}
Sun Oct 23 21:08:59 [initandlisten] journal dir=/data/db/journal
Sun Oct 23 21:08:59 [initandlisten] recover : no journal files present, no recovery needed
Sun Oct 23 21:08:59 [initandlisten] preallocateIsFaster=true 8.28
Sun Oct 23 21:09:00 [initandlisten] preallocateIsFaster=true 8.78
Sun Oct 23 21:09:01 [initandlisten] preallocateIsFaster=true 8.74
Sun Oct 23 21:09:01 [initandlisten] preallocating a journal file /data/db/journal/prealloc.0
356515840/1073741824 33%
744488960/1073741824 69%
Sun Oct 23 21:09:09 [initandlisten] preallocating a journal file /data/db/journal/prealloc.1
639631360/1073741824 59%
Sun Oct 23 21:09:16 [initandlisten] preallocating a journal file /data/db/journal/prealloc.2
587202560/1073741824 54%
Sun Oct 23 21:09:22 [websvr] admin web console waiting for connections on port 28017
Sun Oct 23 21:09:22 [initandlisten] waiting for connections on port 27017

別な term で疎通をとってみた

[mitsuaki@localhost ~]$ /usr/bin/mongo
MongoDB shell version: 2.0.1
connecting to: test
> db.foo.save( { a: 1 })
> db.foo.find()
{ "_id" : ObjectId("4ea4043d442da8cab402a458"), "a" : 1 }
> exit
bye
[mitsuaki@localhost ~]$

芽出度し、芽出度し