bakwc/PySyncObj

Not able to detect servers while running two servers on compute engine in GCP

vash6618 opened this issue · 3 comments

I tested the library locally by running two python servers(running on 8080 and 8081) and the self address and otheraddresses were (localhost:5030, localhost:5031). This setup worked fine in the localhost scenario.

Now while deploying the same code on cloud I changed the self address and otheraddresses to (localhost:5030, other_node_ip:5031). With this setup on cloud the data is not getting replicated across machines. Following is my config file :-

class main_config:
main_app_port = 5030
secondary_app_port = 5031
main_app_ip = '127.0.0.1'
secondary_app_ip = 'secondary_ip' # this is just to hide the actual ip of the machine

class secondary_config:
main_app_port = 5030
secondary_app_port = 5031
main_app_ip = 'main_ip' # this is just to hide the actual ip of the machine
secondary_app_ip = '127.0.0.1'

bakwc commented

For real-world network you should not use localhost, you should specify a real ip addresses for all nodes. 127.0.0.1 will not work if you are trying to connect to remote machines.

This config is getting used in the cloud with the remote servers. Should the self node address be the public IP of the machine it is running on? I have tried with that as well but it is not replicating.

bakwc commented

You should use public IP.
If your network interface IP differs from your public IP - you should set correct bindAddress in config, see syncobjconf
bindAddress - the IP address of your network card.
node address - the public IP address, that is used for connection from outside.