In a previous blog I talked about the domain creation, we saw at the end that some server groups and servers are created by default which usually are not what we need.
Through this blog, I will show you how to clean this unneeded configuration and how to configure your domain according to your defined architecture.

How this default configuration arrive in my domain?

As explained before we use the default domain.xml and (host.xml, host-master.xml or host-slave.xml) to create a domain, in fact, the default configuration created is there 😉

Server groups preconfigured in domain.xml

In the domain.xml you will find below configuration:

    <server-groups>
        <server-group name="main-server-group" profile="full">
            <jvm name="default">
                <heap size="1000m" max-size="1000m"/>
            </jvm>
            <socket-binding-group ref="full-sockets"/>
        </server-group>
        <server-group name="other-server-group" profile="full-ha">
            <jvm name="default">
                <heap size="1000m" max-size="1000m"/>
            </jvm>
            <socket-binding-group ref="full-ha-sockets"/>
        </server-group>
    </server-groups>

This means that two server groups are configured already.

Servers configured in host*.xml

host-master.xml

No servers defined, which is normal because it is not recommended to have servers on the master host.

host.xml

    <servers>
        <server name="server-one" group="main-server-group">
        </server>
        <server name="server-two" group="main-server-group" auto-start="true">
            <socket-bindings port-offset="150"/>
        </server>
        <server name="server-three" group="other-server-group" auto-start="false">
        </server>
    </servers>

host-slave.xml

    <servers>
        <server name="server-one" group="main-server-group"/>
        <server name="server-two" group="other-server-group">
            <socket-bindings port-offset="150"/>
        </server>
    </servers>

So, depending on which preconfigured file is used servers are configured in your domain…

How to clean default configuration?

You have two choices:

Update xml preconfigured files

The idea is to update the xml files before you start the domain and remove this default configuration on each host. which means:
Remove all lines between

    <server-groups>

and

    </server-groups>

from domain.xml

Remove all lines between

    <servers>

and

    <servers>

from host.xml or host-slave.xml

Be careful, servers are assigned to server groups, so if you remove the server groups you have to remove related servers, if not this will cause issues because server groups will not be found!

Clean default configuration after domain start

Start your domain and connect to the CLI:

[jboss@vmjboss ~]$ $JBOSS_HOME/bin/jboss-cli.sh -c --controller=vmjboss:9990
[domain@vmjboss:9990 /] 

You need first to stop servers then remove them:

[domain@vmjboss:9990 /] /host=slave1/server-config=server-one:stop(blocking=true)
{
    "outcome" => "success",
    "result" => "STOPPED"
}
[domain@vmjboss:9990 /] /host=slave1/server-config=server-one:remove             
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Repeat the operation on all servers all hosts.

Now, you will be able to remove default server groups:

[domain@vmjboss:9990 /] /server-group=main-server-group:remove
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Repeat the operation to remove all default server groups

Configure the domain

Define server groups

Server groups already explained in this blog.

To define a server group you should at least know:
– Which profile is needed (default, full, full-ha, ha)
– Which socket-binding-group according to your profile (standard-sockets, full-sockets, full-ha-sockets, ha-sockets)
– socket-binding-port-offset if needed

You can create a server groups via CLI or console, here the CLI Command to create an HA server groups:

[domain@vmjboss:9990 /] /server-group=HA-GROUP:add(profile=ha,socket-binding-group=ha-sockets)
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Define servers

Servers already explained in this blog.

To create a server you should at least know:
– On which host?
– Assigned to which group?

The server is created in a host and assigned to a server groups, below the command line to create a server:

[domain@vmjboss:9990 /] /host=slave1/server-config=server1:add(group=HA-GROUP,socket-binding-port-offset=100,auto-start=true)
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Now you know how to clean default servers and server groups, and how to create yours according to your need. Don’t hesitate to ask questions 😉