Difference between revisions of "Database backends"

From Luanti Wiki
Jump to navigation Jump to search
(Replaced content with "[https://dev.luanti.org/database-backends This page has moved to the Luanti Developer Wiki]")
Tag: Replaced
 
(35 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Languages}}
+
[https://dev.luanti.org/database-backends This page has moved to the Luanti Developer Wiki]
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 5.0)
 
 
 
* Map
 
* Players
 
* Authentication
 
 
 
 
 
== Map backend ==
 
 
 
The database backend is set using the <code>backend</code> setting in ''world.mt''.
 
 
 
If you want to migrate a world map to a new backend, use <code>minetestserver --migrate <name of new backend> --world <path to your world directory></code>.
 
 
 
If using minetest.exe in Windows, server instructions can be given using "<code>minetest --server</code>", e.g. <code>minetest --server --migrate <name of new backend> --world <path to your world directory></code>.
 
 
 
== Player backend ==
 
 
 
The database backend is set using the <code>player_backend</code> setting in ''world.mt''.
 
 
 
If you want to migrate players to a new backend, use <code>minetestserver --migrate-players <name of new backend> --world <path to your world directory></code>.
 
 
 
 
 
== Comparison table ==
 
 
 
{| class="wikitable sortable" style="text-align: left; font-size: smaller"
 
|-
 
! Backend
 
! Speed
 
! Reliability
 
! Compatibility with builds
 
! Map
 
! Players
 
! Authentication
 
|-
 
| SQLite3
 
| style="background-color: #9F9;" |
 
'''Good'''
 
| style="background-color: #FFB;" |
 
'''Acceptable''' ''(problems can arise with concurrent accesses)''
 
| style="background-color: #9F9;" |
 
'''Very good''' ''(always supported)''
 
| style="text-align: center" | ✔
 
| style="text-align: center" | ✔
 
| style="text-align: center" | ✔
 
|-
 
| LevelDB
 
| style="background-color: #9F9;" |
 
'''Good'''
 
| style="background-color: #9F9;" |
 
'''Good'''
 
| style="background-color: #FFB;" |
 
'''Mostly supported'''
 
| style="text-align: center" | ✔
 
| |
 
| |
 
|-
 
| Redis
 
| style="background-color: #9EF;" |
 
'''Very good''' ''(data kept in RAM)''
 
| style="background-color: #9F9;" |
 
'''Good'''
 
| style="background-color: #FAA;" |
 
'''Inconvenient''' ''(redis server required)''
 
| style="text-align: center" | ✔
 
| |
 
| |
 
|-
 
| PostgreSQL
 
| style="background-color: #9EF;" |
 
'''Very good''' ''(most used data are in memory, others from disk)''
 
| style="background-color: #9EF;" |
 
'''Very good'''
 
| style="background-color: #FAA;" |
 
'''Inconvenient''' ''(PostgreSQL server required)''
 
| style="text-align: center" | ✔
 
| style="text-align: center" | ✔
 
| |
 
|-
 
| Dummy
 
| style="background-color: #9EF;" |
 
'''Blazing fast'''
 
|  |
 
'''N/A''' ''(nothing is saved to disk)''
 
|  |
 
'''N/A''' ''(nothing is saved to disk)''
 
| style="text-align: center" | ✔
 
| style="text-align: center" | ✔
 
| |
 
|-
 
| Plaintext Files (deprecated)
 
| style="background-color: #FAA;" |
 
'''Bad'''
 
| style="background-color: #FAA;" |
 
'''Bad'''
 
| style="background-color: #9F9;" |
 
'''Very good''' ''(always supported)''
 
| style="text-align: center" |
 
| style="text-align: center" | ✔
 
| style="text-align: center" | ✔
 
|}
 
 
 
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 ====
 
 
 
<code>redis_address</code> '''--''' The IP or hostname of the redis server.
 
 
 
<code>redis_port</code> '''--''' The port of the redis server. ''Optional, default: 6379''
 
 
 
<code>redis_hash</code> '''--''' 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. <code>IGNORED</code>.
 
 
 
=== 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 <code>postgresql.conf</code> with a minimum <code>shared_buffer</code> of 512MB, with a maximum of 50% of your server's available RAM.
 
 
 
==== world.mt for PostgreSQL ====
 
 
 
<code>pgsql_connection</code> '''--''' PostgreSQL connection string for world map | ''host=<db_host> user=<db_user> password=<db_password> dbname=<db_name>''
 
 
 
<code>pgsql_player_connection</code> '''--''' 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 backend is not widely used. CTF servers use Dummy because map does not need to be saved (it restores every round).
 
 
 
 
 
[[Category:Server]]
 
[[Category:Map]]
 

Latest revision as of 12:36, 22 December 2024