Answer the question
In order to leave comments, you need to log in
How to implement automatic transition when the VPS server crashes?
The question is simple, but I haven’t seen any recipes - what should I do if VPS suddenly fell (or blocked)
Well, maybe this will happen, I forgot to pay, or an evil zoster turned off your VPS - what to do, and you warm your belly at sea?
There are some troubles in nature for such or similar cases.
Thanks
Answer the question
In order to leave comments, you need to log in
I have been dealing with this issue for a month and a half, and for more than a month one online store has been working on an already made decision.
In short:
- two KVM VPS in different data centers (400 - 700 rubles apiece)
- nginx: 80 -> apache: 8080
- Mysql master-master
replication - file replication via clsync
- config replication (nginx, apache, php, ssl, postfix) via clsync
- work with configs only on 1 server. SSL update only on 1 server
- replication of php sessions via memcachedrep
- DNS round-robin, 2 A records
- all nginx traffic is directed only to 1 server, the second is marked as backup
- add monitoring via zabbix to everything you have to see what and how works
- you can also use DNS hosting with API to remove inaccessible ip from DNS output via zabbix.
Example: one of the servers is unavailable/offline.
If you check how DNS round-robin works, you will notice the following algorithm:
1) the browser connects to 1 given ip
2) tries to connect within 2 - 2.5 seconds
3) if it fails, then connects to the next ip
4) because 1 server is unavailable, then nginx switches to its internal apache and works with it
PROFIT!
If you are interested, please contact me, I will tell you https://t.me/konstantinti
If you need to do it all completely from and to, please contact me, I will do it.
There are solutions, but they cost money and labor.
A few examples:
1) Several servers from different hosts, load balancing with Cloudflare or Incapsula or the like.
Expensive, plus you have to set up data replication if the site is not static.
2) AWS/GCP/Azure - multiple servers in different availability zones and/or regions, and loadbalancer and DNS.
Again - data replication.
To discuss the options more specifically, you need to understand what kind of site you have.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question