Browse Source

mongo tail

master
zeus 4 years ago
parent
commit
32e1f821b9
  1. 42
      swarmlab-app/src/run/app.js

42
swarmlab-app/src/run/app.js

@ -387,16 +387,40 @@ function onCollection(err, collection) {
// 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://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"
//MongoClient.connect(mongourl, options).then((client) => {
//MongoClient.connect("mongodb://member1,member2,member3/database", function(err,db) {
//})
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 mongolab_uri = "mongodb://<dbUser>:<dbPassword>@<host1>:<port1>,<host2>:<port2>/<dbName>?replicaSet=<replicaSetName>";
var mongooptions = {
auth.user:"playgrounduser",
auth.password:'efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine'
server: {
socketOptions: {
autoReconnect: true,
keepAlive: 1,
connectTimeoutMS: 30000,
socketTimeoutMS: 0
}
MongoClient.connect(mongourl,mongooptions).then((client) => {
},
replSet: {
socketOptions: {
keepAlive: 1,
connectTimeoutMS: 30000,
socketTimeoutMS: 0
}
}
}
MongoClient.connect(mongourl, mongooptions, function(err, db){
if(err){
console.log(err);
} else {
db.collections(function(err, collections) {
collections.forEach(function(coll) {
console.log(coll.s.name);
});
});
}
});
//MongoClient.connect(mongourl,mongooptions).then((client) => {
/*
MongoClient.connect(mongourl).then((client) => {
const db = client.db('fluent');
db.collection('log', onCollection);
// do database things
@ -404,7 +428,7 @@ MongoClient.connect(mongourl,mongooptions).then((client) => {
console.log("connect_error_mongo " +JSON.stringify(error))
// handle connection errors
});
*/
io.on('connection', s => {
console.error('socket connection');

Loading…
Cancel
Save