Book Image

Wildfly Cookbook

Book Image

Wildfly Cookbook

Overview of this book

Table of Contents (23 chapters)
WildFly Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a cluster in standalone mode


In this recipe, you will learn how to cluster two WildFly nodes locally, that is, on your PC. We will try this using the standalone mode and the ha profile.

Getting ready

For this recipe, we will need the cluster-aware application named cluster-test, that you can find in my GitHub repository. If you skipped the Managing applications using the deployments folder recipe in Chapter 2, Running WildFly in Standalone Mode, please refer to it to download all the source code and projects that you will need.

To build the application, give the following commands:

$ cd ~/WFC/github/wildfly-cookbook
$ cd cluster-test
$ mvn -e clean package

How to do it...

From the WildFly installation directory $WILDFLY_HOME, let's create two folders, each one representing a server node:

  1. Open a terminal and execute the following commands:

    $ cd $WILDFLY_HOME
    $ cp -a standalone cl-std-node-1
    $ cp -a standalone cl-std-node-2
  2. Now, let's copy the cluster-test.war application into the deployments...