How would I communicate between multiple servers?
Hello there, I have planned to release a site with the ability to buy data from it at a cheap price. I am now wondering how I would communicate between multiple servers securely.
The site is coded in Node.JS and I am wondering if there is a guide to accomplish this and where I could find it, or if you have a solid solution for this.
- All servers start up, and connect to each other so they are able to communicate (this is the part I'm struggling with)
- Servers starts listening for requests
Customer buys data -> Server asks other servers for info & data -> Chooses server, tells the server to buy BlockStorage and set it up -> Server's BlockStorage ready, sends back to the Server -> Server telling client success etc.
How would I set this up, and is there a package (on NPM, GitHub or anything else) that would do this for me?
Hi @Martini! Do you know where your servers are going to live? One way you can accomplish this is having the servers in the same data center and connect to them over the LAN or Private IP space.
For example, on your Linode manager on your selected Linode if you navigate to the "Networking" tab and you should see under IPv4 a "Type" column if you see "Private" the address there should be something like
From your other server in the same data center you can connect to this by ssh eg.,
Another way to do this is over the public internet (under IPv4 a "Type" column "Public") On the server you want to connect you can restrict all traffic and only allow connections only from that server. A simple way to do this is with UFW "Uncomplicated Fire Wall" eg.,
sudo ufw allow from 22.214.171.124 <-- with the IPv4 address in that example allowing only traffic from that source.
Hope this helps!