So apparently minetestserver does support migrating from sqlite to postgresql. Yeay!!!
After much fiddling with various conversion tools without any luck, I went for it with my local instance of our server. Good thing I did as there was MUCH trial and error while I was figuring it out. I'm going to outline what I did for others (or even myself) to get it working for them. I know nothing about postgresql other than I learned today so feel free to pick this tutorial apart so I may edit this post.
Our server is running Debian Jessie completely Vanilla, with only what is required to build and run minetest server so your results may be quite different than mine.
First off, you need minetestserver with postgresql support intalled. I had already built and rolled minetest in a .deb package for easy install and clean removal. I just need to install it for the first time but not start it yet:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
sudo dpkg -i minetest_0.4.15-dev-20170215_amd64.deb
Now install postgresql and client:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
sudo apt-get install postgresql-9.4
This installed:
postgresql-9.4
postgresql-client-9.4
postgresql-client-common
postgresql-common
Check to see if postgresql server is up and running. There will be a bunch of output if this command is run and the server is up:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
On a Debian box, user postres is created. In the *nix terminal we need to become that user and run the postgresql client to connect and create a user, password and database for our map.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
The prompt will change appearance when you are in the client. Type \q to quit if you change your mind.
I'm now going to create a new database user "minetest" with a password of "12345" and give minetest all privs on a new database called "myworld". Use whatever you like... maybe not such a lame password though.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
postgres=# CREATE USER minetest WITH PASSWORD '12345';
postgres=# CREATE DATABASE myworld OWNER minetest;
postgres=# GRANT ALL PRIVILEGES ON DATABASE myworld TO minetest;
The postgres=# portion of the above lines is the client "prompt", don't type that part. Also note, the uppercase commands must be uppercase. The semi-colons ";" must not be omitted. If they aren't included, it will be assumed you are typing a extra long command.
Check to make sure the new database is there and owned by new user "minetest". List the databases with \l <--- backslash and a lowercase "L":
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+-----------------------
myworld | minetest | LATIN1 | en_US | en_US | =Tc/minetest +
| | | | | minetest=CTc/minetest
postgres | postgres | LATIN1 | en_US | en_US |
template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
Hopefully everthing is good, now exit the client with \q
Now we create a connection string in our worlds world.mt file. Do not change the backend string from sqlite yet. The migration will do that for you when it's done.
So the top part of world.mt should look like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
gameid = minetest
backend = sqlite3
pgsql_connection = host=127.0.0.1 port=5432 user=minetest password=12345 dbname=myworld
Save world.mt and let's start minetestserver and begin the migration. Launch it with the --migrate option, and --world option. I always use the full path to the world directory in quotes when launching via cli. Your path will be different naturally. Mine is in my user directory. So I don't have to deal with permissions when editing stuff.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetestserver --migrate postgresql --world "/home/leeh/.minetest/worlds/myworld"
You should expect to see something like this if all went well:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
leeh@s103139:~$ minetestserver --migrate postgresql --world "/home/leeh/.minetest/worlds/myworld"
2017-02-16 21:08:37: WARNING[Main]: Couldn't find a locale directory!
2017-02-16 21:08:37: WARNING[Main]: Your PostgreSQL server lacks UPSERT support. Use version 9.5 or better if possible.
Migrated 880260 blocks, 99.2227% completed.
2017-02-16 21:10:24: ACTION[Main]: Successfully migrated 887156 blocks
2017-02-16 21:10:24: ACTION[Main]: world.mt updated
Now you can start your server with your usual method and it should "just work"
Enjoy!