This guide explains how to migrate your PerPlayerKit data between different storage backends.
PerPlayerKit supports the following storage backends:
| Type | Description | Use Case |
|---|---|---|
sqlite |
Local SQLite database file | Default, good for single-server setups |
mysql |
MySQL/MariaDB database | Multi-server setups, larger deployments |
redis |
Redis key-value store | High-performance, distributed setups |
yml |
YAML flat file | Development/testing only (not recommended for production) |
To migrate data between storage types, use the following command:
/perplayerkit migrate <source> <destination>
Examples:
/perplayerkit migrate sqlite mysql- Migrate from SQLite to MySQL/perplayerkit migrate mysql redis- Migrate from MySQL to Redis/perplayerkit migrate redis sqlite- Migrate from Redis to SQLite
Permission: perplayerkit.admin
-
Backup your data - Always create a backup before migrating. For SQLite, copy the
database.dbfile. For YAML, copy theplease-use-a-real-database.ymlfile. -
Configure the destination - Make sure the destination storage is properly configured in your
config.ymlbefore migrating. For example, if migrating to MySQL, ensure your MySQL credentials are set:mysql: host: "localhost" port: 3306 dbname: "perplayerkit" username: "your_username" password: "your_password" useSSL: false maximumPoolSize: 10
For Redis:
redis: host: "localhost" port: 6379 password: ""
-
Ensure connectivity - Test that you can connect to the destination database/service.
-
Run the migration command with the source and destination types.
-
The migration runs asynchronously to avoid server lag. Progress updates will be shown in chat and logged to the console.
-
Wait for the "Migration completed successfully!" message.
-
Update your config.yml - Change the
storage.typesetting to your new storage type:storage: type: "mysql" # Change this to your new storage type
-
Restart the server - The plugin needs to restart to use the new storage backend.
After restarting:
- Check the console for any storage connection errors.
- Test that player kits load correctly.
- Test that saving kits works.
- Verify public kits are accessible.
- Verify your database credentials in
config.yml - Ensure the database server is running and accessible
- Check firewall rules if connecting to a remote database
- Check the console logs for any errors during migration
- Verify the migration completed successfully (check for the completion message)
- Ensure you updated
config.ymlto use the new storage type before restarting
- If some entries failed to migrate, check the console for specific error messages
- You can run the migration again - existing entries will be overwritten
If you need to roll back to your previous storage:
- Change
storage.typeinconfig.ymlback to your original storage type - Restart the server
Your original data should still be intact (the migration copies data, it doesn't delete from the source).
- The migration process copies data from source to destination. It does not delete data from the source.
- Large datasets may take some time to migrate. Progress updates are provided every 100 entries.
- The server remains functional during migration, but avoid making changes to kits while migrating.
- For very large datasets, consider performing the migration during low-traffic periods.