Duplicating MySQL Database Elements Across Multiple Servers

Hello everyone,

I’m currently in the process of developing ways of storing certain things from my servers into databases. I’m attempting to store things such as bans, user groups, punishment levels, and stuff like that in a database that will be linked to multiple servers. My attempt is to duplicate and store those same properties across all the servers using the database as a middle agent. I’ve been able to add things that change on one server onto the database so far. So lets say we update someones rank on a server, I’m able to also upload that change and store it to the database. However, I’d like all the other servers connected to the database to have that same change applied if the database is updated. I’m yet unable to figure out a way to make that happen. So basically, my issue is I’m trying to figure out how to make a server realize that the database has been updated so that it can apply that same change on its end. I’m fairly new to databases and using them for server properties, so if anyone has attempted something like this before, please leave some insight so that I might be able to learn how to make this kind of thing work. Thank you for reading.

Just grab the info on player spawn. Like “SELECT * FROM users WHERE steamid = '”…id…"’"

You should only be querying the database when you need information from it, or when you want to update its information; it isn’t a constant stream of data back and forth from server to database. Like crazyscouter said, once you update information from one place, all other connected sources have access to this new information.

What changes are you looking to apply on each server’s end, exactly?

He said it already, he wants a “global ranking” system, OP look into the “Globalban” addon, it got a refresh interval included, just use that.

Actually if he wants to go the whole 9 yards, he could create sockets on the servers, and create a protocol by which servers could ping each other when the MySQL information is updated, so you don’t try and update the SQL when nothing’s changed.

Like I said, I can store things into a database and retrieve them when I want to. And that would work fine with a single server. But if I have multiple servers, I need a way for all of them to know that some information has been updated. That way it stays consistent across all of them. I’ve seen a lot of plugins that say they do that, but a lot of them also seem to be outdated, so I’ve been attempting to add this functionality myself. I guess I could just query the database and compare every so often, but it’d be nice to not have to query if there’s nothing to update.

[editline]28th July 2015[/editline]

You’re right, once the database has been updated, all the servers have access to that information. However, if you server updates the database, how do the other servers know that there is new information that they need to grab? That’s what I’m trying to figure out. I suppose for things like user groups and punishments, I can just have it query the database when a player joins, but I’m not sure how to go about doing it for bans since a lot of the code dealing with bans seems to be inaccessible for modification. Unless I’m mistaken about that?

You could create a FCVAR_SERVER_CAN_EXECUTE concommand that updates the server’s mysql cache and call it via rcon from the other servers automatically?