|
@ -383,37 +383,16 @@ function onCollection(err, collection) { |
|
|
}, 1000); |
|
|
}, 1000); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//function onConnected(err, db) {
|
|
|
|
|
|
// db.collection('log', onCollection);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//var mongourl = "mongodb://playgrounduser:efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/?replicaSet=rs1"
|
|
|
|
|
|
//var mongourl = "mongodb://playgrounduser:efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/?replicaSet=rs1&authSource=admin"
|
|
|
|
|
|
//var mongourl = "mongodb://playgrounduser:efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/fluent?replicaSet=rs1&authSource=admin"
|
|
|
|
|
|
var mongourl = "mongodb://playgrounduser:efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/fluent?replicaSet=rs1" |
|
|
var mongourl = "mongodb://playgrounduser:efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/fluent?replicaSet=rs1" |
|
|
const OPTS = { useNewUrlParser: true }; |
|
|
const OPTS = { useNewUrlParser: true }; |
|
|
//var mongolab_uri = "mongodb://<dbUser>:<dbPassword>@<host1>:<port1>,<host2>:<port2>/<dbName>?replicaSet=<replicaSetName>";
|
|
|
//var mongolab_uri = "mongodb://<dbUser>:<dbPassword>@<host1>:<port1>,<host2>:<port2>/<dbName>?replicaSet=<replicaSetName>";
|
|
|
var mongooptions = { |
|
|
var mongooptions = { |
|
|
//server: {
|
|
|
|
|
|
// socketOptions: {
|
|
|
|
|
|
autoReconnect: true, |
|
|
autoReconnect: true, |
|
|
keepAlive: 1, |
|
|
keepAlive: 1, |
|
|
connectTimeoutMS: 30000, |
|
|
connectTimeoutMS: 30000, |
|
|
socketTimeoutMS: 0 |
|
|
socketTimeoutMS: 0 |
|
|
//authSource: admin,
|
|
|
|
|
|
// }
|
|
|
|
|
|
//},
|
|
|
|
|
|
/* |
|
|
|
|
|
replSet: { |
|
|
|
|
|
socketOptions: { |
|
|
|
|
|
keepAlive: 1, |
|
|
|
|
|
connectTimeoutMS: 30000, |
|
|
|
|
|
socketTimeoutMS: 0 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
*/ |
|
|
|
|
|
} |
|
|
|
|
|
//MongoClient.connect(mongourl, mongooptions, function(err, client){
|
|
|
|
|
|
MongoClient.connect(mongourl, OPTS, function(err, client){ |
|
|
MongoClient.connect(mongourl, OPTS, function(err, client){ |
|
|
if(err){ |
|
|
if(err){ |
|
|
console.log(err); |
|
|
console.log(err); |
|
@ -430,17 +409,6 @@ MongoClient.connect(mongourl, OPTS, function(err, client){ |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
//MongoClient.connect(mongourl,mongooptions).then((client) => {
|
|
|
|
|
|
/* |
|
|
|
|
|
MongoClient.connect(mongourl).then((client) => { |
|
|
|
|
|
const db = client.db('fluent'); |
|
|
|
|
|
db.collection('log', onCollection); |
|
|
|
|
|
// do database things
|
|
|
|
|
|
}).catch((error) => { |
|
|
|
|
|
console.log("connect_error_mongo " +JSON.stringify(error)) |
|
|
|
|
|
// handle connection errors
|
|
|
|
|
|
}); |
|
|
|
|
|
*/ |
|
|
|
|
|
io.on('connection', s => { |
|
|
io.on('connection', s => { |
|
|
console.error('socket connection'); |
|
|
console.error('socket connection'); |
|
|
|
|
|
|
|
|