Skip to content

Instantly share code, notes, and snippets.

@ngsw
Created January 14, 2013 07:05
Show Gist options
  • Select an option

  • Save ngsw/4528308 to your computer and use it in GitHub Desktop.

Select an option

Save ngsw/4528308 to your computer and use it in GitHub Desktop.
10gen RPM
mongo-10gen-server-2.2.2-mongodb_1.x86_64 : 2013/01/14現在
#yum-repo 追加
#https://gist.github.com/raw/4528010/4453b9dff8605494185292786aab9ce1920d810b/mongo_10gen_settings.txt
cat >> /etc/yum.repos.d/10gen.repo <<'10GEN_REPO.EOF'
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enable=0
10GEN_REPO.EOF
#インストール/起動設定/起動
yum -y install --enablerepo=10gen mongo-10gen-server
chkconfig mongod on
/etc/init.d/mongod start
#デフォルトの状態
> use admin
switched to db admin
> db.runCommand({getCmdLineOpts: 1})
{
"argv" : [
"/usr/bin/mongod",
"-f",
"/etc/mongod.conf"
],
"parsed" : {
"config" : "/etc/mongod.conf",
"dbpath" : "/var/lib/mongo",
"fork" : "true",
"logappend" : "true",
"logpath" : "/var/log/mongo/mongod.log",
"pidfilepath" : "/var/run/mongodb/mongod.pid"
},
"ok" : 1
}
#rest 行を追加 /etc/mongod.conf
diff -uw /etc/mongod.conf{.org,}
--- /etc/mongod.conf.org 2012-11-28 01:21:46.000000000 +0900
+++ /etc/mongod.conf 2013-01-14 06:45:40.842885903 +0900
@@ -8,6 +8,9 @@
# fork and run in background
fork = true
+# rest : Set to true to enable a simple REST interface.
+rest = true
+
#port = 27017
dbpath=/var/lib/mongo
#反映
/etc/init.d/mongod restart
#確認
for command in buildInfo cursorInfo features hostInfo isMaster listDatabases replSetGetStatus serverStatus top
do
echo -e "\n\033[5;31m${command}\033[0;39m"
wget http://localhost:28017/${command}?text=1 -O - 2>/dev/null
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment