IBM Streams 4.2.1

Using tags to restrict IBM Streams resources

You can use tags to restrict IBM® Streams resources for a specific application purpose. The TagRestriction that you create instructs the scheduler to place on the resource only the PEs that refer to a host pool that specifies that tag.

About this task

You can also use the Management Dashboard in the Streams Console to create a TagRestriction. Select Manage Resources and Tags to choose the resources and tags that you want to restrict.

For more information about the streamtool commands that are used to restrict resources, enter streamtool man command-name.

Procedure

Creating a TagRestriction with IBM Streams resources:

  1. Create the tag, for example:
    streamtool mktag -d Domain1 SpecialPurpose --description
     "Special purpose tag used as an example to create a TagRestriction"
    Note: Only user-defined tags can be used to create aTagRestriction.
  2. Add the tag to a resource, for example:
    streamtool chhost -d Domain1 --add --tags SpecialPurpose HostA
  3. Restrict the resource with the tag, for example:
    streamtool restrictdomainhost --allow-active-instances
     -d Domain1 --tags SpecialPurpose HostA
    Notes:
    • If --allow-active-instances is not specified, instances must be stopped when you run the command. Otherwise, the command returns an error.
    • Specifying --allow-active-instances skips the check for running instances. The TagRestriction is created only if all running PEs reference the host pool that contains the tag. If PEs are running that do not reference a host pool that contains the tag, these PEs must be stopped before the TagRestriction can be created.
  4. Add a resource with the TagRestriction to an instance by using either of the following methods.
    • Add the resource by host name or IP address, for example:
      streamtool addhost -d Domain1 -i Instance1 HostA
    • Add a resource specification that includes the TagRestriction, for example:
      streamtool addresourcespec -d Domain1 -i Instance1
       --numresources 1,SpecialPurpose*
      Notes:
      • A resource specification with a TagRestriction contains the tag name with an asterisk (*).
      • If you already have a resource specification that includes the tag but not the TagRestriction, you can add the asterisk (*) to the end of the tag by using the streamtool chresourcespec command.
      • When creating an instance, you can specify a resource specification with a TagRestriction by using the streamtool mkinstance command.

Results

With the TagRestriction in place, in this example, the scheduler allows placements of PEs only if the PEs refer to a hostpool that specifies the SpecialPurpose tag.

What to do next

  • To remove a TagRestriction for IBM Streams resources, use the streamtool unrestrictdomainhost command, for example:
    streamtool unrestrictdomainhost -d Domain1 --tags SpecialPurpose HostA

  • To see which tags are restricted on the resources in a domain, use streamtool lsavailablehosts -d Domain1 or streamtool getdomainstate -d Domain1 command. In the command output, an asterisk (*) indicates that a tag is restricted.

  • To see which tags are restricted on the resources in an instance, use streamtool lshosts -d Domain1 -i Instance1 -l or streamtool getinstancestate -d Domain1 -i Instance1 command. In the command output, an asterisk (*) indicates that a tag is restricted.