Report this

What is the reason for this report?

How do I replicate the droplet?

Posted on November 5, 2019

Hi guys, Let’s suppose I have two droplets ‘A’ and ‘B’. In ‘A’ droplet a NodeJS server broadcasts and receives the messages through websocket. My question is that How do I create the replicate of droplet ‘A’? In case droplet A down/fail then droplet ‘B’ automatically start the broadcasting and receiving the messages from users. Thanks,



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

In order to be able to do this kind of failover, I would recommend using a load balancer. You can take a look at this article here on how to

https://www.digitalocean.com/community/tutorials/5-digitalocean-load-balancer-use-cases

Also, there are a lot of other Load balancing tutorials here:

https://www.digitalocean.com/community/tags/load-balancing?type=tutorials

I would recommend having a similar setup to this one here:

Load Balancing DigitalOcean

So 1 Load balancer, 2 web servers, and 1 database server.

Regarding the droplet replication, you could create a snapshot of your existing droplet and create a second droplet from that snapshot. That way you would have an exact copy. If you are going to be making a lot of changes to the files of your app, you could use a service like lsyncd to replicate your files, or just use DigitalOcean block storage solution and share a specific folder between the two droplets.

Hope that this helps! Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.