Browse Source

More fixes

Christian Kvalheim 12 years ago
parent
commit
e3691d14b0
1 changed files with 9 additions and 8 deletions
  1. 9 8
      nodejs/hello.js

+ 9 - 8
nodejs/hello.js

@@ -1,8 +1,10 @@
 var cluster = require('cluster')
 var cluster = require('cluster')
   , numCPUs = require('os').cpus().length;
   , numCPUs = require('os').cpus().length;
 
 
-numCPUs = 1
-if (cluster.isMaster) {
+var host = "172.16.234.132"
+  host = "127.0.0.1";
+
+if(cluster.isMaster) {
   // Fork workers.
   // Fork workers.
   for (var i = 0; i < numCPUs; i++) {
   for (var i = 0; i < numCPUs; i++) {
     cluster.fork();
     cluster.fork();
@@ -19,12 +21,11 @@ var http = require('http')
   , url = require('url')
   , url = require('url')
   , async = require('async')
   , async = require('async')
   , mongoose = require('mongoose')
   , mongoose = require('mongoose')
-  // , conn = mongoose.connect('mongodb://172.16.234.132/hello_world')
-  , conn = mongoose.connect('mongodb://localhost/hello_world')
+  , conn = mongoose.connect('mongodb://' + host + '/hello_world')
   , MongoClient = require('mongodb').MongoClient
   , MongoClient = require('mongodb').MongoClient
-  , mysql = require('mysql')
+  // , mysql = require('mysql')
   // , pool  = mysql.createPool({
   // , pool  = mysql.createPool({
-  //     host: '172.16.234.132',
+  //     host: host,
   //     user     : 'benchmarkdbuser',
   //     user     : 'benchmarkdbuser',
   //     password : 'benchmarkdbpass',
   //     password : 'benchmarkdbpass',
   //     database : 'hello_world',
   //     database : 'hello_world',
@@ -32,7 +33,7 @@ var http = require('http')
   //   })
   //   })
   // , Sequelize = require("sequelize")
   // , Sequelize = require("sequelize")
   // , sequelize = new Sequelize('hello_world', 'benchmarkdbuser', 'benchmarkdbpass', {
   // , sequelize = new Sequelize('hello_world', 'benchmarkdbuser', 'benchmarkdbpass', {
-  //   host: '172.16.234.132',
+  //   host: host,
   //   logging: false,
   //   logging: false,
   //   define: { timestamps: false },
   //   define: { timestamps: false },
   //   maxConcurrentQueries: 100,
   //   maxConcurrentQueries: 100,
@@ -46,7 +47,7 @@ var http = require('http')
 
 
 var collection = null;
 var collection = null;
 
 
-MongoClient.connect('mongodb://localhost:27017/hello_world?maxPoolSize=5', function(err, db) {
+MongoClient.connect('mongodb://' + host + '/hello_world?maxPoolSize=5', function(err, db) {
   collection = db.collection('world');
   collection = db.collection('world');
 });
 });