Connecting socketcluster servers

I am trying to implement this solution (on Win10 x64), but for some reason all SocketCluster nodes refuse to communicate with each Other.

enter image description here

Sotis is my courier. Configuration:

  • 1 StateServer [7777]
  • 1 BrokerServer [8888]
  • 2 SocketCluster servers running on ports [8000, 8001]
  • 1 LoadBalancer [2000] to share traffic between two nodes.

I made sure that listeners of both state and brokerage listeners:

TCP [::]:7777 [::]:0 LISTENING TCP [::]:8888 [::]:0 LISTENING 

From what I have understood so far, BrokerServer together with SocketCluster nodes should all connect to StatusServer (?)

I could successfully connect BrokerServer to StateServer , but whenever I try to connect to any of the SocketCluster services, it reports socket-related errors.

StateServer :

 SC Cluster State Server is listening on port 7777 Sever d08298c6-523f-4c1b-9fcc-efd4e92fab22 at address undefined on port 8888 joined the cluster Client 10612bde-514f-40d3-9340-7179a1901376 at address undefined joined the cluster Cluster state converged to active:["ws://[undefined]:8888"] 

SocketCluster instance:

 { SocketProtocolError: Socket hung up at Emitter.SCSocket._onSCClose (C:\Users\Alex\AppData\Roaming\npm\node_modules\sc-cluster-broker-client\node_modules\socketcluster-client\lib\scsocket.js:596:15) at Emitter.<anonymous> (C:\Users\Alex\AppData\Roaming\npm\node_modules\sc-cluster-broker-client\node_modules\socketcluster-client\lib\scsocket.js:285:12) at Emitter.emit (C:\Users\Alex\AppData\Roaming\npm\node_modules\sc-cluster-broker-client\node_modules\component-emitter\index.js:131:20) at Emitter.SCEmitter.emit (C:\Users\Alex\AppData\Roaming\npm\node_modules\sc-cluster-broker-client\node_modules\sc-emitter\index.js:28:26) at Emitter.SCTransport._onClose (C:\Users\Alex\AppData\Roaming\npm\node_modules\sc-cluster-broker-client\node_modules\socketcluster-client\lib\sctransport.js:175:30) at WebSocket.wsSocket.onerror (C:\Users\Alex\AppData\Roaming\npm\node_modules\sc-cluster-broker-client\node_modules\socketcluster-client\lib\sctransport.js:104:12) at WebSocket.onError (C:\Users\Alex\AppData\Roaming\npm\node_modules\sc-cluster-broker-client\node_modules\ws\lib\WebSocket.js:452:14) at emitOne (events.js:96:13) at WebSocket.emit (events.js:188:7) at WebSocket.EventEmitter.emit (C:\Users\Alex\AppData\Roaming\npm\node_modules\socketcluster\node_modules\sc-domain\index.js:12:31) name: 'SocketProtocolError', message: 'Socket hung up', code: 1006 } 
+6
source share
2 answers

It turned out that scaling the cluster horizontally does not work properly in Windows (using the current version v.1.2.1). Both SocketCluster for some reason do not report withe brokerServer .

+1
source

Do you run these instances in Docker containers?

Based on the log output you get from the status server (undefined address), it looks like the scc-state instance cannot determine the IP addresses of your instances. This can happen for several reasons. For example, starting an instance inside a Docker container may obscure the real IP address of the instance. It is also possible that running SCC on Windows can cause similar problems.

The solution to this problem is to set the SCC_INSTANCE_IP environment SCC_INSTANCE_IP at startup of each instance. This environment variable should contain the IP address of the instance that other instances can use to connect to it (when using Docker, you can use the docker inspect to find the IP address of the private network of a specific container).

SCC_INSTANCE_IP can be either a private IP address, a public IP address, or a host name.

+1
source

Source: https://habr.com/ru/post/1012742/


All Articles