====== Install from 10gen.repo ======
※古い情報です。
# vi /etc/yum.repos.d/10gen.repo
64bit
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1
32bit
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
enabled=1
# yum -y install mongo-10gen mongo-10gen-server
# vi /etc/mongod.conf
# mongo.conf
#where to log
logpath=/var/log/mongo/mongod.log
logappend=true
# fork and run in background
fork = true
#port = 27017
dbpath=/var/lib/mongo
# location of pidfile
pidfilepath = /var/run/mongodb/mongod.pid
# Disables write-ahead journaling
# nojournal = true
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
# Turn on/off security. Off is currently the default
#noauth = true
#auth = true
# Verbose logging output.
#verbose = true
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
# Enable db quota management
#quota = true
# Set oplogging level where n is
# 0=off (default)
# 1=W
# 2=R
# 3=both
# 7=W+some reads
#diaglog = 0
# Ignore query hints
#nohints = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
# Turns off server-side scripting. This will result in greatly limited
# functionality
#noscripting = true
# Turns off table scans. Any query that would do a table scan fails.
#notablescan = true
# Disable data file preallocation.
#noprealloc = true
# Specify .ns file size for new databases.
# nssize =
# Accout token for Mongo monitoring server.
#mms-token =
# Server name for Mongo monitoring server.
#mms-name =
# Ping interval for Mongo monitoring server.
#mms-interval =
# Replication Options
# in replicated mongo databases, specify here whether this is a slave or master
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com
# chkconfig mongod on
# /etc/rc.d/init.d/mongod start|stop|status
====== Tips ======
MongoDBの起動に失敗する
# /etc/rc.d/init.d/mongod start
Starting mongod: about to fork child process, waiting until server is ready for connections.
all output going to: /var/log/mongo/mongod.log
forked process: 1409
ERROR: child process failed, exited with error number 100
[FAILED]
ログを見ていると以下のようなエラーが
# less /var/log/mongo/mongod.log
~
[initandlisten] ERROR: Insufficient free space for journal files
[initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles
~
journal filesの作成領域の空き容量が足りないとのことなので、あきらめてjournal filesを作らない。
# vi /etc/mongod.conf
~
-) # nojournal = true
+) nojournal = true
~
起動成功
# /etc/rc.d/init.d/mongod start
Starting mongod: about to fork child process, waiting until server is ready for connections.
all output going to: /var/log/mongo/mongod.log
forked process: 1425
child process started successfully, parent exiting
[ OK ]