Categories
Uncategorized

Minecraft Load Balancing

It’s time for some fun. You can tell your family and colleagues that you are doing research or experimenting with new tech, but don’t let them know that you are playing Minecraft.

Let’s say you’re organizing a Minecraft class for students in STEM. You need to run your own Minecraft servers to ensure a kid-friendly multiplayer environment, restricted only to your students. You will need to run at least one server. Your load balancer will handle sending students to Server A and Server B depending on their load.

This article will discuss port forwarding and load balance with Kong Gateway. This will be done by setting up multiple Minecraft servers and then placing Kong Gateway in front these upstream services for port forwarding or load balancing.

Let’s first briefly discuss some important technologies concepts before we get started.

Key Concepts

Port Forwarding

Port forwarding refers to receiving network requests from a specific port on a machine and forwarding them to another port. This task is usually handled by a router, firewall, or API gateway. You might have a webserver listening on port 3000, and a database server listening at port 5000. The API gateway would listen to requests coming from outside your network. The gateway would forward requests to port 80 to your web server at Port 3000. In the meantime, port 5432 requests would be sent to your database server at Port 5000.

Load Balancing

Load balancing refers to the process of spreading multiple requests to a server evenly across many replicas. This task is usually handled by a specific piece of software or hardware called a loadbalancer. Outsiders are unaware that multiple servers can be running. They think they are making requests to one server. However, the load balancer distributes the request load so that no one server is overwhelmed. The load balancer makes sure that requests go only to healthy nodes in the event of a complete failure of the replica.

Kong Gateway

Kong Gateway is an API gateway layer that sits between upstream services and can perform load balancing and port forwarding tasks. Kong Gateway is the front-door greeter for all requests, regardless of whether those upstream services include web servers, databases, or Minecraft game servers. Kong Gateway is capable of managing traffic control as well as authentication, request transformations and analytics.

Support for TCP Stream

Our Minecraft project is different from other web servers or databases in that Minecraft requires an established connection between Minecraft client (the player) and the server. Instead of expecting stateless HTTP requests we will need to manage TCP connections with streaming data. TCP streaming is supported by Kong Gateway.

Our project approach

This project will be described step-by-step.

As you can see we will start with simplicity and slowly increase our complexity.

Here’s what you need to get started

This mini-project doesn’t require a lot of Minecraft knowledge. It’s easy to set up Minecraft servers in Docker containers. A basic knowledge of Docker is helpful.

Docker Engine will be installed on your local computer. Finally, to verify that the project is successful, you will need to install Docker Engine on your local machine. Log in as a paid owner to the Minecraft client. Minecraft’s free trial does not allow you to connect to multiplayer servers. This is what we will be using for our project.

Categories
Uncategorized

Minecraft Server setup

Minecraft has gained immense popularity with kids and adults alike worldwide. It helps players hone their social skills, ignite their creative side, and enhance their problem-solving strengths while crafting, mining, and Minecrafting online together.

When playing on public or free internet servers, players join forces in building better and bigger things than they can do alone. But because it is public, you cannot monitor who your child is interacting with. And that’s where setting up your server comes into the picture.

Important Note: When you set up your server, you must know that you will be automatically inviting players to join your server. Hence, it is crucial to keep a watch on who your child is playing with online.

Without further ado, let’s brush our knowledge on how to begin hosting your own Minecraft server on your PC for your child or yourself.

1.     Updated Java Version Verification

If you are setting up a Minecraft server, you must know that it is a game based on Java. Thus, to begin with, you need to ensure you have the latest Java version. If you don’t, download it here.

If you need troubleshooting help, click here for the tutorial. Be careful while making adjustments with some crucial settings to avoid damaging your computer.

2.     Downloading Minecraft_server

To jumpstart with Minecraft server setup, you will require server files. Follow these steps to do the same.

  • Download the Minecraft-server .1.11.jar from the downloads page
  • Upon finishing the download, open the file and save Minecraft_server.1.11.jar in a folder. Name the folder “Minecraft Server.”
  • Run the program by double-clicking on Minecraft_server.1.11.jar

3.     Minecraft Version

If Minecraft undergoes the latest version update, you can rest assured with Step 2. The only difference is the “1.11” will also undergo replacement because that denotes a change in version.

4.     Running The Server As A Batch File

Follow these steps to run the server.

  • Go to the folder where you stored Minecraft_Server.1.11.jar and do a right-click. 
  • Choose “New” from the options.
  • In the text field, type “Run” to name the new document.
  • Copy this line – 1 cmd /k java ‐Xms1G ‐Xmx1G ‐jar Minecraft_server.1.11.jar. And paste it into the notepad.
  • Click the icon, “Save As.”
  • Choose “All Files” for Save As type. 
  • Now type the file name as “Run.bat.” Do make sure that you don’t include .txt in the file name.  

5.     The EULA License Agreement

To launch a Minecraft server, you must first agree to Mojang’s license agreement. To agree, do the following.

  • Double-click on eula.txt. Read the agreement here, or do copy-paste the file text to get the copy of the agreement.
  • Replace the false in eula=false with true to indicate that you have read the agreement and agreed.

6.     Server Launch

To launch your server, go to Run.bat and double-click it. You will encounter a window emerge with some server info (refer to Step 7 for information). Let the window remain open for as long as you wish to keep the server running and for players to connect.

7.     Server Info Window

As stated, upon launching the server, a window pops up with some related info. It is to keep you informed about the game’s events even if you are not in it.

The information is as below.

  • Stats panel displaying the memory server consumes.
  • Players’ panel shows which all players are still connected.
  • Log and Chat panel shows player chats and messages pertaining to the server.
  • Server commands field for veteran users to control the server in the bottom right corner of the window. 

8.     Server Joining

Follow these directions to join and play on your server before anyone else does. 

  • Open Minecraft to run.
  • Click “Multiplayer” from the main menu.
  • Now click on “Add server.”
  • Give a name of your choice in the field that says “Server Name.”
  • Type the server address as “localhost.”
  • Click on the “done” icon.
  • You can now open your server and click on the icon “Join Server.”

9.     Port Forward

This step involves adjustments of router settings so that other players can access your server. This process is unique for everyone because of the difference in routers.

Click here to read the dynamics of port forwarding. To get a list of guides on port forwarding, click here. Skim the list to find the model and make of your router to follow the instructions accordingly. If you can’t find your router, choose the closest model number.

10.    External IP Address

To find your external IP address, follow these steps.

  • Go to google.com
  • Search for “external ip.”
  • Google will present your external IP address is either IPv6 or IPv4.
  • Save this address for others to connect.

11.    Server Connect

Follow these steps for players to join your server.

  • Click on Multiplayer in Minecraft.
  • Select “Add Server.”
  • Type server name
  • Type server address
  • Click on “Done”

12.     Settings On Server.Properties File

Some of the properties you can make changes to in server.properties under server folder are,

  • Change to the creative mode by replacing gamemode=0 with gamemode=1.
  • Lower or increase the number of players to join your server under “max‐players.”