Multiple Athenas on Linux

Caution: You should not attempt this if you do not have reasonable hosting experience on Linux. Backup your system before you proceed.

Why multiple Athenas?

In a way, Athena is a multiple server setup. We are talking about multiple Athena here, specifically, two Athena servers on the same host. Can we do that? Sure we can. We have already installed several servers on our Linux system. Adding one more server is not going to be difficult.

Why do we want two Athenas on the same host? In all honesty, there is no reason to install another Athena on the same host. A possible reason is testing. But a test server on the same host? Anyway, here we go. First, make sure the system has no less than 1GB of RAM.

Options:

There are two ways we can set up the proposed test server. One way is to set up a duplicate of Athena running on port 6901, 6122 and 5122. You can revisit the network devices page, open those ports and install Athena the way you did the first one, taking care to use different name for duplicated directories and files such as SQL databases. The other way is to set up an Athena sharing a common login server and possibly char server, as described in the following paragraphs.

At this point, you might want to consider creating a virtual network interface and forward the ports to 192.168.1.102. The following paragraphs are based on the assumption that you will skip this step.

Proceed to forward port 6901, 6122 and 5122 to Athena host on 192.168.1.101. We are not going to use port 6901. It is opened in case the second Athena is used as a stand-alone test server. Restart the network:

# /etc/init.d/network restart

Here we go

MySQL user and databases:

  • Log in to Webmin, and guided if necessary, create the second set of ragnarok databases, say ragnarok2 and log2.
  • create the second ragnarok user, say ragnarok2 (password is assumed to be ragnarok2 in this example) and the necessary user and database permissions. (Giving user ragnarok access to ragnarok2 database will work, but let us keep the two separate.)

Athena:

  • Create the second Athena (say Athena2) in /home/user/Athena2, compile if necessary.
  • Configure, using import folder where available:
    • grf-files.txt: point to /home/user/grf GRF files
    • login server, for use in stand-alone Athena:
      • login_ip: 127.0.0.1 (deprecate; refer Configuration)
      • login_port: 6901 (Configure this anyway)
    • char server:
      • userid: s2
      • passwd: p2
      • server_name: eAthena (change if you want)
      • login_ip: 192.168.1.101
      • login_port: 6900
      • char_ip: 123.456.789.012
      • char_port: 6122
    • map server:
      • userid: s2
      • passwd: p2
      • char_ip: 192.168.1.101
      • char_port: 6122
      • map_ip: 123.456.789.012
      • map_port: 5122
    • lan_support.conf (replace this with subnet_athena.conf if applicable):
      • lan_char_ip: 192.168.1.101
      • lan_map_ip: 192.168.1.101
      • subnet: 192.168.1.0
      • subnetmask: 255.255.255.0
    • inter_conf.txt:
      • // MySQL Login SQL Server
      • login_server_ip: 127.0.0.1
      • login_server_port: 3306
      • login_server_id: ragnarok
      • login_server_pw: ragnarok
      • login_server_db: ragnarok
      • // MySQL Character SQL server
      • char_server_ip: 127.0.0.1
      • char_server_port: 3306
      • char_server_id: ragnarok2
      • char_server_pw: ragnarok2
      • char_server_db: ragnarok2
      • // MySQL Map SQL Server
      • map_server_ip: 127.0.0.1
      • map_server_port: 3306
      • map_server_id: ragnarok2
      • map_server_pw: ragnarok2
      • map_server_db: ragnarok2
      • // MySQL Log SQL Database
      • log_db_ip: 127.0.0.1
      • log_db_port: 3306
      • log_db_id: ragnarok2
      • log_db_pw: ragnarok2
      • log_db: log2

Overview of dual Athena

    Server      myAthena               myAthena2
    IP          192.168.1.101          192.168.1.102, if needed    
    login       6900                   not used
    char        6121                   6122
    map         5121                   5122
    inter       s1                     s2
    mysql       ragnarok               ragnarok2
    mysql       log, optional          log2, optional
    Client      myhost.mydomain.tld    none

Testing

Let us start the second Athena (assuming the first one is already running):

Note that login server is not started.
$ cd /home/user/Athena2
$ ./char-server_sql
$ ./map-server_sql

Log in as you would the first Athena, that is, using your existing client without any modification. You should see both Athenas after logging in. Choose the second Athena, create your char and enjoy.

Not proven!

The above example is not a proven setup. (However, the principle is well proven in multiple-host multiple Athenas.) Athena might complain that the IP address is already taken. If that happened, a virtual network interface should be created. When that is done, reconfigure port forwarding to forward port to the newly created IP, restart network and change the IP of the second Athena to the new one i.e. 192.168.1.102, leaving login_ip in char_conf.txt as shown in the example. You might also need to change MySQL server IP in inter_athena.conf (inter_conf.txt) of the second Athena to 192.168.1.101.



Q&A

Does it work?

Yes. Nothing unusual is used. There is a lot of networking stuff going into that process. The key is to separate the two Athena processes so as not to confuse network devices and MySQL server. It is easier to do this on a Linux host than Windows since virtual network interface can be set up

Should I set up another Athena on my host?

Athena is an emulator. It is not a good idea to run two emulators on the same host. Besides, there is no obvious advantage in doing so. To make matter worse, Athena insists on having its own network setup.

It doesn't work!

Well, be happy anyway. There is always another time.