In the spring of 2011, I worked for a small company in Salem, Oregon. The company is gone now, but I retained something that was passed on to me by their lead DBA: the Lexmine Minecraft server.
It’s been two years since then, and the server has gone from a simple “vanilla” server to the multi-server cluster it is today. This document will explain the current server and network architecture and provide some instruction for anyone interested in recreating a similar setup.
Currently, the PiCraft server cluster consists of three physical servers running Ubuntu Server, all connected via NFS and the Multicraft software. There are scripts to update the files on the primary server, and init.d entries to run specific scripts at startup, ensuring that the servers correctly come back online automatically in case of power loss.
The primary server unit is where the Multicraft admin panel frontend, MySQL server, and the NFS server is located. All three physical servers are running the Multicraft backend, however the executables and plugin files are stored only on the primary unit. By using symbolic linking and NFS, only one copy of each plugin file needs to be stored.
The MySQL server configuration is fairly simple. I’m using Ubuntu Server (a flavor of Debian Linux), so the MySQL configuration file is located at
I modified the
bind-addressvalue to correspond with the server IP address (I put in the hostname that corresponds to the server), and commented out the
Once MySQL is configured, you can set up the Multicraft backend and frontend. This does require that an Apache 2 webserver is installed and running. All defaults may be used for Apache 2. Setting up Multicraft can be done via the included installer.
The Multicraft installer will prompt for configuration information, and in most cases the defaults may be used. The MySQL server is located at the IP address configured previously, or the hostname if you’re using that option.
If there is only one physical server, no additional configuration would be necessary. If more than one Multicraft backend will be connected to the master server, edit the
/multicraft/location/multicraft.conffile and name the daemon and set a unique daemon ID.
Setting up NFS was slightly more tricky. NFS requires you to mount and bind the folder you’d like to share via the network. To make this happen across reboots, you have to edit the
Before setting up NFS, the
/etc/fstabfile needs the following line added:
/location/of/folder /pseudo/location none bind 0 0
This tells the server to mount the
/pseudo/locationwith the bind option each time the server boots. You could also run the command
mount --bind /location/of/folder /pseudo/locationinstead, but this will not persist across server reboots, and should only be used for testing. A mounted file can be unmounted via the
Installing NFS is as simple as running
apt-get install nfs-kernel-serveras root (or via sudo). Configuring the primary server requires adding the line
/pseudo/location ip.address.of.client(ro,sync,no_root_squash)to the
/etc/exportsfile. You can use an asterisk (eg, you can use
/pseudo/location *(ro,sync,no_root_squash)) instead of an IP address, but by specifying the IP address you ensure that other IP addresses do not have access to the files.
Once MySQL, Multicraft, and NFS are set up, adding init.d entries is the last portion of automating the startup.
In Ubuntu Server, add executable scripts to the
/etc/init.ddirectory. Once a script has been added, you must run
update-rc.d myscript.sh defaultsas root or via. This will add the script to the proper runlevels. To disable, run
update-rc.d myscript.sh disableas root or via sudo. This is the script used to start Multicraft:# Multicraft auto-start # # description: Auto-starts multicraft # processname: multicraft # pidfile: /var/run/multicraft.pid export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/ /home/server/multicraft/bin/multicraft -v restart case $1 in start) /home/server/multicraft/bin/multicraft -v start ;; stop) /home/server/multicraft/bin/multicraft -v stop ;; restart) /home/server/multicraft/bin/multicraft -v restart ;; esac exit 0
This script will start the Multicraft backend on boot, and will also allow the use of the
service multicraft start/stop/restartcommands.
Once these things are configured, the server can be rebooted, and all required services will be started automatically. Note that some things, like backups will require the configuration of
If you have questions about the process, or need specifics, let me know in the comments.