Jump to content
  • 0

Ping Server(s)


rusztamas

Question

Hi!
I have 3 Linux-based physical servers, that are available to use.
To equalize the load between them, I have the following plan:
Server #1 is the game server.
Server #2 is the database server.
and Server #3 will be a secondary database server.

The SQL data is shared between server #2 and #3. But on server #3 other things are running too. I want to make the following script:
Server #1 pings Server #2, and if it would return nil or false, or just simply a too high delay, Server #3 would do the SQL query.
It may sound a bit foolish to you, but this is for practice for me. Can you help me with the function, that pings given ip addresses, and if there is packet loss or too high delay(250+ms) it would return nil or false? Yours, faithfully. 

Link to comment

1 answer to this question

Recommended Posts

  • 0

There is no "ping" function in MTA. An ugly hack would be to use fetchRemote to measure the time till a web server (running on server #2/3) answers.

Also, a problem is that you would have to manually sync both database servers then. Instead, using MySQL's built in replication stuff (https://dev.mysql.com/doc/refman/5.7/en/replication.html) would be much better in combination with always load balancing queries.

Generally speaking, it's very unlikely that the database servers reaches its limits with MTA. The game server is much more prone to that.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...