Differences between revisions 6 and 7
Revision 6 as of 2013-04-18 06:00:44
Size: 3178
Editor: IanRees
Comment:
Revision 7 as of 2013-06-27 06:58:39
Size: 2959
Editor: IanRees
Comment:
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
emen2ctl also requires an EMEN2 database environment. This may be set using either the "-h" option (e.g. "-h $HOME/db.test") or by setting the $EMEN2DBHOME environment variable. emen2ctl also requires an EMEN2 database environment. This may be set using either the "-h" option (e.g. "-h $HOME/test.db") or by setting the $EMEN2DBHOME environment variable.
Line 31: Line 31:
The "start" command will start the EMEN2 web server. In this example, we pass a database environment with "-h", a list of extensions to load with "-e", and bind the server to port 8080 with "--port". The "start" command will start the EMEN2 web server. In this example, we pass a database environment with "-h" and bind the server to port 8080 (default) with "--port".
Line 34: Line 34:
bash$ emen2ctl start -h ~/data/db.test -e default,em,site --port 8080 bash$ emen2ctl start -h ~/test.db --port 8080
Line 36: Line 36:
INFO :: Opening Database Environment: /Users/irees/data/db.test [INFO] Web server started
Line 39: Line 39:
This will create a "pid" file in the database environment (in this example, /Users/irees/data/db.test/applog/emen2.pid). This file will be used to communicate with the server process later. This will create a "pid" file in the database environment (in this example, /Users/irees/test.db/log/emen2.pid). This file will be used to communicate with the server process later.
Line 46: Line 46:
bash$ emen2ctl stop -h ~/data/db.test -e default,em,site bash$ emen2ctl stop -h ~/test.db
Line 55: Line 55:
bash$ emen2ctl restart -h ~/data/db.test -e default,em,site bash$ emen2ctl restart -h ~/test.db
Line 58: Line 58:
Removing stale pidfile /Users/irees/data/db.test/applog/emen2.pid
INFO :: Opening Database Environment: /Users/irees/data/db.test
Removing stale pidfile /Users/irees/test.db/log/emen2.pid
[INFO] Web server started
Line 67: Line 67:
bash$ emen2ctl recover -h ~/data/db.test -e default,em,site bash$ emen2ctl recover -h ~/test.db

EMEN2 control script (emen2ctl)

Similar to Apache's "apachectl" script, EMEN2 includes an "emen2ctl" script. This can be used to start and stop the server and perform some basic administration tasks.

Running emen2ctl

Note: Depending on how you installed EMEN2, emen2ctl may not be in your $PATH. On Linux, using the recommended installation, it will probably be $HOME/Python/bin/emen2ctl. You can either invoke the script using the full path, or add the directory to your path.

emen2ctl accepts a single command argument and options after that:

bash$ emen2ctl
Usage: /usr/local/bin/emen2ctl {start|stop|restart|recover} [options]

The following commands are defined:

  • start: Start the EMEN2 web server
  • stop: Stop the EMEN2 web server
  • restart: Restart the EMEN2 web server
  • recover: Run database recovery

emen2ctl also requires an EMEN2 database environment. This may be set using either the "-h" option (e.g. "-h $HOME/test.db") or by setting the $EMEN2DBHOME environment variable.

All emen2ctl options will be passed to the EMEN2 server. These will usually be used when starting the server: -e to load extensions, and --port to specify a port.

Note: In the future, the extensions to be loaded will be stored in the configuration file and editable using the web interface instead of the "-e" option. For now, specify them on the command line with "-e".

Start the EMEN2 web server

The "start" command will start the EMEN2 web server. In this example, we pass a database environment with "-h" and bind the server to port 8080 (default) with "--port".

bash$ emen2ctl start -h ~/test.db --port 8080
Starting emen2
[INFO] Web server started

This will create a "pid" file in the database environment (in this example, /Users/irees/test.db/log/emen2.pid). This file will be used to communicate with the server process later.

Stop the EMEN2 web server

Similarly, the "stop" command will attempt to gracefully stop the EMEN2 web server:

bash$ emen2ctl stop -h ~/test.db
Stopping emen2 [process 30821]

Restart the EMEN2 web server

Similar to "start." This will stop the current server process, then restart.

bash$ emen2ctl restart -h ~/test.db
Stopping emen2 [process 30821]
Starting emen2
Removing stale pidfile /Users/irees/test.db/log/emen2.pid
[INFO] Web server started

Run database recovery

If the server or EMEN2 crashes, you will want to run database recovery before restarting. This will clean the underlying Berkeley DB environment, and abort any transactions that were uncommitted.

bash$ emen2ctl recover -h ~/test.db
Running emen2 database recovery
BDB2526 Finding last valid log LSN: file: 1 offset 650860
BDB1514 Recovery starting from [1][622364]
BDB1518 Recovery complete at Mon Mar 12 05:14:18 2012
BDB1519 Maximum transaction ID 80000075 recovery checkpoint [1][653815]

EMEN2/emen2ctl (last edited 2013-06-27 06:58:39 by IanRees)