Setup
Features
- 🖥️ Commands
- ✅ Sync Features
- ⚙️ Sync Modes
- ↪️ Data Rotation
- ❓ FAQs
Guides
- ↗️ Legacy Migration
- ✨ MPDB Migration
- ☂️ Dumping UserData
- 🟩 Plan Hook
- 📋 Event Priorities
- ⚔️ Keep Inventory
- 🎏 Translations
HuskSync offers two built-in synchronization modes that utilise Redis and MySQL to optimally sync data as users change servers (illustrated below). These sync modes change the way data is synced between servers, and can be changed in the config.yml
file.
LOCKSTEP
sync mode is the default sync mode. It uses a data checkout system to ensure that all servers are in sync regardless of network latency or tick rate fluctuations. This mode was introduced in HuskSync v3.1, and was made the default in v3.2.DELAY
sync mode uses the network_latency_miliseconds
value to apply a delay before listening to Redis dataYou can change which sync mode you are using by editing the sync_mode
setting under synchronization
in config.yml
.
Warning:Please note that you must use the same sync mode on all servers (at least within a cluster).
synchronization:
# The data synchronization mode to use (LOCKSTEP or DELAY). LOCKSTEP is recommended for most networks. Docs: https://william278.net/docs/husksync/sync-modes
mode: LOCKSTEP
The LOCKSTEP
sync mode works as described below:
DATA_CHECKOUT
key is present.
DATA_CHECKOUT
key.DATA_UPDATE
key.
DATA_UPDATE
key is present, the user's data will be set from the snapshot deserialized from Redis contained within that key.DATA_UPDATE
key. After this key has been set, the user's current DATA_CHECKOUT
key will be removed from Redis.Additionally, note that DATA_CHECKOUT
keys are set with the server ID of the server which "checked out" the data (taken from the server.yml
config file). On both shutdown and startup, the plugin will clear all DATA_CHECKOUT
keys for the current server ID (to prevent stale keys in the event of a server crash for instance)
LOCKSTEP
has been the default sync mode since HuskSync v3.2, and is recommended for most networks.
The DELAY
sync mode works as described below:
SERVER_SWITCH
key is immediately set on Redis, followed by a DATA_UPDATE
key which contains the user's packed and serialized Data Snapshot.network_latency_miliseconds
value (default: 500ms) to allow the source server time to serialize & set their key.SERVER_SWITCH
key.
DATA_UPDATE
key; when read, their data will be set from the snapshot deserialized from Redis.If your network has a fluctuating tick rate or significant latency (especially if you have servers on different hardware/locations), you may wish to use LOCKSTEP
instead for a more reliable sync system.