Guida Metin2 HA cluster

Stato
Discussione chiusa ad ulteriori risposte.

iltizio

Utente Emerald
1 Novembre 2009
927
60
533
598
Ultima modifica da un moderatore:
Ciao,
posto anche qui la mia guida, nella speranza che ci sia ancora qualcuno in italia che voglia fare un server come si deve senza prendere in giro i propri utenti.

Hi all,

In this “how to” I’m explaining to you what is a cluster, why it’s important and how to applicate to Metin2 server to grant High Availability.
If you grant the High Availability correctly, you will have a very high uptime, very close to 100% and you can make maintenance safely, without taking the game offline for more than 5 minutes.

High Availability
A good service need to be always available for users. There is no excuse; in any case, your application must be always available and fully functional for your users.
Manteinance, human errors, force majeure, hardware and software problems must not include a disservice, called “downtime”.
So, you will need to ensure that your services are High Availability.
Today, there are a lot of ways to make an application “High Available”, and it’s not necessary to pay a lot.
To deepen the discussion, read the corresponding wikipedia page https://en.wikipedia.org/wiki/High_availability

Cluster
To make your service High Available, you’ll need to put your applications on a cluster.
A cluster is a group of systems that do the same thing. This is necessary to always have at least a working system, if another fails. So you need to create at least 2 machines with the same data and software, synchronized between them, with the appropriate software and techniques.
To deepen the discussion, read the corresponding wikipedia page https://en.wikipedia.org/wiki/Computer_cluster

So, for which application I need a cluster?
To run a Metin2 server, you will need a webhost for your website, a patch server for your client updates, a mysql server (Oracle MySQL, MariaDB, Percona) and a Metin2 game server.
All of this servers could be clustered. For webhost, patch server (similar to webhost, but only with the webserver like apache or nginx) and MySQL server you will find a lot of type of cluster and many guide to implement it. Choose what you prefer.
The best type of cluster for that servers are Active-Active balanced cluster:

MCSt-nWAPoaM0FfyIdGdxl5ny-xolOlHjRXqKX6SShNFymqbPmI3FVPeKDdZ85aM6lisMNqkxEtFTUVXJVQ3Dz3LPaEF3FDBHw-jUdRkdGgGRzyqYjnTu5ZJJd_x0XStm1FYmqKt

This picture explain how to made an Active-Active balanced cluster for webhost, patch server but also for MySQL server, with multi-master replication.

So, you need 2 or more machine for MySQL, webhost and patch server, 2 load balancer (or a cheapest DNS balancer) and a failover IP or failover dns.
With this configuration, customers or applications will connect to your active load balancer (pointed by a failover IP or domain name) that divides traffic into each node of cluster. This is a double advantage: you can increase the performance and the availability. When you need shutdown a node, or just a problem, you will have another node ready, without disservice and without any manual change. While, when you have all the node up&running, you can use the power of each node in the same time.

Webhost & patch server
Webhost and patch server are easy to configure: you need only to configure the filesystem replication on each machine. You need only the document root syncronized for each machines and point your domain to your load balancer. You can user the simple rsync, a NFS server (obligatorily in HA

MySQL
For MySQL, it’s a little bit complicated. The data in the databases are changed very frequently and must be accessible in the same ways for each node. So you need a special cluster created specially for your RDBMS.
Each RDBMS have its cluster software. All of this RDBMS is compatible with Metin2 game server (mysql or mysql fork):
With those multi-master replication, you can connect your application (website, game server) on a load balancer and take advantage of multiple MySQL servers.

E4SVyUiqLrZV7o48fsCDD8TmDzMivWYAcnuIkIJOS78qa_7CZj9OfGlwCcjqw6keG77F_H8SEcf_qMIyxMY_uW2lnyZIEsENU9Nbm7VC_EefCWHSCJJMPevPphstZOlsm5LV0Z_P

Metin2 game server
Now you are ready to configure your metin2 game server cluster. After configured MySQL cluster server, and connected correctly to your webhost and game server, you have to find a technique to maintain your server files updated from your changes and guild flags (mark).

For metin2, we can’t create an Active-Active balanced cluster, like webhost or mysql. We need to create an active-passive cluster, because all players need to be connected on the same host, for a limitation of Metin2. So there will be only one active node, that they will use your users, and one or more passive node, started but unreachable from player. In this configuration you can’t balance the traffic, but in case of DDoS, you can switch to the secondary node (that become active) and continue the service. Be careful! This is not a method to block DDoS attacks! Choose a good DDoS protection.

To sync your file server, I suggest you to use rsync. It’s easy to configure and light.
Configure at crontab an rsync command to copy personalized guild flags on mark directory for each node of cluster. In this case, you don’t need to use the --delete option.
For the remaining part of fileserver, it’s sufficient to add on your administration panel a function that sync your changes on other nodes. Use rsync with --delete option and be sure to make a sync every time you make a change. After resync, it could be necessary to restart game server on passive node first (to check if there are some problem and to prepare the node for switch), and nextly, after a graceful shutdown from game, you can restart your active game server to apply the changes.

Be careful when you create rsync command and when you use it. If you use --delete option, you could erase some important data.
When you create the rsync command, choose the correct options and exclude files that you don’t need to sync, like logs, pid etc.

The last things is to manage the switch automatically and also manually. The cheapest and easiest way is to buy a failover dns service, that switch automatically the assignment of domain name to active game server IP. You can use DynDNS managed dns, DNS Made Easy Failover, Incapsula Load balancing/failover.

This is the best final solution:

wo1KgI9sWZalSi47RY0x-b3jRF2w9GcSI9nq1fuwhGY2V0d2Y5n5qzqRRVNpri9JAfpZRTGZlJts5IPrlUuVu9uoJMiwV9r4ibMrbSqgFh2S4WExr2dBd5vTC0NrlwQhhAQulOwe



This is only an example; you can personalize based on your competence, time and money.
You can buy different VPS and load balancer, or you can take 2 (or more) dedicated server with an hypervisor to create much VM.
To grant the best of availability, you should assign Site 1 to a different datacenter than Site 2, if it’s possible on different city.

Costs
The High Availability could be more expensive than a single powerful machine, but it’s not properly true.
With double servers you can permit to buy cheapest machines. So the price is not always doubled.
Take load balancer from cloud provider or take DNS load balancer plan from DynDNS managed dns, DNS Made Easy Failover, Incapsula Load balancing/failover.
You can also took webhost and patch server from a shared hosting provider, to save something.
To help you to choose the best provider for your, visit this list: Lista Hosting per Metin2

Conclusion and tips
This configuration could be difficult and more expensive to implement and maintain, but if you choose the best solution, you can optimize all, and pay the same that you pay before.
It’s most important to configure correctly all the systems to optimize the machines and pay less. Find some expert to help you, and you could pay less and increase the quality.
Create a test system. In this way, you can test all the thing on safely before commit on production. You can do software maintain for maximum of 5 minutes.

Do the best for your users and you will be rewarded.
 
Stato
Discussione chiusa ad ulteriori risposte.