[MongoDB]: Working with shards

 

 

 

Sharding_Day8

 

 

 
ReplicaSet 1 (rs1) :
===================

./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_1 –logpath /data/rs1_1/rs1_1_mongod.log –port 27010 –smallfiles –nojournal –quiet &

./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_2 –logpath /data/rs1_2/rs1_2_mongod.log –port 27011 –smallfiles –nojournal –quiet &

./mongod –replSet rs1 –dbpath /data/rs1_arb –logpath /data/rs1_arb/rs1_arb_mongod.log –port 27012 –smallfiles –nojournal –quiet &

ReplicaSet 2 (rs2) :
===================

./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mongod.log –port 27020 –smallfiles –nojournal –quiet &

./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_2 –logpath /data/rs2_2/rs2_2_mongod.log –port 27021 –smallfiles –nojournal –quiet &

./mongod –replSet rs2 –dbpath /data/rs2_arb –logpath /data/rs2_arb/rs2_arb_mongod.log –port 27022 –smallfiles –nojournal –quiet &

Config server :
===============

./mongod –configsvr –dbpath /data/config –logpath /data/config/config_mongod.log –port 37010 –smallfiles –nojournal –quiet &
Router (mongos) :
===============

./mongos –configdb 10.0.0.197:37010 –logpath /data/router/router_mongos.log –port 10000 &
mognos

sh.addShard(“rs1/ip-10-0-0-197:27010,ip-10-0-0-197:27011”)
sh.addShard(“rs2/ip-10-0-0-197:27020,ip-10-0-0-197:27021”)

use shard_db
db.shard_col.ensureIndex( { user_id : 1 }, { unique : true })

sh.enableSharding(“shard_db”)
sh.shardCollection(“shard_db.shard_col”, {“user_id”:1})
sh.startBalancer()
sh.getBalancerState()
sh.isBalancerRunning()
use shard_db

for(var i = 200001; i <= 300000 ; i++){db.shard_col.insert({“user_id” : i , “name” : “bulk-inserts”, “Iteration: ” : i });}

db.shard_col.find( { user_id: { $lt: 11} } } )
db.shard_col.find( { user_id : { $gte : 8, $lt : 11 } })
At Router :-

Using username “ec2-user”.
Authenticating with public key “imported-openssh-key”
Last login: Mon May 11 01:44:50 2015 from 49.205.87.121

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2015.03-release-notes/
27 package(s) needed for security, out of 56 available
Run “sudo yum update” to apply all updates.
[ec2-user@ip-10-0-0-197 ~]$ sud su
-bash: sud: command not found
[ec2-user@ip-10-0-0-197 ~]$ suo dus
-bash: suo: command not found
[ec2-user@ip-10-0-0-197 ~]$ sudo su
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 1.3G 6.4G 17% /
devtmpfs 490M 56K 490M 1% /dev
tmpfs 499M 0 499M 0% /dev/shm
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]# ping ec2-52-0-198-18.compute-1.amazonaws.com
PING ec2-52-0-198-18.compute-1.amazonaws.com (10.0.0.28) 56(84) bytes of data.
^C
— ec2-52-0-198-18.compute-1.amazonaws.com ping statistics —
590 packets transmitted, 0 received, 100% packet loss, time 592801ms

[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]# cd
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 1.3G 6.4G 17% /
devtmpfs 490M 56K 490M 1% /dev
tmpfs 499M 0 499M 0% /dev/shm
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]# hostname -i
10.0.0.197
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]# hostname
ip-10-0-0-197
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 1.3G 6.4G 17% /
devtmpfs 490M 56K 490M 1% /dev
tmpfs 499M 0 499M 0% /dev/shm
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]#
[root@ip-10-0-0-197 ~]# cd /
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]# ll -lhtr
total 100K
drwxr-xr-x 2 root root 4.0K Jan 6 2012 srv
drwxr-xr-x 2 root root 4.0K Jan 6 2012 selinux
drwxr-xr-x 2 root root 4.0K Jan 6 2012 mnt
drwxr-xr-x 2 root root 4.0K Jan 6 2012 media
drwx—— 2 root root 16K Mar 18 15:29 lost+found
drwxr-xr-x 2 root root 4.0K Mar 18 15:29 local
drwxr-xr-x 13 root root 4.0K Mar 18 15:29 usr
dr-xr-xr-x 7 root root 4.0K Mar 18 15:29 lib
drwxr-xr-x 3 root root 4.0K Mar 18 15:30 opt
drwxr-xr-x 18 root root 4.0K Mar 18 15:30 var
dr-xr-xr-x 2 root root 4.0K Mar 18 15:30 sbin
dr-xr-xr-x 10 root root 12K Mar 18 15:30 lib64
dr-xr-xr-x 2 root root 4.0K Mar 18 15:30 bin
dr-xr-xr-x 4 root root 4.0K Mar 18 15:30 boot
drwxr-xr-x 3 root root 4.0K May 8 11:53 run
drwxr-xr-x 3 root root 4.0K May 8 11:53 home
dr-xr-x— 4 root root 4.0K May 11 01:05 root
drwxr-xr-x 71 root root 4.0K May 11 01:48 etc
drwxr-xr-x 3 root root 4.0K May 11 02:00 data
dr-xr-xr-x 75 root root 0 Jun 30 00:17 proc
dr-xr-xr-x 13 root root 0 Jun 30 00:17 sys
drwxr-xr-x 16 root root 2.8K Jun 30 00:17 dev
drwxrwxrwt 3 root root 4.0K Jul 3 00:22 tmp
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]# ps -ef | grep mongo
root 11820 11760 0 00:45 pts/0 00:00:00 grep mongo
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]# mkdir /data/
mkdir: cannot create directory ‘/data/’: File exists
[root@ip-10-0-0-197 /]#
[root@ip-10-0-0-197 /]# cd /data/
[root@ip-10-0-0-197 data]# ll -lhtr
total 65M
-rw-r–r– 1 root root 69 May 11 01:52 storage.bson
-rw——- 1 root root 16M May 11 01:52 local.ns
-rw——- 1 root root 16M May 11 01:52 local.0
drwxr-xr-x 2 root root 4.0K May 11 02:00 _tmp
-rw——- 1 root root 16M May 11 02:00 admin.ns
-rw——- 1 root root 16M May 11 02:00 admin.0
-rwxr-xr-x 1 root root 0 Jun 24 15:54 mongod.lock
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# rm -rf *
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# ll -lhtr
total 0
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 1.3G 6.5G 17% /
devtmpfs 490M 56K 490M 1% /dev
tmpfs 499M 0 499M 0% /dev/shm
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# pwd
/data
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mkdir rs1_1
[root@ip-10-0-0-197 data]# mkdir rs1_2
[root@ip-10-0-0-197 data]# mkdir rs1_arb
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mkdir rs2_1
[root@ip-10-0-0-197 data]# mkdir rs2_2
[root@ip-10-0-0-197 data]# mkdir rs2_arb
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mkdir config
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mkdir router
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# pwd
/data
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# ll -lhtr
total 32K
drwxr-xr-x 2 root root 4.0K Jul 3 00:46 rs1_1
drwxr-xr-x 2 root root 4.0K Jul 3 00:46 rs1_2
drwxr-xr-x 2 root root 4.0K Jul 3 00:47 rs1_arb
drwxr-xr-x 2 root root 4.0K Jul 3 00:47 rs2_1
drwxr-xr-x 2 root root 4.0K Jul 3 00:47 rs2_2
drwxr-xr-x 2 root root 4.0K Jul 3 00:47 rs2_arb
drwxr-xr-x 2 root root 4.0K Jul 3 00:47 config
drwxr-xr-x 2 root root 4.0K Jul 3 00:47 router
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# hostname -i
10.0.0.197
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# cd /home/ec2-user/mongodb-linux-x86_64-3.0.2/bin/
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Apr 8 20:39 bsondump
-rwxr-xr-x 1 1046 1046 5.6M Apr 8 20:39 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Apr 8 20:39 mongofiles
-rwxr-xr-x 1 1046 1046 5.7M Apr 8 20:39 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Apr 8 20:39 mongoimport
-rwxr-xr-x 1 1046 1046 6.0M Apr 8 20:39 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Apr 8 20:39 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Apr 8 20:39 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Apr 8 20:39 mongooplog
-rwxr-xr-x 1 1046 1046 22M Apr 8 20:46 mongoperf
-rwxr-xr-x 1 1046 1046 22M Apr 8 20:46 mongod
-rwxr-xr-x 1 1046 1046 11M Apr 8 20:46 mongos
-rwxr-xr-x 1 1046 1046 12M Apr 8 20:46 mongo
-rw-r–r– 1 root root 4.3K May 10 15:13 shard_creation_script.sh
-rw-r–r– 1 root root 4.3K May 10 15:36 new_shard_creation_script.sh
-rw-r–r– 1 root root 3.9K May 10 15:56 NSS.sh
-rw-r–r– 1 root root 3.9K May 10 16:06 shard-script.sh
-rw-r–r– 1 root root 4.0K May 11 00:59 new_script.sh
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_1 –logpath /data/rs1_1/rs1_1_mongod.log –port 27010 –smallfiles –nojournal –quiet &
[1] 11867
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ps -ef | grep mongo
root 11867 11760 0 01:00 pts/0 00:00:00 ./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_1 –logpath /data/rs1_1/rs1_1_mongod.log –port 27010 –smallfiles –nojournal –quiet
root 11893 11760 0 01:01 pts/0 00:00:00 grep mongo
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 27010
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27010/test
Server has startup warnings:
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
>
>
> show dbs
2015-07-03T01:01:18.720+0000 E QUERY Error: listDatabases failed:{ “note” : “from execCommand”, “ok” : 0, “errmsg” : “not master” }
at Error (<anonymous>)
at Mongo.getDBs (src/mongo/shell/mongo.js:47:15)
at shellHelper.show (src/mongo/shell/utils.js:630:33)
at shellHelper (src/mongo/shell/utils.js:524:36)
at (shellhelp2):1:1 at src/mongo/shell/mongo.js:47
>
>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_2 –logpath /data/rs1_2/rs1_2_mongod.log –port 27011 –smallfiles –nojournal –quiet &
[2] 11899
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –replSet rs1 –dbpath /data/rs1_arb –logpath /data/rs1_arb/rs1_arb_mongod.log –port 27012 –smallfiles –nojournal –quiet &
[3] 11911
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ps -ef | grep mongo
root 11867 11760 0 01:00 pts/0 00:00:00 ./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_1 –logpath /data/rs1_1/rs1_1_mongod.log –port 27010 –smallfiles –nojournal –quiet
root 11899 11760 0 01:01 pts/0 00:00:00 ./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_2 –logpath /data/rs1_2/rs1_2_mongod.log –port 27011 –smallfiles –nojournal –quiet
root 11911 11760 1 01:01 pts/0 00:00:00 ./mongod –replSet rs1 –dbpath /data/rs1_arb –logpath /data/rs1_arb/rs1_arb_mongod.log –port 27012 –smallfiles –nojournal –quiet
root 11924 11760 0 01:01 pts/0 00:00:00 grep mongo
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 27010
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27010/test
Server has startup warnings:
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
>
>
> rs.initiate()
{
“info2” : “no configuration explicitly specified — making one”,
“me” : “ip-10-0-0-197:27010”,
“ok” : 1
}
rs1:OTHER>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> rs.status()
{
“set” : “rs1”,
“date” : ISODate(“2015-07-03T01:02:56.257Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27010”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 122,
“optime” : Timestamp(1435885361, 1),
“optimeDate” : ISODate(“2015-07-03T01:02:41Z”),
“electionTime” : Timestamp(1435885361, 2),
“electionDate” : ISODate(“2015-07-03T01:02:41Z”),
“configVersion” : 1,
“self” : true
}
],
“ok” : 1
}
rs1:PRIMARY>
rs1:PRIMARY> rs.add(“ip-10-0-0-197:27011”)
{ “ok” : 1 }
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> rs.status()
{
“set” : “rs1”,
“date” : ISODate(“2015-07-03T01:03:43.106Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27010”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 169,
“optime” : Timestamp(1435885418, 1),
“optimeDate” : ISODate(“2015-07-03T01:03:38Z”),
“electionTime” : Timestamp(1435885361, 2),
“electionDate” : ISODate(“2015-07-03T01:02:41Z”),
“configVersion” : 2,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27011”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 4,
“optime” : Timestamp(1435885418, 1),
“optimeDate” : ISODate(“2015-07-03T01:03:38Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:03:42.934Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:03:42.936Z”),
“pingMs” : 0,
“configVersion” : 2
}
],
“ok” : 1
}
rs1:PRIMARY> rs.addArb(“ip-10-0-0-197:27012”)
{ “ok” : 1 }
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> rs.status()
{
“set” : “rs1”,
“date” : ISODate(“2015-07-03T01:04:15.202Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27010”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 201,
“optime” : Timestamp(1435885451, 1),
“optimeDate” : ISODate(“2015-07-03T01:04:11Z”),
“electionTime” : Timestamp(1435885361, 2),
“electionDate” : ISODate(“2015-07-03T01:02:41Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27011”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 36,
“optime” : Timestamp(1435885418, 1),
“optimeDate” : ISODate(“2015-07-03T01:03:38Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:04:13.382Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:04:14.945Z”),
“pingMs” : 0,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27012”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 3,
“lastHeartbeat” : ISODate(“2015-07-03T01:04:13.382Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:04:13.385Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1
}
rs1:PRIMARY>
rs1:PRIMARY>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mongod.log –port 27020 –smallfiles –nojournal –quiet &
[4] 12126
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ps -ef | grep mongo | grep 27020
root 12126 11760 0 01:04 pts/0 00:00:00 ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mongod.log –port 27020 –smallfiles –nojournal –quiet
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_2 –logpath /data/rs2_2/rs2_2_mongod.log –port 27021 –smallfiles –nojournal –quiet &
[5] 12153
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –replSet rs2 –dbpath /data/rs2_arb –logpath /data/rs2_arb/rs2_arb_mongod.log –port 27022 –smallfiles –nojournal –quiet &
[6] 12165
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ps -ef | grep mongo | grep 2702
root 12126 11760 0 01:04 pts/0 00:00:00 ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mongod.log –port 27020 –smallfiles –nojournal –quiet
root 12153 11760 0 01:05 pts/0 00:00:00 ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_2 –logpath /data/rs2_2/rs2_2_mongod.log –port 27021 –smallfiles –nojournal –quiet
root 12165 11760 0 01:05 pts/0 00:00:00 ./mongod –replSet rs2 –dbpath /data/rs2_arb –logpath /data/rs2_arb/rs2_arb_mongod.log –port 27022 –smallfiles –nojournal –quiet
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ps -ef | grep mongo
root 11867 11760 0 01:00 pts/0 00:00:00 ./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_1 –logpath /data/rs1_1/rs1_1_mongod.log –port 27010 –smallfiles –nojournal –quiet
root 11899 11760 0 01:01 pts/0 00:00:00 ./mongod –shardsvr –replSet rs1 –dbpath /data/rs1_2 –logpath /data/rs1_2/rs1_2_mongod.log –port 27011 –smallfiles –nojournal –quiet
root 11911 11760 0 01:01 pts/0 00:00:00 ./mongod –replSet rs1 –dbpath /data/rs1_arb –logpath /data/rs1_arb/rs1_arb_mongod.log –port 27012 –smallfiles –nojournal –quiet
root 12126 11760 0 01:04 pts/0 00:00:00 ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mongod.log –port 27020 –smallfiles –nojournal –quiet
root 12153 11760 0 01:05 pts/0 00:00:00 ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_2 –logpath /data/rs2_2/rs2_2_mongod.log –port 27021 –smallfiles –nojournal –quiet
root 12165 11760 0 01:05 pts/0 00:00:00 ./mongod –replSet rs2 –dbpath /data/rs2_arb –logpath /data/rs2_arb/rs2_arb_mongod.log –port 27022 –smallfiles –nojournal –quiet
root 12193 11760 0 01:05 pts/0 00:00:00 grep mongo
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ps -ef | grep mongo | grep 2702
root 12126 11760 0 01:04 pts/0 00:00:00 ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mongod.log –port 27020 –smallfiles –nojournal –quiet
root 12153 11760 0 01:05 pts/0 00:00:00 ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_2 –logpath /data/rs2_2/rs2_2_mongod.log –port 27021 –smallfiles –nojournal –quiet
root 12165 11760 0 01:05 pts/0 00:00:00 ./mongod –replSet rs2 –dbpath /data/rs2_arb –logpath /data/rs2_arb/rs2_arb_mongod.log –port 27022 –smallfiles –nojournal –quiet
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 27020
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27020/test
Server has startup warnings:
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
>
>
> rs.initiate()
{
“info2” : “no configuration explicitly specified — making one”,
“me” : “ip-10-0-0-197:27020”,
“ok” : 1
}
rs2:OTHER>
rs2:SECONDARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T01:06:23.327Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 91,
“optime” : Timestamp(1435885575, 1),
“optimeDate” : ISODate(“2015-07-03T01:06:15Z”),
“electionTime” : Timestamp(1435885575, 2),
“electionDate” : ISODate(“2015-07-03T01:06:15Z”),
“configVersion” : 1,
“self” : true
}
],
“ok” : 1
}
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> rs.add(“ip-10-0-0-197:27021”)
{ “ok” : 1 }
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T01:06:49.400Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 117,
“optime” : Timestamp(1435885606, 1),
“optimeDate” : ISODate(“2015-07-03T01:06:46Z”),
“electionTime” : Timestamp(1435885575, 2),
“electionDate” : ISODate(“2015-07-03T01:06:15Z”),
“configVersion” : 2,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27021”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 2,
“optime” : Timestamp(1435885606, 1),
“optimeDate” : ISODate(“2015-07-03T01:06:46Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:06:48.838Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:06:48.840Z”),
“pingMs” : 0,
“configVersion” : 2
}
],
“ok” : 1
}
rs2:PRIMARY>
rs2:PRIMARY> rs.addArb(“ip-10-0-0-197:27022”)
{ “ok” : 1 }
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T01:07:11.435Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 139,
“optime” : Timestamp(1435885628, 1),
“optimeDate” : ISODate(“2015-07-03T01:07:08Z”),
“electionTime” : Timestamp(1435885575, 2),
“electionDate” : ISODate(“2015-07-03T01:06:15Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27021”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 24,
“optime” : Timestamp(1435885628, 1),
“optimeDate” : ISODate(“2015-07-03T01:07:08Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:07:10.086Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:07:10.844Z”),
“pingMs” : 0,
“syncingTo” : “ip-10-0-0-197:27020”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27022”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 3,
“lastHeartbeat” : ISODate(“2015-07-03T01:07:10.087Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:07:10.089Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1
}
rs2:PRIMARY>
rs2:PRIMARY>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –configsvr –dbpath /data/config –logpath /data/config/config_mongod.log –port 37010 –smallfiles –nojournal –quiet &
[7] 12434
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ps -ef | grep mongo | grep configsvr
root 12434 11760 0 01:07 pts/0 00:00:00 ./mongod –configsvr –dbpath /data/config –logpath /data/config/config_mongod.log –port 37010 –smallfiles –nojournal –quiet
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 37010
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:37010/test
Server has startup warnings:
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten]
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten]
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten]
configsvr>
configsvr>
configsvr> show dbs
local 0.031GB
configsvr>
configsvr>
configsvr>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongos –configdb 10.0.0.197:37010 –dbpath /data/router –logpath /data/router/router_mongos.log –port 10000 –smallfiles –nojournal –quiet &
[8] 12489
[root@ip-10-0-0-197 bin]# Error parsing command line: unknown option dbpath
try ‘./mongos –help’ for more information

[8]+ Exit 2 ./mongos –configdb 10.0.0.197:37010 –dbpath /data/router –logpath /data/router/router_mongos.log –port 10000 –smallfiles –nojournal –quiet
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongos –configdb 10.0.0.197:37010 –logpath /data/router/router_mongos.log –port 10000 –smallfiles –nojournal –quiet &
[8] 12514
[root@ip-10-0-0-197 bin]# Error parsing command line: unknown option smallfiles
try ‘./mongos –help’ for more information

[8]+ Exit 2 ./mongos –configdb 10.0.0.197:37010 –logpath /data/router/router_mongos.log –port 10000 –smallfiles –nojournal –quiet
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongos –configdb 10.0.0.197:37010 –logpath /data/router/router_mongos.log –port 10000 &
[8] 12539
[root@ip-10-0-0-197 bin]# 2015-07-03T01:09:32.952+0000 W SHARDING running with 1 config server should be done only for testing purposes and is not recommended for production

[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 27010
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27010/test
Server has startup warnings:
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> rs.status()
{
“set” : “rs1”,
“date” : ISODate(“2015-07-03T01:12:55.249Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27010”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 721,
“optime” : Timestamp(1435885451, 1),
“optimeDate” : ISODate(“2015-07-03T01:04:11Z”),
“electionTime” : Timestamp(1435885361, 2),
“electionDate” : ISODate(“2015-07-03T01:02:41Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27011”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 556,
“optime” : Timestamp(1435885451, 1),
“optimeDate” : ISODate(“2015-07-03T01:04:11Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:12:53.511Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:12:55.079Z”),
“pingMs” : 0,
“syncingTo” : “ip-10-0-0-197:27010”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27012”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 523,
“lastHeartbeat” : ISODate(“2015-07-03T01:12:53.500Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:12:53.515Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1
}
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 27010
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27010/test
Server has startup warnings:
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
rs1:PRIMARY>
bye
[root@ip-10-0-0-197 bin]# ./mongo –port 27020
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27020/test
Server has startup warnings:
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T01:15:26.350Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 634,
“optime” : Timestamp(1435885628, 1),
“optimeDate” : ISODate(“2015-07-03T01:07:08Z”),
“electionTime” : Timestamp(1435885575, 2),
“electionDate” : ISODate(“2015-07-03T01:06:15Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27021”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 519,
“optime” : Timestamp(1435885628, 1),
“optimeDate” : ISODate(“2015-07-03T01:07:08Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:15:26.203Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:15:24.996Z”),
“pingMs” : 0,
“syncingTo” : “ip-10-0-0-197:27020”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27022”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 498,
“lastHeartbeat” : ISODate(“2015-07-03T01:15:26.190Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:15:26.190Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1
}
rs2:PRIMARY>
rs2:PRIMARY>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 10000
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:10000/test
Server has startup warnings:
2015-07-03T01:09:32.954+0000 I CONTROL ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:09:32.954+0000 I CONTROL
mongos>
mongos>
mongos> show dbs
admin (empty)
config 0.016GB
mongos>
mongos>
mongos> sh.addShard(“rs1/ip-10-0-0-197:27010,ip-10-0-0-197:27011”)
{ “shardAdded” : “rs1”, “ok” : 1 }
mongos>
mongos> sh.status()
— Sharding Status —
sharding version: {
“_id” : 1,
“minCompatibleVersion” : 5,
“currentVersion” : 6,
“clusterId” : ObjectId(“5595e0cdcfd5334b8df55ce6”)
}
shards:
{ “_id” : “rs1”, “host” : “rs1/ip-10-0-0-197:27010,ip-10-0-0-197:27011” }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ “_id” : “admin”, “partitioned” : false, “primary” : “config” }

mongos>
mongos> sh.addShard(“rs3/ip-10-0-0-197:27020,ip-10-0-0-197:27021”)
{
“ok” : 0,
“errmsg” : “couldn’t connect to new shard socket exception [CONNECT_ERROR] for rs3/ip-10-0-0-197:27020,ip-10-0-0-197:27021”
}
mongos> sh.addShard(“rs2/ip-10-0-0-197:27020,ip-10-0-0-197:27021”)
{ “shardAdded” : “rs2”, “ok” : 1 }
mongos>
mongos>
mongos> sh.status()
— Sharding Status —
sharding version: {
“_id” : 1,
“minCompatibleVersion” : 5,
“currentVersion” : 6,
“clusterId” : ObjectId(“5595e0cdcfd5334b8df55ce6”)
}
shards:
{ “_id” : “rs1”, “host” : “rs1/ip-10-0-0-197:27010,ip-10-0-0-197:27011” }
{ “_id” : “rs2”, “host” : “rs2/ip-10-0-0-197:27020,ip-10-0-0-197:27021” }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ “_id” : “admin”, “partitioned” : false, “primary” : “config” }

mongos>
mongos>
mongos> use shard_db
switched to db shard_db
mongos>
mongos>
mongos>
mongos>
mongos>
mongos> db.shard_col.ensureIndex( { user_id : 1 }, { unique : true })
{
“raw” : {
“rs1/ip-10-0-0-197:27010,ip-10-0-0-197:27011” : {
“createdCollectionAutomatically” : true,
“numIndexesBefore” : 1,
“numIndexesAfter” : 2,
“ok” : 1,
“$gleStats” : {
“lastOpTime” : Timestamp(1435886496, 2),
“electionId” : ObjectId(“5595df31e9153b62cb95a6f9”)
}
}
},
“ok” : 1
}
mongos>
mongos>
mongos> show dbs
admin (empty)
config 0.016GB
shard_db 0.031GB
mongos>
mongos> sh.enableSharding(“shard_db”)
{ “ok” : 1 }
mongos>
mongos> sh.shardCollection(“shard_db.shard_col”, {“user_id”:1})
{ “collectionsharded” : “shard_db.shard_col”, “ok” : 1 }
mongos>
mongos>
mongos>
mongos>
mongos> show collections
shard_col
system.indexes
mongos>
mongos>
mongos> sh.startBalancer()
mongos> sh.getBalancerState()
true
mongos> sh.isBalancerRunning()
false
mongos>
mongos>
mongos> use shard_db
switched to db shard_db
mongos>
mongos>
mongos>
mongos>
mongos> sh.isBalancerRunning()
false
mongos>
mongos>
mongos> for(var i = 1; i <= 100000 ; i++){db.shard_col.insert({“user_id” : i , “name” : “bulk-inserts”, “Iteration: ” : i });}
WriteResult({ “nInserted” : 1 })
mongos>
mongos>
mongos> sh.isBalancerRunning()
false
mongos>
mongos>
mongos> for(var i = 100001; i <= 200000 ; i++){db.shard_col.insert({“user_id” : i , “name” : “bulk-inserts”, “Iteration: ” : i });}
WriteResult({ “nInserted” : 1 })
mongos>
mongos>
mongos>
mongos>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongo –port 37010
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:37010/test
Server has startup warnings:
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten]
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten]
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:07:40.845+0000 I CONTROL [initandlisten]
configsvr>
configsvr>
configsvr>
configsvr>
configsvr> show dbs
config 0.031GB
local 0.031GB
configsvr>
configsvr>
configsvr> use config
switched to db config
configsvr>
configsvr>
configsvr> show collections
actionlog
changelog
chunks
collections
databases
lockpings
locks
mongos
settings
shards
system.indexes
tags
version
configsvr>
configsvr>
configsvr>
configsvr> db.chunks.find()
{ “_id” : “shard_db.shard_col-user_id_MinKey”, “lastmod” : Timestamp(2, 1), “lastmodEpoch” : ObjectId(“5595e48ecfd5334b8df55dae”), “ns” : “shard_db.shard_col”, “min” : { “user_id” : { “$minKey” : 1 } }, “max” : { “user_id” : 2 }, “shard” : “rs1” }
{ “_id” : “shard_db.shard_col-user_id_2.0”, “lastmod” : Timestamp(1, 2), “lastmodEpoch” : ObjectId(“5595e48ecfd5334b8df55dae”), “ns” : “shard_db.shard_col”, “min” : { “user_id” : 2 }, “max” : { “user_id” : 10 }, “shard” : “rs1” }
{ “_id” : “shard_db.shard_col-user_id_10.0”, “lastmod” : Timestamp(3, 1), “lastmodEpoch” : ObjectId(“5595e48ecfd5334b8df55dae”), “ns” : “shard_db.shard_col”, “min” : { “user_id” : 10 }, “max” : { “user_id” : 74908 }, “shard” : “rs2” }
{ “_id” : “shard_db.shard_col-user_id_74908.0”, “lastmod” : Timestamp(2, 3), “lastmodEpoch” : ObjectId(“5595e48ecfd5334b8df55dae”), “ns” : “shard_db.shard_col”, “min” : { “user_id” : 74908 }, “max” : { “user_id” : 171198 }, “shard” : “rs2” }
{ “_id” : “shard_db.shard_col-user_id_171198.0”, “lastmod” : Timestamp(3, 0), “lastmodEpoch” : ObjectId(“5595e48ecfd5334b8df55dae”), “ns” : “shard_db.shard_col”, “min” : { “user_id” : 171198 }, “max” : { “user_id” : { “$maxKey” : 1 } }, “shard” : “rs1” }
configsvr>
configsvr>
configsvr>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# mongos –port 10000
BadValue error: no args for –configdb
try ‘mongos –help’ for more information
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# mongo –port 10000
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:10000/test
Server has startup warnings:
2015-07-03T01:09:32.954+0000 I CONTROL ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:09:32.954+0000 I CONTROL
mongos>
mongos>
mongos>
mongos>
mongos>
mongos> show dbs
admin (empty)
config 0.016GB
shard_db 0.094GB
mongos>
mongos>
mongos> use shard_db
switched to db shard_db
mongos>
mongos>
mongos>
mongos> show collections
shard_col
system.indexes
mongos>
mongos>
mongos> shard_col
2015-07-03T01:37:14.108+0000 E QUERY ReferenceError: shard_col is not defined
at (shell):1:1
mongos>
mongos>
mongos> use shard_col
switched to db shard_col
mongos>
mongos>
mongos>
mongos>
mongos> db.shard_col.find()
mongos>
mongos>
mongos> use shard_col
switched to db shard_col
mongos>
mongos>
mongos> db.shard_col.find()
mongos>
mongos>
mongos> show dbs
admin (empty)
config 0.016GB
shard_db 0.094GB
mongos>
mongos>
mongos> use shard_db
switched to db shard_db
mongos>
mongos>
mongos> db.shard_col.find()
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c90”), “user_id” : 1, “name” : “bulk-inserts”, “Iteration: ” : 1 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9a”), “user_id” : 11, “name” : “bulk-inserts”, “Iteration: ” : 11 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c91”), “user_id” : 2, “name” : “bulk-inserts”, “Iteration: ” : 2 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9b”), “user_id” : 12, “name” : “bulk-inserts”, “Iteration: ” : 12 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c92”), “user_id” : 3, “name” : “bulk-inserts”, “Iteration: ” : 3 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9c”), “user_id” : 13, “name” : “bulk-inserts”, “Iteration: ” : 13 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c93”), “user_id” : 4, “name” : “bulk-inserts”, “Iteration: ” : 4 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9d”), “user_id” : 14, “name” : “bulk-inserts”, “Iteration: ” : 14 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c94”), “user_id” : 5, “name” : “bulk-inserts”, “Iteration: ” : 5 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9e”), “user_id” : 15, “name” : “bulk-inserts”, “Iteration: ” : 15 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c95”), “user_id” : 6, “name” : “bulk-inserts”, “Iteration: ” : 6 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9f”), “user_id” : 16, “name” : “bulk-inserts”, “Iteration: ” : 16 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c96”), “user_id” : 7, “name” : “bulk-inserts”, “Iteration: ” : 7 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca0”), “user_id” : 17, “name” : “bulk-inserts”, “Iteration: ” : 17 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c97”), “user_id” : 8, “name” : “bulk-inserts”, “Iteration: ” : 8 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca1”), “user_id” : 18, “name” : “bulk-inserts”, “Iteration: ” : 18 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c98”), “user_id” : 9, “name” : “bulk-inserts”, “Iteration: ” : 9 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca2”), “user_id” : 19, “name” : “bulk-inserts”, “Iteration: ” : 19 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f94d”), “user_id” : 171198, “name” : “bulk-inserts”, “Iteration: ” : 171198 }
Type “it” for more
mongos>
mongos>
mongos>
mongos>
mongos> db.shard_col.find({“user_id” : 10})
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
mongos>
mongos>
mongos> db.shard_col.find({“user_id” : 10}).explain()
{
“queryPlanner” : {
“mongosPlannerVersion” : 1,
“winningPlan” : {
“stage” : “SINGLE_SHARD”,
“shards” : [
{
“shardName” : “rs2”,
“connectionString” : “rs2/ip-10-0-0-197:27020,ip-10-0-0-197:27021”,
“serverInfo” : {
“host” : “ip-10-0-0-197”,
“port” : 27020,
“version” : “3.0.2”,
“gitVersion” : “6201872043ecbbc0a4cc169b5482dcf385fc464f”
},
“plannerVersion” : 1,
“namespace” : “shard_db.shard_col”,
“indexFilterSet” : false,
“parsedQuery” : {
“user_id” : {
“$eq” : 10
}
},
“winningPlan” : {
“stage” : “FETCH”,
“inputStage” : {
“stage” : “SHARDING_FILTER”,
“inputStage” : {
“stage” : “IXSCAN”,
“keyPattern” : {
“user_id” : 1
},
“indexName” : “user_id_1”,
“isMultiKey” : false,
“direction” : “forward”,
“indexBounds” : {
“user_id” : [
“[10.0, 10.0]”
]
}
}
}
},
“rejectedPlans” : [ ]
}
]
}
},
“ok” : 1
}
mongos>
mongos>
mongos>
mongos>
mongos>
mongos> db.shard_col.find({“user_id” : 9}).explain()
{
“queryPlanner” : {
“mongosPlannerVersion” : 1,
“winningPlan” : {
“stage” : “SINGLE_SHARD”,
“shards” : [
{
“shardName” : “rs1”,
“connectionString” : “rs1/ip-10-0-0-197:27010,ip-10-0-0-197:27011”,
“serverInfo” : {
“host” : “ip-10-0-0-197”,
“port” : 27010,
“version” : “3.0.2”,
“gitVersion” : “6201872043ecbbc0a4cc169b5482dcf385fc464f”
},
“plannerVersion” : 1,
“namespace” : “shard_db.shard_col”,
“indexFilterSet” : false,
“parsedQuery” : {
“user_id” : {
“$eq” : 9
}
},
“winningPlan” : {
“stage” : “FETCH”,
“inputStage” : {
“stage” : “SHARDING_FILTER”,
“inputStage” : {
“stage” : “IXSCAN”,
“keyPattern” : {
“user_id” : 1
},
“indexName” : “user_id_1”,
“isMultiKey” : false,
“direction” : “forward”,
“indexBounds” : {
“user_id” : [
“[9.0, 9.0]”
]
}
}
}
},
“rejectedPlans” : [ ]
}
]
}
},
“ok” : 1
}
mongos>
mongos>
mongos>
mongos> db.shard_col.find( { user_id: { $gt: 8 }, user_id: { $lt: 11 } } )
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c90”), “user_id” : 1, “name” : “bulk-inserts”, “Iteration: ” : 1 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c91”), “user_id” : 2, “name” : “bulk-inserts”, “Iteration: ” : 2 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c92”), “user_id” : 3, “name” : “bulk-inserts”, “Iteration: ” : 3 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c93”), “user_id” : 4, “name” : “bulk-inserts”, “Iteration: ” : 4 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c94”), “user_id” : 5, “name” : “bulk-inserts”, “Iteration: ” : 5 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c95”), “user_id” : 6, “name” : “bulk-inserts”, “Iteration: ” : 6 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c96”), “user_id” : 7, “name” : “bulk-inserts”, “Iteration: ” : 7 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c97”), “user_id” : 8, “name” : “bulk-inserts”, “Iteration: ” : 8 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c98”), “user_id” : 9, “name” : “bulk-inserts”, “Iteration: ” : 9 }
mongos>
mongos>
mongos> db.shard_col.find( { user_id: { $lt: 11}, user_id: { $gt: 8 } } )
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c98”), “user_id” : 9, “name” : “bulk-inserts”, “Iteration: ” : 9 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9a”), “user_id” : 11, “name” : “bulk-inserts”, “Iteration: ” : 11 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f94d”), “user_id” : 171198, “name” : “bulk-inserts”, “Iteration: ” : 171198 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9b”), “user_id” : 12, “name” : “bulk-inserts”, “Iteration: ” : 12 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f94e”), “user_id” : 171199, “name” : “bulk-inserts”, “Iteration: ” : 171199 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9c”), “user_id” : 13, “name” : “bulk-inserts”, “Iteration: ” : 13 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f94f”), “user_id” : 171200, “name” : “bulk-inserts”, “Iteration: ” : 171200 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9d”), “user_id” : 14, “name” : “bulk-inserts”, “Iteration: ” : 14 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f950”), “user_id” : 171201, “name” : “bulk-inserts”, “Iteration: ” : 171201 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9e”), “user_id” : 15, “name” : “bulk-inserts”, “Iteration: ” : 15 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f951”), “user_id” : 171202, “name” : “bulk-inserts”, “Iteration: ” : 171202 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9f”), “user_id” : 16, “name” : “bulk-inserts”, “Iteration: ” : 16 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f952”), “user_id” : 171203, “name” : “bulk-inserts”, “Iteration: ” : 171203 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca0”), “user_id” : 17, “name” : “bulk-inserts”, “Iteration: ” : 17 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f953”), “user_id” : 171204, “name” : “bulk-inserts”, “Iteration: ” : 171204 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca1”), “user_id” : 18, “name” : “bulk-inserts”, “Iteration: ” : 18 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f954”), “user_id” : 171205, “name” : “bulk-inserts”, “Iteration: ” : 171205 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca2”), “user_id” : 19, “name” : “bulk-inserts”, “Iteration: ” : 19 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f955”), “user_id” : 171206, “name” : “bulk-inserts”, “Iteration: ” : 171206 }
Type “it” for more
mongos>
mongos> db.shard_col.find( { user_id: { $lt: 11} } } )
2015-07-03T01:43:45.012+0000 E QUERY SyntaxError: Unexpected token }
mongos>
mongos>
mongos> db.shard_col.find( { user_id: { $lt: 11 } } )
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c90”), “user_id” : 1, “name” : “bulk-inserts”, “Iteration: ” : 1 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c91”), “user_id” : 2, “name” : “bulk-inserts”, “Iteration: ” : 2 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c92”), “user_id” : 3, “name” : “bulk-inserts”, “Iteration: ” : 3 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c93”), “user_id” : 4, “name” : “bulk-inserts”, “Iteration: ” : 4 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c94”), “user_id” : 5, “name” : “bulk-inserts”, “Iteration: ” : 5 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c95”), “user_id” : 6, “name” : “bulk-inserts”, “Iteration: ” : 6 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c96”), “user_id” : 7, “name” : “bulk-inserts”, “Iteration: ” : 7 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c97”), “user_id” : 8, “name” : “bulk-inserts”, “Iteration: ” : 8 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c98”), “user_id” : 9, “name” : “bulk-inserts”, “Iteration: ” : 9 }
mongos>
mongos>
mongos>
mongos>
mongos> db.shard_col.find( { user_id: { $lt: 11 } } ).explain()
{
“queryPlanner” : {
“mongosPlannerVersion” : 1,
“winningPlan” : {
“stage” : “SHARD_MERGE”,
“shards” : [
{
“shardName” : “rs1”,
“connectionString” : “rs1/ip-10-0-0-197:27010,ip-10-0-0-197:27011”,
“serverInfo” : {
“host” : “ip-10-0-0-197”,
“port” : 27010,
“version” : “3.0.2”,
“gitVersion” : “6201872043ecbbc0a4cc169b5482dcf385fc464f”
},
“plannerVersion” : 1,
“namespace” : “shard_db.shard_col”,
“indexFilterSet” : false,
“parsedQuery” : {
“user_id” : {
“$lt” : 11
}
},
“winningPlan” : {
“stage” : “FETCH”,
“inputStage” : {
“stage” : “SHARDING_FILTER”,
“inputStage” : {
“stage” : “IXSCAN”,
“keyPattern” : {
“user_id” : 1
},
“indexName” : “user_id_1”,
“isMultiKey” : false,
“direction” : “forward”,
“indexBounds” : {
“user_id” : [
“[-inf.0, 11.0)”
]
}
}
}
},
“rejectedPlans” : [ ]
},
{
“shardName” : “rs2”,
“connectionString” : “rs2/ip-10-0-0-197:27020,ip-10-0-0-197:27021”,
“serverInfo” : {
“host” : “ip-10-0-0-197”,
“port” : 27020,
“version” : “3.0.2”,
“gitVersion” : “6201872043ecbbc0a4cc169b5482dcf385fc464f”
},
“plannerVersion” : 1,
“namespace” : “shard_db.shard_col”,
“indexFilterSet” : false,
“parsedQuery” : {
“user_id” : {
“$lt” : 11
}
},
“winningPlan” : {
“stage” : “FETCH”,
“inputStage” : {
“stage” : “SHARDING_FILTER”,
“inputStage” : {
“stage” : “IXSCAN”,
“keyPattern” : {
“user_id” : 1
},
“indexName” : “user_id_1”,
“isMultiKey” : false,
“direction” : “forward”,
“indexBounds” : {
“user_id” : [
“[-inf.0, 11.0)”
]
}
}
}
},
“rejectedPlans” : [ ]
}
]
}
},
“ok” : 1
}
mongos>
mongos>
mongos>
mongos>
mongos> db.shard_col.find( { user_id : { $gte : 8, $lt : 11 } })
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c97”), “user_id” : 8, “name” : “bulk-inserts”, “Iteration: ” : 8 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c98”), “user_id” : 9, “name” : “bulk-inserts”, “Iteration: ” : 9 }
mongos>
mongos>
mongos> show databases
admin (empty)
config 0.016GB
shard_db 0.094GB
mongos>
mongos>
mongos> use config
switched to db config
mongos>
mongos>
mongos> show colelctions
2015-07-03T01:47:54.904+0000 E QUERY Error: don’t know how to show [colelctions]
at Error (<anonymous>)
at shellHelper.show (src/mongo/shell/utils.js:733:11)
at shellHelper (src/mongo/shell/utils.js:524:36)
at (shellhelp2):1:1 at src/mongo/shell/utils.js:733
mongos>
mongos>
mongos> show collections
actionlog
changelog
chunks
collections
databases
lockpings
locks
mongos
settings
shards
system.indexes
tags
version
mongos>
mongos>
mongos> db.settings.find()
{ “_id” : “chunksize”, “value” : 64 }
{ “_id” : “balancer”, “stopped” : false }
mongos>
mongos>
mongos> db
config
mongos>
mongos>
mongos> show dbs
admin (empty)
config 0.016GB
shard_db 0.094GB
mongos>
mongos>
mongos>
mongos> use shard_db
switched to db shard_db
mongos>
mongos>
mongos>
mongos> for(var i = 200001; i <= 300000 ; i++){db.shard_col.insert({“user_id” : i , “name” : “bulk-inserts”, “Iteration: ” : i });}
WriteResult({ “nInserted” : 1 })
mongos>
mongos>
mongos> for(var i = 300001; i <= 350000 ; i++){db.shard_col.insert({“user_id” : i , “name” : “bulk-inserts”, “Iteration: ” : i });}
WriteResult({ “nInserted” : 1 })
mongos>
mongos>
mongos>
At Shard-2 :-

Using username “ec2-user”.
Authenticating with public key “imported-openssh-key”
Last login: Fri Jul 3 01:19:55 2015 from 123.236.162.240

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2015.03-release-notes/
27 package(s) needed for security, out of 56 available
Run “sudo yum update” to apply all updates.
[ec2-user@ip-10-0-0-197 ~]$
[ec2-user@ip-10-0-0-197 ~]$
[ec2-user@ip-10-0-0-197 ~]$
[ec2-user@ip-10-0-0-197 ~]$ sud su
-bash: sud: command not found
[ec2-user@ip-10-0-0-197 ~]$ sudo su
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]# cd /home/ec2-user/mongodb-linux-x86_64-3.0.2/bin/
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# mongo –port 27020
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27020/test
Server has startup warnings:
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: You are runn ing this process as the root user, which is not recommended.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/ mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** We suggest set ting it to ‘never’
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
rs2:PRIMARY> show dbs
local 1.031GB
rs2:PRIMARY> show dbs
local 1.031GB
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
shard_db 0.031GB
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> use shard_db
switched to db shard_db
rs2:PRIMARY> db.shard_col.count()
72416
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
88564
rs2:PRIMARY> db.shard_col.count()
92323
rs2:PRIMARY> db.shard_col.count()
95621
rs2:PRIMARY> db.shard_col.count()
97444
rs2:PRIMARY> db.shard_col.count()
99046
rs2:PRIMARY> db.shard_col.count()
99991
rs2:PRIMARY> db.shard_col.count()
99991
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
115029
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
117325
rs2:PRIMARY> db.shard_col.count()
118965
rs2:PRIMARY> db.shard_col.count()
120495
rs2:PRIMARY> db.shard_col.count()
121778
rs2:PRIMARY> db.shard_col.count()
133541
rs2:PRIMARY> db.shard_col.count()
135073
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# cd /data/
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# ll -lhtr
total 32K
drwxr-xr-x 3 root root 4.0K Jul 3 01:01 rs1_arb
drwxr-xr-x 3 root root 4.0K Jul 3 01:05 rs2_arb
drwxr-xr-x 2 root root 4.0K Jul 3 01:09 router
drwxr-xr-x 3 root root 4.0K Jul 3 01:09 config
drwxr-xr-x 3 root root 4.0K Jul 3 01:21 rs1_2
drwxr-xr-x 4 root root 4.0K Jul 3 01:29 rs1_1
drwxr-xr-x 3 root root 4.0K Jul 3 01:30 rs2_1
drwxr-xr-x 3 root root 4.0K Jul 3 01:30 rs2_2
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# du -sh *
65M config
72K router
1.1G rs1_1
1.1G rs1_2
33M rs1_arb
1.1G rs2_1
1.1G rs2_2
33M rs2_arb
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mongo –port 27020
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27020/test
Server has startup warnings:
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root use r, which is not recommended.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag i s ‘always’.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> use shard_db
switched to db shard_db
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.find()
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id ” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9a”), “user_id ” : 11, “name” : “bulk-inserts”, “Iteration: ” : 11 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9b”), “user_id ” : 12, “name” : “bulk-inserts”, “Iteration: ” : 12 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9c”), “user_id ” : 13, “name” : “bulk-inserts”, “Iteration: ” : 13 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9d”), “user_id ” : 14, “name” : “bulk-inserts”, “Iteration: ” : 14 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9e”), “user_id ” : 15, “name” : “bulk-inserts”, “Iteration: ” : 15 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9f”), “user_id ” : 16, “name” : “bulk-inserts”, “Iteration: ” : 16 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca0”), “user_id ” : 17, “name” : “bulk-inserts”, “Iteration: ” : 17 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca1”), “user_id ” : 18, “name” : “bulk-inserts”, “Iteration: ” : 18 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca2”), “user_id ” : 19, “name” : “bulk-inserts”, “Iteration: ” : 19 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca3”), “user_id ” : 20, “name” : “bulk-inserts”, “Iteration: ” : 20 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca4”), “user_id ” : 21, “name” : “bulk-inserts”, “Iteration: ” : 21 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca5”), “user_id ” : 22, “name” : “bulk-inserts”, “Iteration: ” : 22 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca6”), “user_id ” : 23, “name” : “bulk-inserts”, “Iteration: ” : 23 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca7”), “user_id ” : 24, “name” : “bulk-inserts”, “Iteration: ” : 24 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca8”), “user_id ” : 25, “name” : “bulk-inserts”, “Iteration: ” : 25 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca9”), “user_id ” : 26, “name” : “bulk-inserts”, “Iteration: ” : 26 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5caa”), “user_id ” : 27, “name” : “bulk-inserts”, “Iteration: ” : 27 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5cab”), “user_id ” : 28, “name” : “bulk-inserts”, “Iteration: ” : 28 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5cac”), “user_id ” : 29, “name” : “bulk-inserts”, “Iteration: ” : 29 }
Type “it” for more
rs2:PRIMARY> \
2015-07-03T01:49:15.982+0000 E QUERY SyntaxError: Une xpected token ILLEGAL
error2:SyntaxError: Unexpected token ILLEGAL
rs2:PRIMARY>
bye
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mongo –port 10000
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:10000/test
Server has startup warnings:
2015-07-03T01:09:32.954+0000 I CONTROL ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:09:32.954+0000 I CONTROL
mongos>
mongos>
mongos>
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos>
mongos> sh.isBalancerRunning()
false
mongos>
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos>
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.getBalancer
mongos> sh.getBalancerState()
true
mongos> sh.getBalancerState()
true
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos>
bye
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 5.8G 2.0G 75% /
devtmpfs 490M 56K 490M 1% /dev
tmpfs 499M 0 499M 0% /dev/shm
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mongo –port 10000
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:10000/test
Server has startup warnings:
2015-07-03T01:09:32.954+0000 I CONTROL ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:09:32.954+0000 I CONTROL
mongos>
mongos>
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos> sh.isBalancerRunning()
false
mongos>
mongos>
mongos>
bye
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mongo –port 27020
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27020/test
Server has startup warnings:
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root use r, which is not recommended.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag i s ‘always’.
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:04:52.190+0000 I CONTROL [initandlisten]
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
shard_db 0.063GB
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> use shard_db
switched to db shard_db
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T01:52:29.700Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 2857,
“optime” : Timestamp(1435887158, 1007),
“optimeDate” : ISODate(“2015-07- 03T01:32:38Z”),
“electionTime” : Timestamp(14358 85575, 2),
“electionDate” : ISODate(“2015-0 7-03T01:06:15Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27021”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 2742,
“optime” : Timestamp(1435887158, 1007),
“optimeDate” : ISODate(“2015-07- 03T01:32:38Z”),
“lastHeartbeat” : ISODate(“2015- 07-03T01:52:28.808Z”),
“lastHeartbeatRecv” : ISODate(“2 015-07-03T01:52:29.623Z”),
“pingMs” : 0,
“syncingTo” : “ip-10-0-0-197:270 20”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27022”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 2721,
“lastHeartbeat” : ISODate(“2015- 07-03T01:52:28.814Z”),
“lastHeartbeatRecv” : ISODate(“2 015-07-03T01:52:28.814Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1,
“$gleStats” : {
“lastOpTime” : Timestamp(0, 0),
“electionId” : ObjectId(“5595e0073bb9316 7d3d7b963”)
}
}
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T01:52:42.141Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 2870,
“optime” : Timestamp(1435887158, 1007),
“optimeDate” : ISODate(“2015-07-03T01:32:38Z”),
“electionTime” : Timestamp(1435885575, 2),
“electionDate” : ISODate(“2015-07-03T01:06:15Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27021”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 2755,
“optime” : Timestamp(1435887158, 1007),
“optimeDate” : ISODate(“2015-07-03T01:32:38Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:52:40.809Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:52:41.625Z”),
“pingMs” : 0,
“syncingTo” : “ip-10-0-0-197:27020”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27022”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 2734,
“lastHeartbeat” : ISODate(“2015-07-03T01:52:40.819Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:52:40.819Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1,
“$gleStats” : {
“lastOpTime” : Timestamp(0, 0),
“electionId” : ObjectId(“5595e0073bb93167d3d7b963”)
}
}
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> use admin
switched to db admin
rs2:PRIMARY> rs.help(0


rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shutdownServer()
2015-07-03T01:54:10.209+0000 I NETWORK DBClientCursor::init call() failed
server should be down…
2015-07-03T01:54:10.211+0000 I NETWORK trying reconnect to 127.0.0.1:27020 (127.0.0.1) failed
2015-07-03T01:54:10.211+0000 I NETWORK reconnect 127.0.0.1:27020 (127.0.0.1) ok
2015-07-03T01:54:10.211+0000 I NETWORK DBClientCursor::init call() failed
2015-07-03T01:54:10.214+0000 I NETWORK trying reconnect to 127.0.0.1:27020 (127.0.0.1) failed
2015-07-03T01:54:10.214+0000 I NETWORK reconnect 127.0.0.1:27020 (127.0.0.1) ok
2015-07-03T01:54:11.093+0000 I NETWORK Socket recv() errno:104 Connection reset by peer 127.0.0.1:27020
2015-07-03T01:54:11.093+0000 I NETWORK SocketException: remote: 127.0.0.1:27020 error: 9001 socket exception [RECV_ERROR] server [127.0.0.1:27020]
2015-07-03T01:54:11.093+0000 I NETWORK DBClientCursor::init call() failed
>
> ^C
bye
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mongo –port 27021
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27021/test
Server has startup warnings:
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten]
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten]
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten]
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T01:54:33.474Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 0,
“state” : 8,
“stateStr” : “(not reachable/healthy)”,
“uptime” : 0,
“optime” : Timestamp(0, 0),
“optimeDate” : ISODate(“1970-01-01T00:00:00Z”),
“lastHeartbeat” : ISODate(“2015-07-03T01:54:31.676Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:54:08.832Z”),
“pingMs” : 0,
“lastHeartbeatMessage” : “Failed attempt to connect to ip-10-0-0-197:27020; couldn’t connect to server ip-10-0-0-197:27020 (10.0.0.197), connection attempt failed”,
“configVersion” : -1
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27021”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 2955,
“optime” : Timestamp(1435887158, 1007),
“optimeDate” : ISODate(“2015-07-03T01:32:38Z”),
“electionTime” : Timestamp(1435888451, 1),
“electionDate” : ISODate(“2015-07-03T01:54:11Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27022”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 2844,
“lastHeartbeat” : ISODate(“2015-07-03T01:54:31.656Z”),
“lastHeartbeatRecv” : ISODate(“2015-07-03T01:54:32.839Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1
}
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show dbs
local 1.031GB
shard_db 0.063GB
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> use shard_db
switched to db shard_db
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> show collections
shard_col
system.indexes
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.find(0


rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.find()
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c99”), “user_id” : 10, “name” : “bulk-inserts”, “Iteration: ” : 10 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9a”), “user_id” : 11, “name” : “bulk-inserts”, “Iteration: ” : 11 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9b”), “user_id” : 12, “name” : “bulk-inserts”, “Iteration: ” : 12 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9c”), “user_id” : 13, “name” : “bulk-inserts”, “Iteration: ” : 13 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9d”), “user_id” : 14, “name” : “bulk-inserts”, “Iteration: ” : 14 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9e”), “user_id” : 15, “name” : “bulk-inserts”, “Iteration: ” : 15 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5c9f”), “user_id” : 16, “name” : “bulk-inserts”, “Iteration: ” : 16 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca0”), “user_id” : 17, “name” : “bulk-inserts”, “Iteration: ” : 17 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca1”), “user_id” : 18, “name” : “bulk-inserts”, “Iteration: ” : 18 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca2”), “user_id” : 19, “name” : “bulk-inserts”, “Iteration: ” : 19 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca3”), “user_id” : 20, “name” : “bulk-inserts”, “Iteration: ” : 20 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca4”), “user_id” : 21, “name” : “bulk-inserts”, “Iteration: ” : 21 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca5”), “user_id” : 22, “name” : “bulk-inserts”, “Iteration: ” : 22 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca6”), “user_id” : 23, “name” : “bulk-inserts”, “Iteration: ” : 23 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca7”), “user_id” : 24, “name” : “bulk-inserts”, “Iteration: ” : 24 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca8”), “user_id” : 25, “name” : “bulk-inserts”, “Iteration: ” : 25 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5ca9”), “user_id” : 26, “name” : “bulk-inserts”, “Iteration: ” : 26 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5caa”), “user_id” : 27, “name” : “bulk-inserts”, “Iteration: ” : 27 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5cab”), “user_id” : 28, “name” : “bulk-inserts”, “Iteration: ” : 28 }
{ “_id” : ObjectId(“5595e57a1e23bb82ca5e5cac”), “user_id” : 29, “name” : “bulk-inserts”, “Iteration: ” : 29 }
Type “it” for more
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY> db.shard_col.count()
171188
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY>
bye
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# ./mongod –shardsvr –replSet rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mo ngod.log –port 27020 –smallfiles –nojournal –quiet &
[1] 21058
[root@ip-10-0-0-197 data]# bash: ./mongod: No such file or directory

[1]+ Exit 127 ./mongod –shardsvr –repl Set rs2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1 _mongod.log –port 27020 –smallfiles –nojournal –quie t
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mongod –shardsvr –replSet r s2 –dbpath /data/rs2_1 –logpath /data/rs2_1/rs2_1_mong od.log –port 27020 –smallfiles –nojournal –quiet & [1] 21090
[root@ip-10-0-0-197 data]# 2015-07-03T01:59:59.095+0000 I CONTROL log file “/data/rs2_1/rs2_1_mongod.log” exist s; moved to “/data/rs2_1/rs2_1_mongod.log.2015-07-03T01- 59-59”.

[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]#
[root@ip-10-0-0-197 data]# mongo –port 27021 MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27021/test

Server has startup warnings:
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root use r, which is not recommended.
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten]
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten]
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag i s ‘always’.
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:05:18.759+0000 I CONTROL [initandlisten]
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
“set” : “rs2”,
“date” : ISODate(“2015-07-03T02:00:41.512Z”),
“myState” : 1,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27020”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 41,
“optime” : Timestamp(1435888578, 1),
“optimeDate” : ISODate(“2015-07- 03T01:56:18Z”),
“lastHeartbeat” : ISODate(“2015- 07-03T02:00:40.290Z”),
“lastHeartbeatRecv” : ISODate(“2 015-07-03T02:00:41.163Z”),
“pingMs” : 0,
“syncingTo” : “ip-10-0-0-197:270 21”,
“configVersion” : 3
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27021”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 3323,
“optime” : Timestamp(1435888578, 1),
“optimeDate” : ISODate(“2015-07- 03T01:56:18Z”),
“electionTime” : Timestamp(14358 88451, 1),
“electionDate” : ISODate(“2015-0 7-03T01:54:11Z”),
“configVersion” : 3,
“self” : true
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27022”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 3212,
“lastHeartbeat” : ISODate(“2015- 07-03T02:00:39.757Z”),
“lastHeartbeatRecv” : ISODate(“2 015-07-03T02:00:40.931Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1,
“$gleStats” : {
“lastOpTime” : Timestamp(0, 0),
“electionId” : ObjectId(“5595eb435d76c07 b578b7e3a”)
}
}
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> use shard_db
switched to db shard_db
rs2:PRIMARY> db.shard_col.count()
171189
rs2:PRIMARY>
Shard 1:
========================
Using username “ec2-user”.
Authenticating with public key “imported-openssh-key”
Last login: Fri Jul 3 00:22:22 2015 from 123.236.162.240

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2015.03-release-notes/
27 package(s) needed for security, out of 56 available
Run “sudo yum update” to apply all updates.
[ec2-user@ip-10-0-0-197 ~]$
[ec2-user@ip-10-0-0-197 ~]$ sudo su
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]#
[root@ip-10-0-0-197 ec2-user]# cd /home/ec2-user/mongodb-linux-x86_64-3.0.2/bin/
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Apr 8 20:39 bsondump
-rwxr-xr-x 1 1046 1046 5.6M Apr 8 20:39 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Apr 8 20:39 mongofiles
-rwxr-xr-x 1 1046 1046 5.7M Apr 8 20:39 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Apr 8 20:39 mongoimport
-rwxr-xr-x 1 1046 1046 6.0M Apr 8 20:39 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Apr 8 20:39 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Apr 8 20:39 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Apr 8 20:39 mongooplog
-rwxr-xr-x 1 1046 1046 22M Apr 8 20:46 mongoperf
-rwxr-xr-x 1 1046 1046 22M Apr 8 20:46 mongod
-rwxr-xr-x 1 1046 1046 11M Apr 8 20:46 mongos
-rwxr-xr-x 1 1046 1046 12M Apr 8 20:46 mongo
-rw-r–r– 1 root root 4.3K May 10 15:13 shard_creation_script.sh
-rw-r–r– 1 root root 4.3K May 10 15:36 new_shard_creation_script.sh
-rw-r–r– 1 root root 3.9K May 10 15:56 NSS.sh
-rw-r–r– 1 root root 3.9K May 10 16:06 shard-script.sh
-rw-r–r– 1 root root 4.0K May 11 00:59 new_script.sh
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# mongo –port 27010
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27010/test
Server has startup warnings:
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:00:55.105+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-07-03T01:00:55.106+0000 I CONTROL [initandlisten]
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> show dbs
local 1.031GB
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> show dbs
local 1.031GB
shard_db 0.031GB
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> show dbs
local 1.031GB
shard_db 0.031GB
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> show collections
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> use shard_db
switched to db shard_db
rs1:PRIMARY>
rs1:PRIMARY> show collections
shard_col
system.indexes
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY>
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY>
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY> db.shard_col.count()
9
rs1:PRIMARY> db.shard_col.count()
28812
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> db.shard_col.find()
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c90”), “user_id” : 1, “name” : “bulk-inserts”, “Iteration: ” : 1 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c91”), “user_id” : 2, “name” : “bulk-inserts”, “Iteration: ” : 2 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c92”), “user_id” : 3, “name” : “bulk-inserts”, “Iteration: ” : 3 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c93”), “user_id” : 4, “name” : “bulk-inserts”, “Iteration: ” : 4 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c94”), “user_id” : 5, “name” : “bulk-inserts”, “Iteration: ” : 5 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c95”), “user_id” : 6, “name” : “bulk-inserts”, “Iteration: ” : 6 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c96”), “user_id” : 7, “name” : “bulk-inserts”, “Iteration: ” : 7 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c97”), “user_id” : 8, “name” : “bulk-inserts”, “Iteration: ” : 8 }
{ “_id” : ObjectId(“5595e5781e23bb82ca5e5c98”), “user_id” : 9, “name” : “bulk-inserts”, “Iteration: ” : 9 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f94d”), “user_id” : 171198, “name” : “bulk-inserts”, “Iteration: ” : 17119 8 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f94e”), “user_id” : 171199, “name” : “bulk-inserts”, “Iteration: ” : 17119 9 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f94f”), “user_id” : 171200, “name” : “bulk-inserts”, “Iteration: ” : 17120 0 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f950”), “user_id” : 171201, “name” : “bulk-inserts”, “Iteration: ” : 17120 1 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f951”), “user_id” : 171202, “name” : “bulk-inserts”, “Iteration: ” : 17120 2 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f952”), “user_id” : 171203, “name” : “bulk-inserts”, “Iteration: ” : 17120 3 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f953”), “user_id” : 171204, “name” : “bulk-inserts”, “Iteration: ” : 17120 4 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f954”), “user_id” : 171205, “name” : “bulk-inserts”, “Iteration: ” : 17120 5 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f955”), “user_id” : 171206, “name” : “bulk-inserts”, “Iteration: ” : 17120 6 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f956”), “user_id” : 171207, “name” : “bulk-inserts”, “Iteration: ” : 17120 7 }
{ “_id” : ObjectId(“5595e6361e23bb82ca60f957”), “user_id” : 171208, “name” : “bulk-inserts”, “Iteration: ” : 17120 8 }
Type “it” for more
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> db.shard_col.count()
128812
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> use admin
switched to db admin
rs1:PRIMARY> db.shutdownServer()
2015-07-03T01:56:26.438+0000 I NETWORK DBClientCursor::i nit call() failed
server should be down…
2015-07-03T01:56:26.440+0000 I NETWORK trying reconnect to 127.0.0.1:27010 (127.0.0.1) failed
2015-07-03T01:56:26.440+0000 I NETWORK reconnect 127.0.0 .1:27010 (127.0.0.1) ok
2015-07-03T01:56:26.828+0000 I NETWORK Socket recv() err no:104 Connection reset by peer 127.0.0.1:27010
2015-07-03T01:56:26.828+0000 I NETWORK SocketException: remote: 127.0.0.1:27010 error: 9001 socket exception [REC V_ERROR] server [127.0.0.1:27010]
2015-07-03T01:56:26.828+0000 I NETWORK DBClientCursor::i nit call() failed
2015-07-03T01:56:26.831+0000 I NETWORK trying reconnect to 127.0.0.1:27010 (127.0.0.1) failed
2015-07-03T01:56:26.831+0000 W NETWORK Failed to connect to 127.0.0.1:27010, reason: errno:111 Connection refused
2015-07-03T01:56:26.831+0000 I NETWORK reconnect 127.0.0 .1:27010 (127.0.0.1) failed failed couldn’t connect to se rver 127.0.0.1:27010 (127.0.0.1), connection attempt fail ed
>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# mongo –port 27011
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27011/test
Server has startup warnings:
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten] * * WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten]
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten]
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten] * * WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten] * * We suggest setting it to ‘never’
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten]
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> show dbs
local 1.031GB
shard_db 0.125GB
rs1:PRIMARY>
rs1:PRIMARY> use shard_db
switched to db shard_db
rs1:PRIMARY> db.shard_col.count()
176769
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> db.shard_col.count()
176769
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# ./mongod –shardsvr –replSet r s1 –dbpath /data/rs1_1 –logpath /data/rs1_1/rs1_1_mongo d.log –port 27010 –smallfiles –nojournal –quiet &
[1] 20928
[root@ip-10-0-0-197 bin]# 2015-07-03T01:59:33.214+0000 I CONTROL log file “/data/rs1_1/rs1_1_mongod.log” exists; moved to “/data/rs1_1/rs1_1_mongod.log.2015-07-03T01-59-3 3”.

[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# mongo –port 27010 MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27010/test
Server has startup warnings:
2015-07-03T01:59:33.252+0000 I CONTROL [initandlisten] * * WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:59:33.252+0000 I CONTROL [initandlisten]
2015-07-03T01:59:33.252+0000 I CONTROL [initandlisten]
2015-07-03T01:59:33.252+0000 I CONTROL [initandlisten] * * WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:59:33.252+0000 I CONTROL [initandlisten] * * We suggest setting it to ‘never’
2015-07-03T01:59:33.252+0000 I CONTROL [initandlisten]
rs1:SECONDARY>
rs1:SECONDARY>
rs1:SECONDARY>
rs1:SECONDARY>
rs1:SECONDARY>
rs1:SECONDARY>
rs1:SECONDARY>
rs1:SECONDARY> rs.status()
{
“set” : “rs1”,
“date” : ISODate(“2015-07-03T02:00:30.989Z”),
“myState” : 2,
“syncingTo” : “ip-10-0-0-197:27011”,
“members” : [
{
“_id” : 0,
“name” : “ip-10-0-0-197:27010”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 57,
“optime” : Timestamp(1435888597, 138),
“optimeDate” : ISODate(“2015-07-0 3T01:56:37Z”),
“syncingTo” : “ip-10-0-0-197:2701 1”,
“configVersion” : 3,
“self” : true
},
{
“_id” : 1,
“name” : “ip-10-0-0-197:27011”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 57,
“optime” : Timestamp(1435888597, 138),
“optimeDate” : ISODate(“2015-07-0 3T01:56:37Z”),
“lastHeartbeat” : ISODate(“2015-0 7-03T02:00:29.279Z”),
“lastHeartbeatRecv” : ISODate(“20 15-07-03T02:00:30.137Z”),
“pingMs” : 0,
“electionTime” : Timestamp(143588 8589, 1),
“electionDate” : ISODate(“2015-07 -03T01:56:29Z”),
“configVersion” : 3
},
{
“_id” : 2,
“name” : “ip-10-0-0-197:27012”,
“health” : 1,
“state” : 7,
“stateStr” : “ARBITER”,
“uptime” : 57,
“lastHeartbeat” : ISODate(“2015-0 7-03T02:00:29.279Z”),
“lastHeartbeatRecv” : ISODate(“20 15-07-03T02:00:30.481Z”),
“pingMs” : 0,
“configVersion” : 3
}
],
“ok” : 1
}
rs1:SECONDARY>
rs1:SECONDARY>
bye
[root@ip-10-0-0-197 bin]#
[root@ip-10-0-0-197 bin]# mongo –port 27011
MongoDB shell version: 3.0.2
connecting to: 127.0.0.1:27011/test
Server has startup warnings:
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten] * * WARNING: You are running this process as the root user, which is not recommended.
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten]
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten]
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten] * * WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten] * * We suggest setting it to ‘never’
2015-07-03T01:01:38.828+0000 I CONTROL [initandlisten]
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY>
rs1:PRIMARY> use shard_db
switched to db shard_db
rs1:PRIMARY> db.shard_col.count()
176769
rs1:PRIMARY>
rs1:PRIMARY>

  • Ask Question