Running multiple instances on one server

1 post / 0 new
This details what I did to create a second separate region on my Opensim server (Linux). Running each region in a separate instance means that if one region crashes it won't effect the other regions on the same server. In this guide I will assume that you: have followed the guides on this wiki on linking your opensim server to InfiniteGrid the current working region is called sim01 and is in a directory of the same name the second region is called sim02 and is in a directory of the same name

Make a copy of the working region

cd /opt/opensim
cp -R /opt/opensim/sim01 /opt/opensim/sim02

 

Force modify the links

cd sim02
ln -f -s ../config/sim02.opensim.ini OpenSim.ini
ln -f -s ../config/sim02.opensim.exe.config OpenSim.exe.config
cd ./current/bin/config-include
ln -f -s ../../../../config/sim02.flotsamcache.ini FlotsamCache.ini
ln -f -s ../../../../config/sim02.gridcommon.ini GridCommon.ini
cd ../Regions
ln -f -s /opt/opensim/config/sim02.regions.ini Regions.ini

 

Make copies of the ini files

cd /opt/opensim/config
cp sim01.flotsamcache.ini sim02.flotsamcache.ini
cp sim01.gridcommon.ini sim02.gridcommon.ini
cp sim01.opensim.exe.config sim02.opensim.exe.config
cp sim01.opensim.ini sim02.opensim.ini
cp sim01.regions.ini sim02.regions.ini

 

Edit ini files and update for new region

Edit sim02.opensim.ini

nano sim02.opensim.ini

change

http_listener_port = 9002

to next available port number

change

PIDFile = "/var/run/opensim/sim01.pid"

to

PIDFile = "/var/run/opensim/sim02.pid"

Edit sim02.opensim.exe.config

nano sim02.opensim.exe.config

change

<file value="/var/log/opensim/sim01.log" />

to

<file value="/var/log/opensim/sim02.log" />

Edit sim02.regions.ini

nano sim02.regions.ini

change


Edit start-sim-in-shared-screen

cd /opt/opensim/sim02
nano start-sim-in-shared-screen

change

console_name=screen_console

to

console_name=sim02

 

Start the new region manually to check for errors

cd /opt/opensim/sim02/current/bin
/usr/bin/mono OpenSim.exe

and set the Estate name and Estate Owner name

Stop the sim

backup
shutdown

 

Change sim02 to be owned by opensim user

sudo chown -R opensim:opensim /opt/opensim/sim02

 

Make Monit config file for new region

Make config file and replace all instances of sim01 with sim02

cd /etc/monit/conf.d
sudo -s
sed 's/sim01/sim02/g' sim01.conf > sim02.conf
exit

The exit command is IMPORTANT because we have to change to the root user to get the sed command to work so we MUST make sure that we exit out of the root shell as soon as we have finished issuing that command!

 

Restart Monit

sudo /etc/init.d/monit restart all

 

Check to see if its running

Wait about 30 seconds and then

screen -ls opensim/

which should display something like

There are several suitable screens on:
       4265.sim02      (10/01/12 20:16:56)     (Multi, detached)
       881.sim01      (10/01/12 19:44:55)     (Multi, detached)
2 Sockets in /var/run/screen/S-opensim.

now connect to the second simulator and check that it started ok

screen -r opensim/sim02 -A

(Disconnect from screen: ctrl+a then d)


Log into the grid and TP to your new region!

tags: