Few connections to database

vito

  • Sr. Member
  • Posts: 405
Few connections to database
« on November 18th, 2016, 01:59 AM »
Hello. I m going to use one account system for few servers on linux vps. So how to do it correctly? Also how to make connection/bridge between few servers at one host? (to show who online at other servers, for example)

KAKAN

  • Wiki Contributor
  • Posts: 3,343
Re: Few connections to database
« Reply #1, on November 18th, 2016, 08:26 AM »
You can do it using a MySQL database. That's one of the trur purpose of MySQL db, i.e, it can handle multiple connections and work as expected. For the player list thingy, i think you will need to write the names to a file, open that file from another server, then... I don't really recommend using a db for that purpose. You can Sockets too, but it might crash the server and won't give any error log too.
oh no

vito

  • Sr. Member
  • Posts: 405
Re: Few connections to database
« Reply #2, on November 18th, 2016, 09:19 AM »
How to use sockets for that? Using hdd/sdd is too slow. I want to use few cross-servers events so I need less lags system.

KAKAN

  • Wiki Contributor
  • Posts: 3,343
Re: Few connections to database
« Reply #3, on November 18th, 2016, 01:17 PM »
Quote from vito on November 18th, 2016, 09:19 AM
How to use sockets for that? Using hdd/sdd is too slow. I want to use few cross-servers events so I need less lags system.
If you can make another HTTP server which can send/receive requests, then you can do that. My thinking is pretty simple, but doing it with Squirrel is difficult. I thought like:-
VCMPServer #1 ->( Sends data to ) A other HTTP/MQTT server( MQTT would be better but its not supported. )
HTTP server ->( Sends data to ) VCMPServer #2, #3 and so on.
Much like IRC.
oh no

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,808
Re: Few connections to database
« Reply #4, on November 18th, 2016, 01:30 PM »
Simple. You could use Sockets to implement a BUS communication pattern. But that might be out of your league.

Simpler approach if they're all your servers. Use a shared table in a MySQL database where each server would posts commands in that table and to which server was that command addressed if not to all. And then each server would periodically query that table (like every second for example) and select commands. I would suggest that you create an in-memory table for an efficient storage.

Either way, this feature might out of your league regardless of how you look at it.
.

vito

  • Sr. Member
  • Posts: 405
Re: Few connections to database
« Reply #5, on November 18th, 2016, 01:34 PM »Last edited on November 18th, 2016, 01:41 PM
Eh, then I can just use irc only. So is it not possible to connect servers directly?

Edit: Yep I had idea to use database for events or even as http bridge for vc-mp. But it looks as dirty trick.