问题
Is there an easy way to create a new Wildfly server instance.
In JBoss AS5 all you had to do is create a copy of default or all and start jboss with:
run.sh -c [New instance name]
There is no such option available in standalone.sh
回答1:
The change which started with the JBoss AS7 and continues in WildFly is, the whole server configuration is hold in a single file. There are prepared some 4 default configurations (or profiles):
- default (
standalone.xml
- used by default - without clustering and messaging) - HA (
standalone-ha.xml
- supports clustering) - Full (
standalone-full.xml
- supports messaging) - Full HA (
standalone-full-ha.xml
- supports both messaging and clustering)
To use the custom profile start the server with using -c
switch
./standalone.sh -c standalone-full-ha.xml
If you only need to change the server configuration, you can edit the profile XML files directly, use CLI tool (jboss-cli.sh/bat
) or management console.
If you want to do bigger changes (e.g. different applications in standalone/deployments
directory), you can copy the whole standalone
directory and edit each copy as necessary. I use following way for starting two clustered server:
cd $JBOSS_HOME
cp -r standalone standalone1; cp -r standalone standalone2
# edit the configs here if necessary ...
bin/standalone.sh -c standalone-ha.xml \
-Djboss.server.base.dir=`pwd`/standalone1 \
-Djboss.node.name=host1 &
bin/standalone.sh -c standalone-ha.xml \
-Djboss.server.base.dir=`pwd`/standalone2 \
-Djboss.node.name=host2 \
-Djboss.socket.binding.port-offset=200 &
This example creates 2 copies from a clean standalone
configuration and starts a server for each copy. The second server have port offset 200 (e.g. web running on port 8280).
回答2:
For standalone instances you can use the --server-config
or -c
option to specify a different configuration.
For example, to put JBoss in "clustered" mode
$JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml
Other alternative is used a domain mode configuration, in this mode you can define different profiles, for an different servers instances.
WildFly - Operating modes
WildFly - Domain Setup
来源:https://stackoverflow.com/questions/26400059/is-there-an-easy-way-to-create-a-new-wildfly-server-instance