|
@@ -0,0 +1,125 @@
|
|
|
|
|
+192.168.1.107 nowledgedata-n1
|
|
|
|
|
+192.168.1.106 nowledgedata-n2
|
|
|
|
|
+192.168.1.116 nowledgedata-n3
|
|
|
|
|
+192.168.1.115 nowledgedata-n4
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+JVM_ARGS="-Xmx2G -Xms2G -Xmn1G -XX:MaxPermSize=256m -XX:PermSize=256m -DzkHost=nowledgedata-n4:2181 -Dbootstrap_conf=true -DnumShards=3 -Djetty.port=8983"
|
|
|
|
|
+JAVA_OPTS="$JAVA_OPTS $JVM_ARGS"
|
|
|
|
|
+
|
|
|
|
|
+JVM_ARGS="-Xmx2G -Xms2G -Xmn1G -XX:MaxPermSize=256m -XX:PermSize=256m -Djetty.port=8983 -DzkHost=nowledgedata-n4:2181"
|
|
|
|
|
+JAVA_OPTS="$JAVA_OPTS $JVM_ARGS"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+bin/mongos -configdb 192.168.1.107:37017,192.168.1.106:37017,192.168.1.116:37017 -port 30000 -chunkSize 64 -logpath /data/mongos/mongos.log --fork
|
|
|
|
|
+bin/mongo 192.168.1.107:30000/admin
|
|
|
|
|
+db.runCommand({"addshard":"192.168.1.107:27017"})
|
|
|
|
|
+db.runCommand({"addshard":"192.168.1.106:27017"})
|
|
|
|
|
+db.runCommand({"addshard":"192.168.1.116:27017"})
|
|
|
|
|
+db.runCommand({"addshard":"192.168.1.115:27017"})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+db.runCommand({"enablesharding": "ndmongo"})
|
|
|
|
|
+db.runCommand({"shardcollection":"nsmongo.postStore", "key":{"postUrn":1}})
|
|
|
|
|
+db.runCommand({"shardcollection":"nsmongo.userStore", "key":{"userUrn":1}})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+# User Operator
|
|
|
|
|
+db.userStore.ensureIndex({userUrn: 1}, {unique: true})
|
|
|
|
|
+db.userStore.ensureIndex({"userId": 1, "dwEntitySectionUrn": 1})
|
|
|
|
|
+
|
|
|
|
|
+# Post Operator
|
|
|
|
|
+db.postStore.ensureIndex({postUrn: 1}, {unique: true})
|
|
|
|
|
+db.postStore.ensureIndex({"postId": 1, "dwEntitySectionUrn": 1})
|
|
|
|
|
+db.postStore.ensureIndex({"createdAt": -1})
|
|
|
|
|
+db.postStore.ensureIndex({"comboKey": -1})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+192.168.1.15 nowledgedata-s1
|
|
|
|
|
+192.168.1.16 nowledgedata-s2
|
|
|
|
|
+192.168.1.17 nowledgedata-s3
|
|
|
|
|
+192.168.1.18 nowledgedata-s4
|
|
|
|
|
+
|
|
|
|
|
+mkdir -p ~/mongodata/shard1/data
|
|
|
|
|
+mkdir ~/mongodata/shard1/logs
|
|
|
|
|
+mkdir ~/mongodata/shard1/data
|
|
|
|
|
+mkdir ~/mongodata/shard2/logs
|
|
|
|
|
+mkdir ~/mongodata/config/data
|
|
|
|
|
+mkdir ~/mongodata/config/logs
|
|
|
|
|
+mkdir ~/mongodata/mongos
|
|
|
|
|
+
|
|
|
|
|
+wget http://192.168.1.15/disk/mongodb-linux-x86_64-2.4.1.tgz
|
|
|
|
|
+
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard1 -port 35017 -oplogSize 100 -dbpath /home/ndyc/mongodata/shard1/data -logpath /home/ndyc/mongodata/shard1/logs/shard1.log -logappend -fork -rest
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard1 -port 35017 -oplogSize 100 -dbpath /home/mongodb/mongodata/shard1/data -logpath /home/mongodb/mongodata/shard1/logs/shard1.log -logappend -fork -rest
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard1 -port 35017 -oplogSize 100 -dbpath /home/mongodb/mongodata/shard1/data -logpath /home/mongodb/mongodata/shard1/logs/shard1.log -logappend -fork -rest
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard1 -port 35017 -oplogSize 100 -dbpath /home/monitor/mongodata/shard1/data -logpath /home/monitor/mongodata/shard1/logs/shard1.log -logappend -fork -rest
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard2 -port 35018 -oplogSize 100 -dbpath /home/ndyc/mongodata/shard2/data -logpath /home/ndyc/mongodata/shard2/logs/shard2.log -logappend -fork -rest
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard2 -port 35018 -oplogSize 100 -dbpath /home/mongodb/mongodata/shard2/data -logpath /home/mongodb/mongodata/shard2/logs/shard2.log -logappend -fork -rest
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard2 -port 35018 -oplogSize 100 -dbpath /home/mongodb/mongodata/shard2/data -logpath /home/mongodb/mongodata/shard2/logs/shard2.log -logappend -fork -rest
|
|
|
|
|
+bin/mongod -shardsvr -replSet shard2 -port 35018 -oplogSize 100 -dbpath /home/monitor/mongodata/shard2/data -logpath /home/monitor/mongodata/shard2/logs/shard2.log -logappend -fork -rest
|
|
|
|
|
+
|
|
|
|
|
+Init:
|
|
|
|
|
+
|
|
|
|
|
+config = {
|
|
|
|
|
+ _id : "shard1",
|
|
|
|
|
+ members : [
|
|
|
|
|
+ {_id : 0, host : 192.168.1.15:35017 },
|
|
|
|
|
+ {_id : 1, host : 192.168.1.16:35017 },
|
|
|
|
|
+ {_id : 2, host : 192.168.1.17:35017 },
|
|
|
|
|
+ {_id : 3, host : 192.168.1.18:35017 }
|
|
|
|
|
+ ]
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+config = { "_id" : "shard1", "members" : [ {"_id" : 0, "host" : "192.168.1.15:35017" },{"_id" : 1, "host" : "192.168.1.16:35017" }, {"_id" : 2, "host" : "192.168.1.17:35017" },{"_id" : 3, "host" : "192.168.1.18:35017" } ]}
|
|
|
|
|
+
|
|
|
|
|
+rs.initiate(config);
|
|
|
|
|
+
|
|
|
|
|
+config = {
|
|
|
|
|
+ _id : "shard2",
|
|
|
|
|
+ members : [
|
|
|
|
|
+ {_id : 0, host : 192.168.1.15:35018 },
|
|
|
|
|
+ {_id : 1, host : 192.168.1.16:35018 },
|
|
|
|
|
+ {_id : 2, host : 192.168.1.17:35018 },
|
|
|
|
|
+ {_id : 3, host : 192.168.1.18:35018 },
|
|
|
|
|
+ ]
|
|
|
|
|
+}
|
|
|
|
|
+config = {"_id" : "shard2", "members" : [{"_id" : 0, "host" : "192.168.1.15:35018" }, {"_id" : 1, "host" : "192.168.1.16:35018" }, {"_id" : 2, "host" : "192.168.1.17:35018" }, {"_id" : 3, "host" : "192.168.1.18:35018" }]}
|
|
|
|
|
+rs.initiate(config);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+Config:
|
|
|
|
|
+
|
|
|
|
|
+bin/mongod --configsvr --port 36000 --dbpath /home/mongodb/mongodata/config/data --logpath /home/mongodb/mongodata/config/logs/config.log --logappend --fork
|
|
|
|
|
+bin/mongod --configsvr --port 36000 --dbpath /home/mongodb/mongodata/config/data --logpath /home/mongodb/mongodata/config/logs/config.log --logappend --fork
|
|
|
|
|
+bin/mongod --configsvr --port 36000 --dbpath /home/monitor/mongodata/config/data --logpath /home/monitor/mongodata/config/logs/config.log --logappend --fork
|
|
|
|
|
+
|
|
|
|
|
+Mongos:
|
|
|
|
|
+
|
|
|
|
|
+bin/mongos --configdb 192.168.1.16:36000,192.168.1.17:36000,192.168.1.18:36000 --port 40000 --chunkSize 100 -logpath /home/ndyc/mongodata/mongos/mongos.log --logappend --fork
|
|
|
|
|
+
|
|
|
|
|
+Admin:
|
|
|
|
|
+
|
|
|
|
|
+bin/mongo 192.168.1.15:40000/admin
|
|
|
|
|
+db.runCommand({"addshard" : "shard1/192.168.1.15:35017,192.168.1.16:35017,192.168.1.17:35017,192.168.1.18:35017", name : "shard1", allowLocal : true});
|
|
|
|
|
+db.runCommand({"addshard" : "shard2/192.168.1.15:35018,192.168.1.16:35018,192.168.1.17:35018,192.168.1.18:35018", name : "shard2", allowLocal : true});
|
|
|
|
|
+db.runCommand({"enablesharding": "nsmongo"})
|
|
|
|
|
+db.runCommand({"shardcollection":"nsmongo.postStore", "key":{"postUrn":1}})
|
|
|
|
|
+db.runCommand({"shardcollection":"nsmongo.userStore", "key":{"userUrn":1}})
|
|
|
|
|
+
|
|
|
|
|
+db.runCommand({ listshards : 1 })
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+Query:
|
|
|
|
|
+
|
|
|
|
|
+bin/mongo 192.168.1.18:40000/nsmongo
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+wget http://192.168.1.15/disk/apache-tomcat-6.0.36.tar.gz
|
|
|
|
|
+JVM_ARGS="-Xmx2G -Xms2G -Xmn1G -XX:MaxPermSize=256m -XX:PermSize=256m -DzkHost=nowledgedata-n3:2181 -Dbootstrap_conf=true -DnumShards=3 -Djetty.port=8828"
|
|
|
|
|
+JAVA_OPTS="$JAVA_OPTS $JVM_ARGS"
|
|
|
|
|
+
|
|
|
|
|
+JVM_ARGS="-Xmx2G -Xms2G -Xmn1G -XX:MaxPermSize=256m -XX:PermSize=256m -Djetty.port=8828 -DzkHost=nowledgedata-s3:2181"
|
|
|
|
|
+JAVA_OPTS="$JAVA_OPTS $JVM_ARGS"
|