socketcluster: Unable to start server with more than 1 broker

When I set brokers in server.js to anything more than 1, I get the following error:

/usr/local/bin/node server.js
   [Busy] Launching SocketCluster
   >> Broker PID: 80776
   >> Broker ID: 0
   >> Broker PID: 80777
   >> Broker ID: 1
1445121659533 - Origin: Broker (PID 80777)
    [Error] Error: listen EADDRINUSE
    at exports._errnoException (util.js:746:11)
    at Server._listen2 (net.js:1139:19)
    at listen (net.js:1182:10)
    at Server.listen (net.js:1261:5)
    at EventEmitter.self.listen (/Users/developer/socketcluster-test/node_modules/socketcluster/node_modules/iocluster/node_modules/ndata/node_modules/ncom/index.js:139:19)
    at Object.<anonymous> (/Users/developer/socketcluster-test/node_modules/socketcluster/node_modules/iocluster/node_modules/ndata/server.js:480:10)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    !! Failed to bind to a port because it was already used by another process.

For example, I’ve tried with both workers and brokers set to 2 and with workers set to 3 and brokers set to 2.

Any idea what could be wrong?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

This has been fixed so that it now works with multiple brokers on OSX without having to use sudo. The fix is in socketcluster v5.0.2 .

Starting it with sudo worked. Thanks!

Why is it necessary run as root? Is there a way to get it to work without the elevated access?