Few connections to database

Started by vito, Nov 18, 2016, 01:59 AM

Previous topic - Next topic

vito

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

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

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

Quote from: vito on Nov 18, 2016, 09:19 AMHow 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

.

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

#5
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.