streamtool mkinstance
Usage
mkinstance [-d,--domain-id <did>]
[-i,--instance-id <instance>] [--hfile <host-file>]
[--propfile <property-file>] [--hosts <host>,...]
[--numresources <number[,tag,...]["[exclusive]" | "[shared]"]
where number > 0>] ... [--property <name=value>] ...
[--admin-grp <group>] [--user-grp <group>] [-U,--User
<user>] [-h,--help] [--trace <level>] [-v,--verbose
<level>] [--zkconnect {<host>:<port>},... |
--embeddedzk]
The streamtool mkinstance command creates an instance in the domain.
Authority
You must have add authority for the instances domain object. By default, the DomainAdministrator role has this authority. For more information about access control lists, see streamtool getdomainacl.
Description
The following command is an example of the simplest mkinstance command:
streamtool mkinstance -d domainA --zkconnect host1:1234
The instance identifier must satisfy the following requirements:
- The name must be unique among the instances that are defined by you, the instance owner, within the domain.
- The name must contain alphanumeric characters. You cannot use
the following alphanumeric characters:
^!#$%&'*+,/;<>=?@[]`{|}˜()
. You also cannot use the following Unicode and hexadecimal characters:u0000
;u0001-u001F
;u007F-u009F
;ud800-uF8FF
;uFFF0-uFFFF
;x{10000}-x{10FFFF}
. - The name cannot be
zookeeper
. - The maximum length for the name is 255 bytes.
By default, members of the InstanceAdministrator role can administer the instance and members of the InstanceUser role can use the instance. The group that is specified in the --admin-grp option is added to the InstanceAdministrator role. The group that is specified in the --user-grp option is added to the InstanceUser role.
You can add hosts (also known as Streams resources) to the
instance by using the --hfile and --hosts options.
You can also add Streams resources and externally managed resources
to the instance by using the --numresources option. If you
do not specify one of those options, the following resource
specification is added when the instance starts:
--numresources 1
. You can also add resources by
using the streamtool addhost and addresourcespec
commands. The Streams resources that are identified by using the
--hfile and --hosts options cannot be used to satisfy
--numresources specifications within the instance.
Tags can affect the selection of static and dynamic resources at instance creation time and when resources are added to an instance.
Streams defines the following tags:
- application
- Specifies that the resource can run Streams applications.
- audit
- Specifies that the resource can run the logging service.
- authentication
- Specifies that the resource can run the authentication and authorization service.
- jmx
- Specifies that the resource can run the management API service.
- management
- Specifies that the resource can run any of the Streams domain and instance management services.
- sws
- Specifies that the resource can run the web management service.
- view
- Specifies that the resource can run the view service.
You can define extra tags that meet your needs.
Adding an asterisk (*) to the tag name indicates that you want a resource with the tag restricted.
When Streams assigns management services to the resources, the resources are considered in the order in which they are stated by the resource identification options. When you specify Streams resources in --hfile or --hosts options, they are considered before any resources that you specify in --numresources options. For more information about adding resources to Streams instances, see the product documentation.
If you have a long list of command options and instance properties, you can use the --propfile option. This option is also helpful if you want to use the same set of options or properties in multiple streamtool mkinstance commands.
After you create an instance, by default only the instance owner can change the configured resources and properties. The instance owner can also start and stop the instance. You can authorize more users to configure and administer the instance by using the Streams Console or the streamtool setacl command.
Options
- --admin-grp <group>
- Specifies a group whose members can administer the instance.
This group is added to the InstanceAdministrator role. If this
option is not specified, only the following users can administer
the instance:
- Users that have the DomainAdministrator or InstanceAdministrator roles.
- The user that ran the streamtool mkinstance command, or the user that is specified in the -U or --User option.
- -d,--domain-id <did>
- Specifies the domain identifier.
If you do not specify this option, Streams uses the domain name that is set in the STREAMS_DOMAIN_ID environment variable. By default, that domain name is
StreamsDomain
. If you are using the interactive streamtool interface, it uses the name of the active domain for the current streamtool session or else it prompts you for the domain name.The active domain for the current streamtool session is set every time that you successfully run a streamtool command with a -d or --domain-id option. Alternatively, you can run the streamtool domain command in the interactive interface.
- --embeddedzk
Specifies to use the embedded copy of ZooKeeper. This option is not supported within the interactive streamtool interface.
If you are not using the interactive streamtool interface and you do not specify either this option or the --zkconnect option, Streams uses the ZooKeeper connection that is associated with the active domain or the domain that is specified in the --domain-id option. Streams determines which connection maps to the domain by using cached information about the domains. In this scenario, if the domain identifier is not unique in the Streams configuration cache, the command fails.
- -h,--help
- Specifies to show the command syntax.
- --hfile <host-file>
- Specifies the path to a file, which can contain host
identifiers and --numresources specifications.
A host identifier can be a host name or IP address. The host name can be a simple or fully qualified domain name. Each host identifier must be on a separate line in the file. The host specification syntax is:
hostname
This syntax differs from the syntax in previous releases of Streams, where you could specify tags with the host names. If you use the old syntax, the command returns an error.You can use the --numresources option to specify the number of resources without having to specify host identifiers. Streams selects the specified number of resources from a list of available resources.
Explicit hosts are added to the instance immediately. When the instance starts, resources that were specified in a --numresources specification are assigned to the instance based on their tags.
The file can also contain comment lines (blank lines or lines where the first non-whitespace character is a '#').
For example:
host1 1.3.45.6 --numresources 1,authentication[exclusive]
- --hosts <host>
- Specifies one or more host identifiers. A host identifier can be a host name or IP address.
- -i,--instance-id <instance>
- Specifies the instance identifier.
If you do not specify this option, Streams uses the instance identifier that is set in the STREAMS_INSTANCE_ID environment variable. By default, that instance identifier is
StreamsInstance
. If you are using the interactive streamtool interface, it tries to use an instance ID that you specified in a previous command. If no such value is found, the command uses the STREAMS_INSTANCE_ID environment variable. Alternatively, you can run the streamtool instance command in the interactive interface. - --numresources <number[,tag,...]["[exclusive]" | "[shared]"] where number > 0>
- Specifies to get the designated number of available resources
from the domain. You can also specify optional resource selection
criteria.
The --numresources specification syntax is:
number-of-resources,optional-selection-tags optional TagRestriction marker[optional-sharing-mode]
where number-of-resources is a number greater than 0, optional-selection-tags is',tag,...'
, optional TagRestriction marker is * (asterisk), and optional-sharing-mode is[shared]
or[exclusive]
.Examples of --numresources specifications are:
--numresources 2
, which is a shared request for two hosts with the 'execution' or no tags.--numresources 2[exclusive]
, which is an exclusive request.--numresources 1,ingest
, which is a shared request for one host with the 'ingest' tag.--numresources 1,ingest*
, which is a shared request for one host with the 'ingest' tag and a TagRestriction between the new resource and this tag.--numresources 1,ingest[exclusive]
, which is an exclusive request.
The specification can indicate a sharing mode:
[shared]
or[exclusive]
. Specifications are shared by default. Resources that are selected by a shared specification can be used to satisfy other shared specifications. When an instance adds a resource by using an exclusive specification, the resource cannot be used by other instances in the domain.The specification can indicate a restriction between a tag and a resource. An asterisk (*) on the tag name provides the marker for this TagRestriction.
The resource selection processing strives to select the least number of available resources that satisfy all of the --numresources specifications.
- --property <name=value>
- Specifies a property name and value pair to add to or change in the configuration. This option can be specified multiple times and has an additive effect.
- --propfile <property-file>
- Specifies the path for a file that contains a list of instance
properties and command options, each on a separate line. You can
specify:
- Command options and their values. For example:
admin-grp=myGrp
- You must use the long version of the command option.
- If the list includes domain-id, instance-id, or zkconnect options, they are ignored.
- Options that you specify at the command line override values that were specified in this property file.
- Instance properties and their values. For example:
property.1=instanceTrace.defaultLevel=warn
. The property statements must each have a unique number. For a list of instance properties, see streamtool man properties.
- Command options and their values. For example:
- --trace <level>
- Specifies the trace setting. The following valid levels are
listed in order of increasing verbosity, which is to say that the
first level in the list generates the least amount of information:
off
error
warn
info
debug
trace
off
. - -U,--User <user>
- Specifies an Streams user ID that has authority to run the command.
- --user-grp <group>
- Specifies a group whose members can use the instance. This
group is added to the InstanceUser role. If this option is not
specified, only the following users can use the instance:
- Users that have the InstanceUser role.
- The user that ran the streamtool mkinstance command, or the user that is specified in the -U or --User option.
- -v,--verbose <level>
- Specifies to provide more detailed command output. The
verbosity level can be
0
-3
, where0
disables detailed reporting and each increment provides more detailed output. - --zkconnect <{<host>:<port>},...>
The name of one or more host and port pairs that specify the configured ZooKeeper servers. This option is not supported within the interactive streamtool interface.
If you are not using the interactive streamtool interface and you do not specify this option, Streams tries to use:
- The --embeddedzk option
- The value from the STREAMS_ZKCONNECT environment variable
- A ZooKeeper connection string that is derived from cached information about the current domain.
Examples
The following command creates an instance that is called myInstance and allocates hostA and hostB to the instance:
[streamtool <bsmith@StreamsDomain.StreamsInstance>] mkinstance -i myInstance --hosts hostA,hostB --numresources 1,management
When the instance is started, a resource that is tagged as "management" is also assigned to the instance.