Skip to content

Commit

Permalink
accept params for eval
Browse files Browse the repository at this point in the history
  • Loading branch information
theTechie committed Nov 28, 2015
1 parent 2c22d18 commit 35a0dfd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
7 changes: 5 additions & 2 deletions mongoDB.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
var Q = require('q'),
MongoClient = require('mongodb').MongoClient,
url = 'mongodb://172.17.0.2:27017/nosql-eval',
uri = 'mongodb://',
port = '27017',
db_name = 'nosql-eval',
TABLE_NAME = 'CS550',
db_obj;

function init(callback) {
function init(ip, callback) {
var deferred = Q.defer();
var url = uri + ip + ':' + port + '/' + db_name;

MongoClient.connect(url, function(err, db) {
if (err) {
Expand Down
6 changes: 4 additions & 2 deletions redisDB.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
var Q = require('q'),
redis = require('redis'),
url = 'redis://172.17.0.2:6379',
uri = 'redis://',
port = '6379',
TABLE_NAME = 'CS550',
RedisClient;

function init(callback) {
function init(ip, callback) {
var deferred = Q.defer();
var url = uri + ip + ':' + port;

RedisClient = redis.createClient(url);

Expand Down
2 changes: 1 addition & 1 deletion scripts/eval-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GET_IP="aws ec2 describe-instances --query "Reservations[*].Instances[*].Private

IP_LIST=$($GET_IP)

#<script> <db> <scale>
#<script> <db> <scale> <iterations>

# Start Evaluation; output output in console and also store in 'output' folder with hostnames
for (( i=0; i < $2; i++ ))
Expand Down
8 changes: 5 additions & 3 deletions scripts/mongo/eval-mongo-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ GET_IP="aws ec2 describe-instances --query "Reservations[*].Instances[*].Private

IP_LIST=$($GET_IP)

# <script> <db> <ip> <scale> <iterations>

# Start Evaluation; output output in console and also store in 'output' folder with hostnames
for (( i=0; i < $1; i++ ))
for (( i=0; i<$3; i++ ))
do
RANGE=$(($(($i+1))*100000));
RANGE=$(($(($i+1))*$4));
echo "connect to ${IP_LIST[$i]} and start mongo evaluation"
parallel-ssh -H ${IP_LIST[$i]} -x "-oStrictHostKeyChecking=no -i $PRIVATE_KEY" -i -o output -e error "node nosql-eval/test_all -d mongo -k $RANGE -i 100000"
parallel-ssh -H ${IP_LIST[$i]} -x "-oStrictHostKeyChecking=no -i $PRIVATE_KEY" -i -o output -e error "node nosql-eval/test_all -d $1 -h $2 -k $RANGE -i $4"
done
6 changes: 5 additions & 1 deletion test_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ var argv = require('optimist')
.demand(['d', 'k', 'i'])
.alias('d', 'dbName')
.describe('d', 'NoSQL DB Name')
.alias('h', 'host')
.describe('h', 'Host IP Address')
.alias('k', 'keyRange')
.describe('k', 'Key Range')
.alias('i', 'iterations')
Expand Down Expand Up @@ -44,14 +46,16 @@ switch (argv.dbName) {


// NOTE: Initialize Test
Store.init().then(function (status) {
Store.init(argv.host).then(function (status) {
if (status) {
doTest(constants.TEST_PUT);
} else {
console.log("ERROR INITIALIZING DB !");
process.exit();
}
}, function (err) {
console.log(err);
process.exit();
});

function doTest(operation) {
Expand Down

0 comments on commit 35a0dfd

Please sign in to comment.