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.

An example:

Startup

  • 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?

1 Reply

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 192.168.x.x

From your other server in the same data center you can connect to this by ssh eg., ssh root@192.168.x.x.

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 123.45.67.89 <-- with the IPv4 address in that example allowing only traffic from that source.

Anyway you proceed, I would strongly recommend setting up a key-pair (this also helps with automating this) and a limited user account (a user who is not root).

Hope this helps!

Christine

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct