Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Recommended Posts

Hello everyone,

In this guide, I’ll walk you through what a cluster is, its significance, and how to implement it for your Metin2 server to ensure High Availability (HA). By achieving proper HA, you can maintain an uptime nearing 100%, allowing you to perform maintenance without taking your game offline for more than 5 minutes.

Understanding High Availability

A reliable service must remain consistently available to its users. There are no exceptions; your application must function flawlessly at all times. Maintenance, human errors, unforeseen events, and both hardware and software issues should not result in a downtime, which is referred to as “downtime.”

To prevent this, you must ensure your services maintain High Availability.

Today, there are various methods to make an application HA, and you don’t need to invest a fortune to achieve it. For more in-depth information, you can visit the relevant

This is the hidden content, please
.

What is a Cluster?

To achieve High Availability, your applications must be part of a cluster. A cluster is essentially a group of systems that work together to perform the same tasks. This setup ensures that at least one system remains active, even if another fails. You will need to create at least two machines equipped with the same data and software, synchronized between them, using the appropriate techniques.

For additional information, refer to the

This is the hidden content, please
.

Applications Requiring a Cluster

To operate a Metin2 server, you will need several components: a web host for your website, a patch server for updates, a MySQL server (options include Oracle MySQL, MariaDB, or Percona), and a Metin2 game server.

All of these servers can be clustered. For the web host and patch server (similar to a web host, but only functioning as a web server like Apache or Nginx) as well as the MySQL server, you will come across various types of clusters and guides on how to set them up. Choose the one that suits your needs best.

The ideal clustering approach for these servers is an Active-Active balanced cluster:

Active-Active Cluster

This diagram illustrates how to establish an Active-Active balanced cluster for web hosting, patch servers, and MySQL servers with multi-master replication.

To implement this, you will need at least two machines for your MySQL, web host, and patch server, along with two load balancers (or a more affordable DNS balancer), and a failover IP or DNS.

With this configuration, clients or applications will connect to your active load balancer (designated by a failover IP or domain name), which distributes traffic across each node in the cluster. This setup has dual benefits: it enhances both performance and availability. When a node needs to be taken offline, or if problems arise, another node is prepared to take over without any service interruption. When all nodes are operational, you can utilize the combined power of each node simultaneously.

Configuring Webhost and Patch Server

Setting up the web host and patch server is relatively straightforward—just configure file system replication across each machine. You need to ensure the document root is synchronized on all machines and point your domain to your load balancer. You can use simple tools like rsync or set up an NFS server (which must be configured in HA).

MySQL Configuration

Configuring MySQL can be more complex. Since data within your databases changes frequently, it must be accessible uniformly across all nodes. For this, you need specialized clustering software tailored for your RDBMS.

Each RDBMS has its own cluster software that is compatible with the Metin2 game server (both MySQL and its forks):

  • Oracle MySQL: This is the original MySQL RDBMS owned by Oracle, and its cluster software is known as MySQL Cluster.
  • MariaDB: A fork of MySQL developed by the original MySQL developers prior to Oracle’s acquisition. Its clustering software is called Galera Cluster, which is installed by default starting from MariaDB 10.1. For installation guidance, see this
    This is the hidden content, please
    .
  • Percona for MySQL: An enhanced MySQL alternative designed for better performance, utilizing XtraDB instead of the older InnoDB storage engine. Its clustering solution is known as Percona XtraDB Cluster.

With these multi-master replication setups, your applications (like your website and game server) can connect through a load balancer, benefiting from multiple MySQL servers.

MySQL Cluster Setup

Configuring the Metin2 Game Server

Now that your MySQL cluster server is configured and appropriately connected to your web host and game server, the next step is to synchronize your server files and guild flags.

For Metin2, it is essential to establish an Active-Passive cluster instead of an Active-Active one. This limitation arises from the need for all players to be connected to a single host. Therefore, only one node remains active for users, while one or more passive nodes are running but unreachable to players. Although this setup does not allow you to balance traffic, it provides the option to switch to a secondary node in case of a DDoS attack (which becomes active during the switch). However, this method is not a solution for DDoS attacks—consider implementing robust DDoS protection.

For file server synchronization, I recommend using rsync for its ease of configuration and efficiency. Set up a cron job for rsync commands to update customized guild flags in the designated directory for each cluster node. In this scenario, avoid using the --delete option.

For other files on the server, implement a synchronization function within your administration panel that propagates your changes to the additional nodes. Use rsync with the --delete option to ensure your files are current, but make sure to restart the passive node first before gracefully shutting down the active game server to apply changes.

Be careful when crafting your rsync commands. Using the --delete option can lead to the unintentional erasure of critical data. Make sure to choose the appropriate options and exclude files you do not wish to sync, such as logs or PID files.

Lastly, manage the node switching automatically as well as manually. The simplest and most cost-effective method is to use a failover DNS service that automatically updates domain assignments to redirect to the active game server IP. Services like DynDNS, DNS Made Easy, and Incapsula provide DNS load balancing and failover solutions.

This is an example of a final solution:

Final Solution Example

Remember, this is just a starting point; feel free to adapt it based on your skills, resources, and budget. You may opt for different VPS and load balancer options or acquire two (or more) dedicated servers with a hypervisor to create multiple VMs.

To ensure optimal availability, it’s ideal to place Site 1 in a different data center than Site 2, ideally in another city if possible.

Cost Considerations

High Availability might seem more costly compared to a single powerful machine, but that’s not entirely true. By using dual servers, you can opt for more affordable hardware. Thus, the expenses may not necessarily double.

You can obtain load balancing solutions from cloud providers or explore DNS load balancer plans from services like DynDNS, DNS Made Easy, or Incapsula.

Additionally, you may consider using shared hosting for your web host and patch server to save costs.

To find a suitable provider for your needs, you can check out this list of hosting providers for Metin2:

 

This is the hidden content, please

 

Conclusion and Recommendations

While implementing and maintaining this configuration can be challenging and potentially more expensive, if you make informed choices, you can optimize performance and maintain costs similar to what you currently incur.

The key is to configure all systems correctly to get the best machine performance at a lower cost. Seek the expertise of specialists to enhance your setup, which can also help you reduce expenses while improving service quality.

Establish a testing environment to ensure you can validate all changes safely before deploying them in production. Ideally, you should be able to perform maintenance in less than 5 minutes.

Put forth your best effort for your users, and they will surely reward you.

Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...