-
Notifications
You must be signed in to change notification settings - Fork 422
PostgreSQL Storage
This option one of the 4 storage options of Dynmap. It is an advanced storage layout, for example a separate service that hosts the database needs to be set-up, which will be explained in this guide.
Apologies, I would need to go over installation of the database again myself. Documentation can be found at https://www.postgresql.org/
Using a terminal or command line on the server that is hosting the minecraft server, we will create a new database and add some database users.
You will notice statements like "CREATE DATABASE" after entering a command. This is normal.
C:\Program Files\PostgreSQL\15\bin>psql -U postgres
Password for user postgres:
postgres=# CREATE DATABASE <DATABASE_NAME>;
CREATE DATABASE
Postgres example (Click to expand)
C:\Program Files\PostgreSQL\15\bin>psql -U postgres
Password for user postgres:
postgres=# CREATE DATABASE dynmap;
CREATE DATABASE
note: If the Postgres server is on the same server as the minecraft server. <minecraftserver_ip> should just be localhost
postgres=# CREATE USER <DYNMAP_USER> WITH PASSWORD '';
CREATE ROLE
postgres=# ALTER DATABASE <DYNMAP_DATABASE> OWNER TO <DYNMAP_USER>;
ALTER DATABASE
Postgres example (Click to expand)
postgres=# CREATE USER dynamp WITH PASSWORD 'CHANGE_ME_QUICK';
CREATE ROLE
postgres=# ALTER DATABASE dynmap OWNER TO dynmap;
ALTER DATABASE
If you made a mistake and need to delete the user, this is how.
postgres=# DROP USER ;
Postgres example (Click to expand)
postgres=# DROP USER dynmap;
postgres=# DROP DATABASE dynmap;
postgres=# DROP SCHEMA maps;
After you create a new user, try logging into the user. (after you logout from the postgres user via "exit")
postgres -u
psql (15.3)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=#
Postgres has these permissions available to set to MySQL users.
- ALL PRIVILEGES - Grant all privileges to the user
- CREATE - Allows user to create databases/tables
- DELETE - Allows user to delete rows(data) from a table
- DROP - Allows user to drop databases and tables
- INSERT - Allows user to insert rows(data) to a table
- SELECT - Allows user to read from a database
- UPDATE - Allows user to update data in a table
The database driver for Postgres should be installed already (JDBC I believe, verify this).
The last step is to configure the dynmap configuration.txt so it connects to the database and uses it for storage. change the following part of the configuration.txt:
storage:
# Filetree storage (standard tree of image files for maps)
type: filetree
# SQLite db for map storage (uses dbfile as storage location)
#type: sqlite
#dbfile: dynmap.db
# MySQL DB for map storage (at 'hostname':'port' with flags "flags" in database 'database' using user 'userid' password 'password' and table prefix 'prefix')
#type: mysql
#hostname: localhost
#port: 3306
#database: dynmap
#userid: dynmap
#password: dynmap
#prefix: ""
#flags: "?allowReconnect=true&autoReconnect=true"
to:
Postgres enabled (Click to expand)
storage:
# Filetree storage (standard tree of image files for maps)
#type: filetree <- DONT FORGET TO COMMENT THIS OUT
# SQLite db for map storage (uses dbfile as storage location)
#type: sqlite
#dbfile: dynmap.db
# MySQL DB for map storage (at 'hostname':'port' with flags "flags" in database 'database' using user 'userid' password 'password' and table prefix 'prefix')
type: postgres
hostname: <postgres_ip/postgres_hostname/postgres_domain>
port: 5432
database: <DYNMAP_DATABASE>
userid: <DYNMAP_USER>
password: <DYNMAP_USER_PASSWORD>
prefix: "" # Can add prefix for tables if you want
flags: "?allowReconnect=true&autoReconnect=true"
example:
Postgres example (Click to expand)
storage:
# Filetree storage (standard tree of image files for maps)
#type: filetree <- DONT FORGET TO COMMENT THIS OUT
# SQLite db for map storage (uses dbfile as storage location)
#type: sqlite
#dbfile: dynmap.db
# MySQL DB for map storage (at 'hostname':'port' with flags "flags" in database 'database' using user 'userid' password 'password' and table prefix 'prefix')
type: postgres
hostname: localhost
port: 5432
database: dynmap
userid: dynmap
password: CHANGE_ME_QUICK!
prefix: "" # Can add prefix for tables if you want
flags: "?allowReconnect=true&autoReconnect=true"
All that was needed for me to get this working was to create the database. I think I had some issues with my user's privileges so those may need to be adjusted.
- Base Plugin Settings
- Web Setup
- Storage Setup
- HD Map Configuration
- World and template settings
- Guides
- Advanced Map Configuration
- Component Configuration
- Configuration of worlds
- Exporting World Data in Wavefront OBJ Format
- External Webserver Advanced
- Support for Minecraft Servers other than CraftBukkit
- Support for MinecraftForge based mods
- Support for Tekkit
- Custom Block Definitions
- Model Definition Files
- Texture Definition Files
- Defining a Block using a Custom Block Renderer
- Defining a Block using a Volumetric Model
- Defining a Cuboid Block
- Defining a Simple Block
- Defining Cuboid Models
- Defining Volumetric Models
- Special texture file types
- Using custom block renderers
- Incompatible mods