DOCS berries.games ↗

Cross-server

Every server that points at the same MySQL or MariaDB database shares one order book: an order placed on survival-1 can be filled on survival-2, and the buyer collects on whichever server they're on.

Set it up

On every server:

  1. databases.yml:
    type: "mysql"
    mysql:
      host: db.example.com
      port: 3306
      database: "berryorders"
      user: berryorders
      password: "..."
    
  2. config.yml:
    cross-server-support: true
    server-name: "survival-1"   # different on each server
    
  3. Optional, for instant updates, databases.yml:
    redis:
      enabled: true
      host: "localhost"
      port: 6379
    
  4. Restart.

How it stays safe

The database decides every delivery, cancel, expiry and collect, in one transaction that only succeeds once. Two players on two servers filling the last 10 slots of an order at the same moment: one gets them, the other gets their items back. Nobody is paid twice and no order is over-filled. This doesn't depend on Redis.

Money is paid on the server the player is on. Refunds and payouts for players who are offline or on another server wait in the database and are paid the moment they're online.

With or without Redis

Without Redis With Redis
New orders and deliveries show on other servers within poll-seconds (3) instantly
"Bob delivered to your order" when you're on another server when you next join a server instantly
Safety the same the same

Economy balances are your economy plugin's business. If each server has its own balances, players are paid on whichever server they collect or deliver on.