Database backends

From Minetest Wiki
Jump to: navigation, search

Minetest supports several database backends. This page provides a comparison of all 4 (actually 5, but the dummy backend generally isn't useful) backends.

There are two database backends in Minetest (since 0.4.16)

  • Map
  • Players


Contents

Map backend

The database backend is set using the backend setting in world.mt.

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>.

Player backend

The database backend is set using the player_backend setting in world.mt.

If you want to migrate players to a new backend, use minetestserver --migrate-players <name of new backend> --world <path to your world directory>.


Comparison table

Backend Speed Reliability Compatibility with builds Map Players
SQLite3

Good

Acceptable (problems can arise with concurrent accesses)

Very good (always supported)

X X
LevelDB

Good

Good

Mostly supported

X
Redis

Very good (data kept in RAM)

Good

Inconvenient (redis server required)

X
PostgreSQL

Very good (most used data are in memory, other are fetched from disk)

Very good

Inconvenient (PostgreSQL server required)

X X
Dummy

Blazing fast

N/A (nothing is saved to disk)

N/A (nothing is saved to disk)

X X

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: http://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.

Whereas we support older versions, it's recommended to use PostgreSQL 9.5 at least.

For a better performance of PostgreSQL with Minetest servers, please configure postgresql.conf with a minimum shared_buffer of 512MB with a maximum of 50% of your server available memory

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 and will most likely not be of any use for you.