|
| Home > Apache Geronimo v2.2 > Documentation > Configuring and administering > Configuring and administering the Apache Geronimo Server > Clustering and farming > Plugin based Farming |
This farming system uses plugins directly and is thus decoupled from the deployment system and allows running the plugin packaging (or "deployment") and farm administration on different servers or machines. The current implementation uses multicast for node discovery. Farming information is stored in a database using jps. The data model allows a single administration server to manage:
When a node starts up it broadcasts a service advertisement including an optional node name (defaulting to host:jndi-port) and a farm name. When the administration server detects this as new it instructs the new node to install all the plugin lists associated with that farm. If the plugins are already installed, this is a no-op; otherwise the plugins are downloaded and installed from the plugin repository specified in the plugin list.
Administrative operations include:
(I haven't been able to think of a plausible meaning for "remove a plugin from a plugin list from a farm")
These operations are available through the GShell deploy/farm command.
Two separate sets of functionality are required for plugin based farms:
This scenario assumes use of maven as a build tool and separate development, quality assurance (QA), and production groups. It needs two maven repositories, for development and production artifacts. These can be simple file/httpd based repositories or something like nexus. Code transfer between groups is in the form of geronimo plugins packaged by the geronimo car-maven-plugin.
In my sandbox until we find a better location or solution, as examples
The GShell deploy/farm command takes one argument, the action, which must be add or remove, and options for the farm, plugin list, and plugin.
-f (--farm) farm name -l (--pluginlist) plugin list name -a (--pluginartifact) plugin artifact name
In addition there are some inherited options for connecting to the server:
-s (--hostname, --server) server name or IP address -p (--port) server port -u (--user) user name -w (--password) password --secure (use secure communication to server)
This example demonstrates the plugin farm on a single server, using nodes that all share the same geronimo installation, and using the admin server as farm controller, application deployment server, and plugin repository. We'll install one of the sample applications on the admin server and deploy it to the farm. I've only tested this with all components built locally on one machine, but some such as the geronimo-plugin-farm-node should be available from the apache snapshot repository.
#!/bin/bash tar xzf geronimo-plugin-farm-node-2.2-SNAPSHOT-bin.tar.gz cd geronimo-plugin-farm-node-2.2-SNAPSHOT for s in {1..5} do sn="server${s}" mkdir ${sn} cp -r var ${sn}/ #uncomment to actually start the servers in the background # ./bin/gsh geronimo/start-server -G server.name=${sn} -G config.substitution.PortOffset=${s}0 >${sn}.log & done cd ..
Here's a fancier script that can both start and stop servers but still illustrates my bash illiteracy:
#!/bin/bash BASE=geronimo-plugin-farm-node-2.2-SNAPSHOT if [ "$1" = "stop" ] ; then ( cd $BASE for server in server*; do pid=$(ps ax | grep "gshell-bootstrap.jar geronimo/start-server -s $server" | grep -v 'grep' | cut -c 1-6) if [ $pid ] ; then echo "Killing gshell for $server at pid $pid" kill -9 $pid fi pid=$(ps ax | grep "javaagent.*$server" | grep -v 'grep' | cut -c 1-6) if [ $pid ] ; then echo "Killing $server at pid $pid" kill -9 $pid fi done ) fi rm -rf $BASE tar xzf $BASE-bin.tar.gz ( cd $BASE for s in {1..5} do sn="server${s}" mkdir ${sn} cp -r var ${sn}/ if [ "$1" = "start" ] ; then ./bin/gsh geronimo/start-server -s ${sn} -G config.substitution.PortOffset=${s}0 >${sn}.log & fi done )
./bin/gsh geronimo/start-server -G server.name=server1 -G config.substitution.PortOffset=10
substituting appropriately for server1 and 10
svn co https://svn.apache.org/repos/asf/geronimo/sandbox/djencks/assemblies
cd assemblies/controller-as-repo mvn clean install cd ../geronimo-tomcat-farm-controller mvn clean install cd target tar xzf geronimo-tomcat-farm-controller-2.2-SNAPSHOT-bin.tar.gz ./geronimo-tomcat-farm-controller-2.2-SNAPSHOT/bin/gsh geronimo/start-server
svn co https://svn.apache.org/repos/asf/geronimo/samples/trunk
cd trunk
mvn clean install
deploy/list-plugins --username system --password manager org.apache.geronimo.samples/sample-datasource/2.2-SNAPSHOT/car # Choose the file repo based on your local maven repository deploy/deploy /Users/david/geronimo/svn/geronimo/samples/trunk/samples/bank/bank-ear/target/bank-ear-2.2-SNAPSHOT.ear /Users/david/geronimo/svn/geronimo/samples/trunk/samples/bank/bank-tomcat/target/resources/META-INF/plan.xml # Substitute actual paths to the ear and plan from your samples checkout deploy/farm add -f cluster1 -l pluginList1 -a org.apache.geronimo.samples/bank-tomcat/2.2-SNAPSHOT/car
In the server logs for the admin server and the farm nodes you should see that the application is installed along with all dependencies. You should be able to see the bank sample on the nodes at for example, http://localhost:8120/bank/
In the gsh console above try
deploy/farm remove -l pluginList1 -a org.apache.geronimo.samples/bank-tomcat/2.2-SNAPSHOT/car # add back the plugin... deploy/farm add -f cluster1 -l pluginList1 -a org.apache.geronimo.samples/bank-tomcat/2.2-SNAPSHOT/car # remove it again deploy/farm remove -f cluster1 -l pluginList1
The example above is set up, for convenience and portability, to use the farm controller server as the plugin repository, and to use localhost as the server name. This means no custom configuration is needed to run everything on one machine but is obviously incomplete for any serious use.
The accessible plugin repositories are configured in each node in the var/config/plugin-repositories.properties file. This needs to include the appropriate plugin repository with any needed credentials. One way to do this is to write a non-classloader plugin to install a new var/config/plugin-repositories.properties to replace the default. You'd assemble a plugin node server including this additional plugin and distribute that to the nodes.
In addition, the controller also needs to have this plugin repository configured as the default in var/config/config-substitutions.properties in this entry:
DefaultPluginRepository=http\://localhost\:8080/plugin/maven-repo
|
|
Privacy Policy - Copyright © 2003-2009, The Apache Software Foundation, Licensed under ASL 2.0. |