Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Setting up 2 VPS that both of them uses 1 domain
New on LowEndTalk? Please Register and read our Community Rules.

Setting up 2 VPS that both of them uses 1 domain

i have a contabo vps lets name it vps1
i would like to rent another vps from a different provider, let's say vps2 is from linode
i have some domains running on vps1
i want to real time sync all website files and mysql databases from vps1 to vps2
so, if vps1 went down or something, the domain will redirect to vps2 files.
is this even possible?
i am sorry for my f*ked up english

Comments

  • @abu3beid said: is this even possible?

    yes.

    Thanked by 1abu3beid
  • @crilla said:

    @abu3beid said: is this even possible?

    yes.

    can you provide more details please? or some keywords about my situation so I can use google?

  • WebProjectWebProject Member, Host Rep

    @abu3beid said:

    @crilla said:

    @abu3beid said: is this even possible?

    yes.

    can you provide more details please? or some keywords about my situation so I can use google?

    Good keywords are: failover dns, failover website, host one website on two servers 😂

  • @WebProject said:

    @abu3beid said:

    @crilla said:

    @abu3beid said: is this even possible?

    yes.

    can you provide more details please? or some keywords about my situation so I can use google?

    Good keywords are: failover dns, failover website, host one website on two servers 😂

    also rsync, load balancing, will work for future. He think like my older me.

    Thanked by 2abu3beid WebProject
  • @abu3beid said:

    @crilla said:

    @abu3beid said: is this even possible?

    yes.

    can you provide more details please? or some keywords about my situation so I can use google?

    thank you, but what's funny I am trying to learn new things 😂

  • @bdspice said: He think like my older me.

    is that a good or a bad thing 😂

  • @abu3beid said:

    @bdspice said: He think like my older me.

    is that a good or a bad thing 😂

    Depend on your future though.

    Thanked by 1abu3beid
  • Database: SQL replication
    System file: DRBD or lsyncd
    Domain: DNS failover

  • i want to real time sync all website files and mysql databases from vps1 to vps2
    so, if vps1 went down or something, the domain will redirect to vps2 files.
    is this even possible?

    It certainly is. There are many ways, and which one(s) are best will depend on a few things:

    • How long can you and your users stand to wait before things are back up when the primary goes down (this is called your target “Recovery Time Objective” or RTO)? Do you want near-instant automatic fail-over or would it be OK for it to be available so that you can press a button when things are down on the primary. If the backup is lower spec than the primary and/or restoration take a little time and you'll have to redo when you get the primary back, it is sometimes better to have a short outage if the primary is down for a short time than to mess around moving to the secondary and back.
    • Do you want the two to actively load balance when both are up (this can get a lot more complicated when databases are involved) or just for there to be a primary and a hot backup?
    • How much data can you or your users stand to lose when the primary goes down (this is your Recovery Pont Objective or RPO). If your RTO is 30 minutes, your RPO is an hour, and it takes 15 minutes to restore your DBs and such when the secondary needs to come online then you can perhaps get away with a differential backup every 30 minutes that is transferred to the secondary. If yout RTO and RPO are both very short then you need active replication of some sort - lookup “master-slave replication” and similar concepts.
    • Do you need the web server and other application portions to be managed in the same way? You don't if it is just static app code, but if for instance your app stores uploaded images in the filesystem and information about them in the database, you need to make sure these are reasonably in sync when you restore a backup (if you can drop inconsistent data from recent updates or not will depend on your RPO and related SLAs).

    Sometimes the simplest solution is the best to start with. That is easier to test and monitor. Make sure you do properly test and monitor your solution though: at the point the primary dies is exactly the wrong time to be discovering that your backups and the secondary hasn't updated in weeks…

    As a for instance: my personal mail server (currently an instance of Zimbra but that'll be being replaced soon) does a proper full backup twice daily (before i'm due to wake up usually, and ), this is automatically restored to the backup VM and I can login to see it is no more than a day out of date. It also does a live backup (which might be a little inconsistent despite using LVM snapshots as it doesn't stop the server while doing it) far more often, should I need to restore something from the last few hours if the primary ever dies. The main job of the second VM is to test the backups, but with a couple of DNS changes it could take over the whole job if the DC the main server is in burns down. My RPO is “twelve hours for everything, a lot shorted maybe for some things but I don't mind manual work to restore them”.

    In contrast: in DayJob we have databases and related applications hot geo-replicated, if the primary goes down for any length of time we can switch over quickly and lose very little if anything. But that is more faf to configure, reliably monitor, and regularly retest, and costs in bandwidth and such. Our RTO and RPOs there are very short, though not short enough that we need to worry about restoration of service being near instantaneous.

  • Shit. Oi, Me: repeat after me:

    We must stop typing walls of text into random forums, instead of spending time on our own projects.
    We must stop typing walls of text into random forums, instead of spending time on our own projects.
    We must stop typing walls of text into random forums, instead of spending time on our own projects.
    … … … … …

  • No idea why some of you gave him shit for trying to learn new things. Like you were born with this knowledge already.

    Thought this forum had a rule about being a dickhead.

    Thanked by 2abu3beid Arkas
  • Hi,

    There is a really good tutorial on LEB about this:

    https://lowendbox.com/blog/how-to-setup-a-highly-available-wordpress-site-from-scratch-part-1/

    Keith

    Thanked by 1abu3beid
  • @keithw said:
    Hi,

    There is a really good tutorial on LEB about this:

    https://lowendbox.com/blog/how-to-setup-a-highly-available-wordpress-site-from-scratch-part-1/

    Keith

    thank you so much, ill check this out

    @serv_ee said:
    No idea why some of you gave him shit for trying to learn new things. Like you were born with this knowledge already.

    Thought this forum had a rule about being a dickhead.

    it's okay 😂

    @MeAtExampleDotCom said:

    i want to real time sync all website files and mysql databases from vps1 to vps2
    so, if vps1 went down or something, the domain will redirect to vps2 files.
    is this even possible?

    It certainly is. There are many ways, and which one(s) are best will depend on a few things:

    • How long can you and your users stand to wait before things are back up when the primary goes down (this is called your target “Recovery Time Objective” or RTO)? Do you want near-instant automatic fail-over or would it be OK for it to be available so that you can press a button when things are down on the primary. If the backup is lower spec than the primary and/or restoration take a little time and you'll have to redo when you get the primary back, it is sometimes better to have a short outage if the primary is down for a short time than to mess around moving to the secondary and back.
    • Do you want the two to actively load balance when both are up (this can get a lot more complicated when databases are involved) or just for there to be a primary and a hot backup?
    • How much data can you or your users stand to lose when the primary goes down (this is your Recovery Pont Objective or RPO). If your RTO is 30 minutes, your RPO is an hour, and it takes 15 minutes to restore your DBs and such when the secondary needs to come online then you can perhaps get away with a differential backup every 30 minutes that is transferred to the secondary. If yout RTO and RPO are both very short then you need active replication of some sort - lookup “master-slave replication” and similar concepts.
    • Do you need the web server and other application portions to be managed in the same way? You don't if it is just static app code, but if for instance your app stores uploaded images in the filesystem and information about them in the database, you need to make sure these are reasonably in sync when you restore a backup (if you can drop inconsistent data from recent updates or not will depend on your RPO and related SLAs).

    Sometimes the simplest solution is the best to start with. That is easier to test and monitor. Make sure you do properly test and monitor your solution though: at the point the primary dies is exactly the wrong time to be discovering that your backups and the secondary hasn't updated in weeks…

    As a for instance: my personal mail server (currently an instance of Zimbra but that'll be being replaced soon) does a proper full backup twice daily (before i'm due to wake up usually, and ), this is automatically restored to the backup VM and I can login to see it is no more than a day out of date. It also does a live backup (which might be a little inconsistent despite using LVM snapshots as it doesn't stop the server while doing it) far more often, should I need to restore something from the last few hours if the primary ever dies. The main job of the second VM is to test the backups, but with a couple of DNS changes it could take over the whole job if the DC the main server is in burns down. My RPO is “twelve hours for everything, a lot shorted maybe for some things but I don't mind manual work to restore them”.

    In contrast: in DayJob we have databases and related applications hot geo-replicated, if the primary goes down for any length of time we can switch over quickly and lose very little if anything. But that is more faf to configure, reliably monitor, and regularly retest, and costs in bandwidth and such. Our RTO and RPOs there are very short, though not short enough that we need to worry about restoration of service being near instantaneous.

    wow, this is too much information 😂
    thank you man!

    @Liso said:
    Database: SQL replication
    System file: DRBD or lsyncd
    Domain: DNS failover

    you are the best!
    simple and direct answer 😁

  • Check Amazon Route 53 too which can help with DNS failover + monitoring.

    Thanked by 1abu3beid
  • @Liso said:
    Database: SQL replication
    System file: DRBD or lsyncd
    Domain: DNS failover

    could you tell us more about dns failover sir? what software needed to make dns failover?

    Thanked by 1abu3beid
  • @serv_ee said: Thought this forum had a rule about being a dickhead.

    Be one or you'll not fit in? :)

    Thanked by 1abu3beid
  • serv_eeserv_ee Member
    edited September 26

    @MeAtExampleDotCom said:

    @serv_ee said: Thought this forum had a rule about being a dickhead.

    Be one or you'll not fit in? :)

    No argument there, I can be a dick quite often but never when someone asks for help.

    Thanked by 1abu3beid
  • Appreciate OP for asking just keywords that can be searched online instead of expecting to be spoon fed.

  • @ariq01 said:
    could you tell us more about dns failover sir? what software needed to make dns failover?

    i think it's easy with Cloudflare, check this blog

    https://blog.cloudflare.com/introducing-load-balancing-intelligent-failover-with-cloudflare/

  • @serv_ee said:
    No idea why some of you gave him shit for trying to learn new things. Like you were born with this knowledge already.

    Thought this forum had a rule about being a dickhead.

    Who gave him shit? I see no such posts above yours. He got help from several people. Next time, reply quote so people know what you're talking about. I have no idea unless posts were deleted.

    Thanked by 1abu3beid
  • @ariq01 said:

    @Liso said:
    Database: SQL replication
    System file: DRBD or lsyncd
    Domain: DNS failover

    could you tell us more about dns failover sir? what software needed to make dns failover?

    My setup consist of ping test using monit and cloudflare script I modify a bit from @mwt script. It works pretty neat, below is when the failover take place (/opt/cf_switch/cf.sh takes care of dns change to cloudflare api).

    Sep 27 11:57:17 vps4 monit[340693]: Ping response for xxx.xxx.xx.xx 1/5 timed out -- no response within 3 s
    Sep 27 11:57:20 vps4 monit[340693]: Ping response for xxx.xxx.xx.xx 2/5 timed out -- no response within 3 s
    Sep 27 11:57:23 vps4 monit[340693]: Ping response for xxx.xxx.xx.xx 3/5 timed out -- no response within 3 s
    Sep 27 11:57:26 vps4 monit[340693]: Ping response for xxx.xxx.xx.xx 4/5 timed out -- no response within 3 s
    Sep 27 11:57:29 vps4 monit[340693]: Ping response for xxx.xxx.xx.xx 5/5 timed out -- no response within 3 s
    Sep 27 11:57:29 vps4 monit[340693]: 'my.site.xyz' ping test failed
    Sep 27 11:57:31 vps4 monit[340693]: 'my.site.xyz' exec: '/opt/cf_switch/cf.sh site.xyz ujian'
    

    Completely free, all you have to do is sign up for free cf account.

    Thanked by 2abu3beid mwt
Sign In or Register to comment.