Database & Redis

Setting up storage backends and multi-server Redis synchronization.

Database Backends

mineTeams supports four storage backends. Teams and player profiles use the same engine.

database:
  database-type: H2
  hostname: "localhost"
  base: "mineTeams"
  port: 3306
  username: "root"
  password: "securepass"
TypeBest forNotes
H2Single server, testingDefault embedded database
MYSQLProduction multi-serverShared SQL storage
MONGODBDocument-oriented productionHost/port/user/password auth
FLATSimple file storageYAML files on disk

H2 (Default)

No external service required. Data is stored under the plugin data folder.

database:
  database-type: H2

Warning: Do not use H2 for multi-server networks. Each server would keep a separate database. Use MySQL or MongoDB with Redis.

MySQL

database:
  database-type: MYSQL
  hostname: "localhost"
  base: "mineTeams"
  port: 3306
  username: "root"
  password: "securepass"

Uses HikariCP connection pooling.

MongoDB

database:
  database-type: MONGODB
  hostname: "localhost"
  base: "mineTeams"
  port: 27017
  username: "root"
  password: "securepass"

Connects with username/password credentials against the configured database name.

FLAT (YAML)

database:
  database-type: FLAT

Stores entities as YAML files. Suitable for small communities or debugging; not recommended for large networks.

Stored Data

EntityContents
TeamTag, name, leader, members, deputies, slots, base, friendly fire, created/expires timestamps
ProfileUUID, username, statistics (kills, deaths, assists, ranking), team-chat toggle, abuse-related state

Access always goes through TeamService / ProfileService (cache). Direct DAO use is internal only.

Redis Synchronization

Optional multi-server sync for teams, profiles, and team chat.

redis:
  enable: true
  host: "127.0.0.1:6379"
  password: "strongPass"
  server-id: "survival-1"
OptionDescription
enableTurn Redis pub/sub on
hosthost:port of Redis
passwordRedis AUTH password
server-idUnique id of this Minecraft server instance

Topics

TopicMessagePurpose
Team synchronizeTeamSynchronizeMessagePropagate team create/update/delete
Profile synchronizeProfileSynchronizeMessagePropagate profile/ranking changes
Chat synchronizeChatSynchronizeMessageCross-server team chat

How It Works

  1. Local mutation updates the in-memory cache
  2. When Redis is enabled, a message is published
  3. Other servers apply the update to their cache without re-publishing (loop prevention)
  4. Handlers may run off the main thread — do not assume sync on the primary thread in custom forks

Multi-server checklist

  1. Shared MySQL or MongoDB for all game servers
  2. Shared Redis with enable: true
  3. Distinct server-id per instance
  4. Same plugin version and compatible configs across the network

Single-server vs Multi-server

SetupDatabaseRedis
One serverH2 / MySQL / Mongo / FLATOff
NetworkMySQL or MongoDBOn

Troubleshooting

IssueCheck
Data not shared across serversShared DB + Redis enabled + unique server-id
Connection refusedHostname, port, firewall, credentials
Stale ranking topsRanking calculation task running; Redis profile sync healthy
Teams missing after switch to MySQLMigrate data; empty DB starts clean