Configuring an instance to use dynamic resource allocation
You can configure an instance to dynamically allocate resources depending on the needs of the job. When a job is submitted, resources are acquired from the domain to support these jobs and are released when they are no longer needed.
Before you begin
- Create a domain. For more information, see Creating domains. The following sample commands create and start an enterprise domain that uses PAM for user authentication.
export STREAMS_ZKCONNECT=192.168.1.100:2181,192.168.1.101:2182 streamtool mkdomain -d myDomain streamtool genkey -d myDomain streamtool startdomain -d myDomain
- Add Teracloud®
Streams hosts or externally managed resources to the domain or instance to support the needs of the
jobs in the instance. For more information, see
Adding resources to Teracloud Streams instances. Important: When you add a resource to a domain, make sure to consider the tagging requirements of the applications that will run in the instances in the domain. For information about using tags to restrict resources, see Using tags to restrict resources.The following sample streamtool commands add a Teracloud® Streams host with a tag to a development environment.
streamtool adddomainhost -d MyDomain MyHost streamtool chhost --tags MyTag MyHost
The following sample streamtool command adds a Teracloud® Streams host with a tag to a production environment.streamtool registerdomainhost -d MyDomain --tags MyTag
About this task
Configuring dynamic resource allocation consists primarily of setting the domain or instance properties that control it.
Procedure
Create the instance in the domain and set the following properties.
- applicationResourceAllocationMode: Set to job.
- dynamicResourceAllocationEnabled: Set to true.
- jobResourceSharing: Set to the sharing behavior (sameJob, sameUser, sameInstance) that you want to enable for the instance. For more information about the jobResourceSharing property, see Resource allocation for application services.
The following sample streamttool command creates the
myInstance
instance and sets the required properties. Enter the following command
on the same
line.
streamtool mkinstance -d myDomain -i myInstance
--property instance.applicationResourceAllocationMode=job
--property instance.dynamicResourceAllocationEnabled=true
--property instance.jobResourceSharing=sameJob
Results
Remember: Dynamically allocated resources are allocated exclusively. While a resource is
allocated to a specific instance, it is not available for dynamic allocation to another
instance.