9.9. fabric:container-create-child

Abstract

create one or more child containers

Synopsis

fabric:container-create-child [ --help ] [ --ensemble-server ] [ --profile profileID ] [ --version version ] [ --jmx-user jmxUser ] [ --jmx-password jmxPass ] [ -b, --bind-address bindAddr ] [ --datastore-type storeType ] [ --datastore-option storeOption ] [ --zookeeper-password zooPass ] [ --jvm-opts jvmOpts ] [ --resolver policy ] [ -m, --manual-ip IPAddr ] { parent } { name } [ number ]

Description

Child containers have the following characteristics:
  • Each child container has a parent, so that the child containers form a hierarchy, with the root container as the ultimate ancestor.
  • The child starts in a new JVM instance (JVM options can be passed to the new JVM through the --jvm-opts command option).
  • A complete set of data directories are created for the child instance, under the ESBInstallDir/instances/ChildName directory. The ESBInstallDir/system directory is shared with the root container.
For example, if you have already created a new fabric (for example, by invoking fabric:create), you could add some child containers to the root container by entering the following command:
karaf@root> fabric:container-create-child root child 3
This command creates three new children under the root container. To check that the containers have been successfully created, invoke the fabric:container-list command, as follows:
karaf@root> fabric:container-list
[id]                           [version] [alive] [profiles]                     [provision status]
root                           1.0       true    fabric, fabric-ensemble-0000-1 
  child1                       1.0       true    default                        success
  child2                       1.0       true    default                        success
  child3                       1.0       true    default                        success
As you can see, the command creates three new child containers, child1, child2, and child3, with the default profile. This containers are ordinary (non-ensemble) containers, running fabric agents (ZooKeeper clients).
If you do not explicitly specify any profile (or profiles) for the new child containers, each of the child containers is created with the OSGi bundles required for a minimal Apache Karaf container and all of the profiles and bundles specified by the default profile.
To associate multiple profiles with a new child container, you can specify the --profile option multiple times. For example, if you want to deploy your own application profile, myApp, together with the esb profile, you would use a command like the following:
fabric:container-create-child --profile esb --profile myApp root childMyApp

Shutting down child containers

After you create new child containers, the children run as separate processes, independently of the parent. Consequently, when you shut down the parent container, the child processes continue to run in the background. If you want to shut down the children, you must explicitly invoke the fabric:container-stop command. For example, if a root container has three children—child1, child2, and child3—you can issue the following commands in the root container console to shut down all of the containers:
karaf@root> fabric:container-stop child1
karaf@root> fabric:container-stop child2
karaf@root> fabric:container-stop child3
karaf@root> shutdown -f

Arguments

Table 9.9. fabric:container-create-child Arguments

ArgumentInterpretation
--help Displays the online help for this command.
--jmx-userThe JMX username of the parent container.
--jmx-passwordThe JMX password of the parent container.
--ensemble-serverWhether the new container should be a Fabric Server.
--profileA profile ID to associate with the new container. To associate multiple profiles with the container, specify this flag multiple times on the command line—for example, --profile foo --profile bar. If no profile is specified, the container is associated with the default profile.
--resolverSpecifies how the container will report its address to other containers. Valid values are localip, localhostname, publicip, publichostname, manualip. For more information see Section 9.20, “fabric:container-resolver-set”.
-m, --manual-ipThe IP address to use, when using the manualip resolver. Used in combination with the --resolver option.
-b, --bind-addressSpecifies the default bind address.
--datastore-typeSpecifies the datastore type.
--datastore-optionOptions to pass to the container's datastore. To specify multiple options, use this flag multiple times.
--zookeeper-passwordUsed in combination with the --ensemble-server option. If creating an ensemble server, specifies the Zookeeper password to use (if not specified, a password is generated automatically).
--versionSpecifies the version of the new container (the version must be created in advance using fabric:version-create). Defaults to the current default version (use version-list to find the current default).
--jvm-optsSpecify options to pass to the container's JVM.
Parent (Required) The parent container ID.
Name(Required) The name of the container to create. When creating multiple containers, it serves as a prefix
NumberThe number of containers that should be created.

Related topics

For more details about resolver policies, see:
fabric:container-resolver-list
fabric:container-resolver-set
fabric:create