Difference between revisions of "Database backends"
ROllerozxa (talk | contribs) |
|||
Line 94: | Line 94: | ||
| style="text-align: center" | ✔ | | style="text-align: center" | ✔ | ||
| style="text-align: center" | ✔ | | style="text-align: center" | ✔ | ||
− | | | | + | | style="text-align: center" | ✔ (5.7.0+) |
|- | |- | ||
| Dummy | | Dummy |
Revision as of 18:36, 10 January 2023
Language: | English • français |
---|
Minetest supports several database backends. This page provides a comparison of all backends.
There are four database backends in Minetest (since 5.6.0):
- Map
- Players
- Authentication
- Mod Storage
Map backend
The database backend is set using the backend
setting in world.mt. Put the name of the backend in lowercase as the value of the setting (e.g. backend=sqlite3
for SQLite3).
If you want to migrate a world map to a new backend, use minetestserver --migrate <name of new backend> --world <path to your world directory>
. It will automatically update world.mt to reflect the new backend.
If using a client build, server instructions can be given using "minetest --server
", e.g. minetest --server --migrate <name of new backend> --world <path to your world directory>
.
Player backend
The database backend is set using the player_backend
setting in world.mt. If it doesn't exist, the default is files.
If you want to migrate players to a new backend, use minetestserver --migrate-players <name of new backend> --world <path to your world directory>
. It will automatically update world.mt to reflect the new backend.
Authentication backend
The database backend is set using the auth_backend
setting in world.mt. If it doesn't exist, the default is files.
If you want to migrate the authentication data to a new backend, use minetestserver --migrate-auth <name of new backend> --world <path to your world directory>
. It will automatically update world.mt to reflect the new backend.
Mod Storage backend
The database backend is set using the mod_storage_backend
setting in world.mt. If it doesn't exist, the default is files.
If you want to migrate mod storage to a new backend, use minetestserver --migrate-mod-storage <name of new backend> --world <path to your world directory>
. It will automatically update world.mt to reflect the new backend.
Comparison table
Backend | Speed | Reliability | Compatibility with builds | Map | Players | Authentication | Mod Storage |
---|---|---|---|---|---|---|---|
SQLite3 |
Good |
Acceptable (problems can arise with concurrent accesses) |
Very good (always supported) |
✔ | ✔ | ✔ | ✔ |
LevelDB |
Good |
Good |
Mostly supported |
✔ | ✔ | ✔ | |
Redis |
Very good (data kept in RAM) |
Good |
Inconvenient (Redis server required) |
✔ | |||
PostgreSQL |
Very good (most used data are in memory, others from disk) |
Very good |
Inconvenient (PostgreSQL server required) |
✔ | ✔ | ✔ | ✔ (5.7.0+) |
Dummy |
Blazing fast |
N/A (nothing is saved to disk) |
None (nothing is saved to disk) |
✔ | ✔ | ||
Files (deprecated) |
Bad |
Bad |
Deprecated (support may be removed) |
✔ | ✔ | ✔ |
The Compatibility with builds column is only relevant if you want to distribute the worlds.
SQLite3
SQLite3 is the default backend for all Minetest worlds, it is supported by every Minetest build and is therefore the standard database format that is used to distribute worlds.
LevelDB
LevelDB is mostly used on servers because of its improved reliability and possibly speed. You need to install it additionally.
Redis
Redis support was added to Minetest in April 2014, Redis is mainly useful for servers as it allows multiple worlds to be stored in one Redis instance. You need to install it additionally (libhiredis library).
Information about setting up a Redis server can be found here: https://redis.io/topics/quickstart
world.mt settings for Redis
redis_address
-- The IP or hostname of the redis server.
redis_port
-- The port of the redis server. Optional, default: 6379
redis_hash
-- Hash where the MapBlocks are stored in, if you want multiple worlds in one redis instance this needs to be different for each world. If you don't need that you can use e.g. IGNORED
.
PostgreSQL
PostgreSQL support was added to Minetest in May 2016, it's mainly useful for servers as it allows multiple worlds in a single instance, in multiple databases.
PostgreSQL is an excellent alternative to Redis. It doesn't store all data in memory, only recent and frequent data is loaded into memory. All data is on disk storage and data storage is very robust. You can also easily interface a website in front of your database to offer a frontend to your users.
While we support older versions, it is recommended to use PostgreSQL 9.5 at least.
To improve PostgreSQL's performance with Minetest servers, please configure postgresql.conf
with a minimum shared_buffer
of 512MB, with a maximum of 50% of your server's available RAM.
world.mt for PostgreSQL
pgsql_connection
-- PostgreSQL connection string for world map | host=<db_host> user=<db_user> password=<db_password> dbname=<db_name>
pgsql_player_connection
-- PostgreSQL connection string for players | host=<db_host> user=<db_user> password=<db_password> dbname=<db_name>
Dummy
A dummy database backend, which stores all MapBlocks in RAM without saving them. This means, as soon the server shuts down or you leave in singleplayer, all changes made to the world are lost. When you re-join, the world will be re-generated from scratch.
This backend is not widely used, but is used by servers which don't need a persistent map — for example, Capture the Flag.
Files
A legacy backend for player and authentification data. Everything is stored in plaintext files. It's slow, unreliable and clunky. Use of this backend is discouraged now and it's possible this backend will be removed in the future.
For mod storage, Files uses the legacy JSON-based storage method as opposed to a regular database system. It is slower and will keep the entire mod storage data in memory.