Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Code Block
usage: topo <subcommand> <options>

This command is used to register containers in STR and to create, update, remove, and view pico configurations.

...

Info

Example - Converting an XML fileFile

Code Block
languagetext
$ mzsh topo convert --container main1 

...

Option

Description

[-e, --show-entries]

Use this option for viewing differences in an easy-to-read format. By default, the output from the command displays topo set commands that correspond to the staged changes.

Info

Example - Output from diff commandCommand

 With -e option:

Code Block
UPDATE   (containers/main1/picos/ec1.conf) config.properties.aaa:"2"  # (was: "1") 

Without -e option:

Code Block
mzsh topo set topo://container:main1/pico:ec1/val:config.properties.aaa "2"  # (was: "1")

[ -f, --from] <registry>

Use this option when you want to compare the active registry with the backup registry

[-q, --brief]

Use this option to only view the names of the updated registry files. The default value is false.

Info

Example - Comparing registry filesRegistry Files

Run the following command to view the differences between the active registry and the master registry.

Code Block
languagetext
$ mzsh topo diff

or

Code Block
languagetext
$ mzsh topo diff --from master

Run the following command to view the differences between the active registry and the backup registry.

Code Block
languagetext
$ mzsh topo diff --from backup

...

Use topo env to display or set environment variables that are used my the mzsh command. These variables are written to the script file MZ_HOME/bin/mzsh.      

Option

Description

[-e, --effective]

Use this option to read the environment parameters in runtime, i e the "effective values" after accounting for overrides. The default behaviour is to read the values as they are defineds in the mzsh script file, not accounting for the possibility to override these values with environment  variables. 

[--update-java-home <value>]

Use this option to update the value of JAVA_HOME

[ --update-mz-container <value>]

Use this option to update the value of MZ_CONTAINER.

[--update-mz-home <value> ]

Use this option to update the value of MZ_HOME.

[--update-mz-platform <value> ]

Use this option to update the mzsh value of MZ_PLATFORM.

Info

Example - Reading the environment variablesEnvironment Variables

Code Block
$ mzsh topo env
export JAVA_HOME="/opt/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home"
export MZ_CONTAINER="main1"
export MZ_CONTAINER_TYPE="platform"
export MZ_PLATFORM="http://localhost:9000"
export MZ_HOME="/user/home/mz/main1"
Info

Example - Setting the environment variable Environment Variable JAVA_HOME

Code Block
$ mzsh topo env --update-java-home /opt/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

...

Option

Description

[--default-val <value>]

Use this option to replace a missing value in the target path with a default value.

Info

Example - Using default-val

If the property aaa, is not defined for ec1, 123 is returned instead.

Code Block
languagetext
$ mzsh topo get -l --default-val 123 \
topo://pico:ec1/val:config.properties.aaa

[ --exclude-dynamic]

Use this option to exclude non-static data in the output e g _status in a pico configuration. This is useful in case of errors that blocks the topo command.

[--format <full|data-only>]

Use this option to exclude metadata from the command output.

  • full - Include meta data

  • data-only - exclude meta data

Default: full

[-l, --local]

Use this option to select the local container, unless another container is specified in the target path.

Default: false

[-p, --perspective <resolve | default>]

Use this option to retrieve the attributes of templates instead of the template names.

  • resolve - attributes

  • default - template names

Default: default

Info

Example - Viewing pico configurationsPico Configurations

Run the following command to view one or more pico configurations.

Code Block
languagetext
$ mzsh topo get topo://container:main1/pico:ec2 

You can view multiple pico configurations by replacing the full path with a regular expression.

Code Block
languagetext
$ mzsh topo get topo://container:main1/pico:.*
Info

Example - Viewing pico attributesPico Attributes

Run the following command to view a specific attribute in a pico configuration.

Code Block
languagetext
$ mzsh topo get topo://container:main1/pico:ec2/val:_name

You can retrieve the attributes of multiple pico processes by replacing the full path with a regular expression.

Code Block
languagetext
$ mzsh topo get --format data-only topo://container:main1/pico:.*/val:_name

...

Use topo hash to retrieve a value that represents the current state of the active registry. This is useful when you need to handle concurrent changes of the STR. For instance, an application may need to retrieve a pico configuration to evaluate the required changes. In the meantime, a second application or a user may update the same configuration

Info

Example - Using hash valuesHash Values

  1. Application 1 retrieves a new hash value.

    Code Block
    languagetext
    $ mzsh topo hash 
    "3a2e373fa1653c7f0e757e2682c70317-2028777631"
  2. Application 1 retrieves the properties of ec1.

    Code Block
    languagetext
    $ mzsh topo get -l pico:ec1/obj:config.properties
  3. Application 1 updates a property but does not call topo activate. The hash is specified to ensure that changes by other users are not activated inadvertently later on.

    Code Block
    languagetext
    $ mzsh topo set -l --no-activation --hash 3a2e373fa1653c7f0e757e2682c70317-2028777631 \ 
    topo://pico:ec1/val:config.properties.ec.httpd.port 9090 
  4. Application 2 updates the properties of ec1. The hash value is updated.

    Code Block
    languagetext
    $ mzsh topo set -l topo://pico:ec1/val:config.properties.ec.httpd.port 9090
  5. Application 1 calls topo activate with hash value retrieved in step 1.

    Code Block
    languagetext
    $ mzsh topo activate --hash 3a2e373fa1653c7f0e757e2682c70317-2028777631
  6. The activation fails since the hash values do not match.

    Code Block
    Specified hash does not match transaction id:  d9cd38f3793647028bd7e5d64c354ad5-2055434210 != 3a2e373fa1653c7f0e757e2682c70317-2028777631)
    This may indicate concurrent modification of registry: Operation aborted!
  7. Application 1 resets the master registry, retrieves a new hash and starts over.

    Code Block
    languagetext
    $ mzsh topo reset
    $ mzsh topo hash 

...

Code Block
languagetext
$ mzsh topo open cell:<cell>
Info

Example - Opening a cell configurationCell Configuration

Code Block
languagetext
$ mzsh topo open cell:default

...

Code Block
languagetext
$ mzsh topo open <container>
Info

Example - Opening a container configurationContainer Configuration

Code Block
languagetext
$ mzsh topo open main1

...

Code Block
languagetext
$ mzsh topo open <pico>
Info

Example - Opening a pico configurationPico Configuration

Code Block
languagetext
$ mzsh topo open ec1

or

Code Block
languagetext
$ mzsh topo open container:main1/pico:ec1

If the pico name is not unique in the system, you will be prompted to specify the container.

Info

Example - Multiple pico configuration sharing the same namePico Configurations Sharing the Same Name

Code Block
languagetext
$ mzsh topo open ec2 (/home/main1/common/config/cell/default/master/containers/main1/picos/ec2.conf,ec2,topo://container:main1/pico:ec2)
(/home/main1/common/config/cell/default/master/containers/exec1/picos/ec2.conf,ec2,topo://container:exec1/pico:ec2)

Multiple entries, select one:
 (1) topo://container:main1/pico:ec2
 (2) topo://container:exec1/pico:ec2
 [1] :

...

Code Block
languagetext
$ mzsh topo open services:<custom|standard>
Info

Example - Opening a service configurationService Configuration

Code Block
languagetext
$ mzsh topo open services:custom

...

Info

Example - Setting nano as the default editorDefault Editor

Code Block
$ export EDITOR=nano

...

Info

Example - Rebasing an EC configurationConfiguration

Code Block
$ mzsh topo rebase-configs topo://container:main1/pico:ec1$ mzsh topo active --verbose

or

Code Block
mzsh topo rebase-configs --actoivate topo://container:main1/pico:ec1

...

The <config> argument may contain a key-value pair that specifies a template or a pico configuration in HOCON format.

Info

Example - Creating a new pico configuration based New Pico Configuration Based on a templateTemplate

Code Block
languagetext
 $ mzsh topo set topo://container:main1/pico:ec2 template:mz.standard-ec
Info

Example - Creating pico configurationPico Configuration

When you specify a pico configuration that consists of multiple attributes, it is recommended that you use multi-line strings.  

HOCON Format:

Code Block
languagetext
$ mzsh topo set --local pico:ec2 '
{
	template:mz.standard-ec
	config {
		properties {
			ec.httpd.port : 9092
		} 
		classpath {
			jars=["lib/picostart.jar"]
		}
	}
}'

JSON Format:

Code Block
languagetext
mzsh topo set -l --strict-json pico:ec2 '
{
	"template": "mz.standard-ec",
	"config": {
		"properties": {
			"ec": {
				"httpd": {
					"port": 9092
				}
			}
		},
		"classpath": {
			"jars": ["lib/picostart.jar"]
		}
	}
}'

Add the pico group setting by using the following topo command

Code Block
mzsh topo set topo://container:main1/pico:ec1/val:config.properties.pico.groups "ec1, ec2"

This command makes the Execution context "EC1" a member of the "ec1" and "ec2" groups. 

This is the HOCON example format adding in ECs to a pico group. 

Code Block
config {
    classpath {}
    jvmargs {
        args=[]
    }
    properties {
        mz.webserver.xframeoptions=DENY
        pico.groups="ec1, ec2"
        ec.backlog.dir="/home/davids/git/mz9/mediationzone/mz-dist/../mzhomes/mz9/tmp"
        ec.webserver.port=9137
    }
    vendor-jvmargs {
        hp {}
        sun {}
    }
}

...

mzsh topo set topo://container:<container>/pico:<pico>/val:<attribute> <attribute value>

Info

Example - Updating a pico attributePico Attribute

Code Block
languagetext
$ mzsh topo set topo://container:main1/pico:ec2/val:ec_type ec

...

The <config> argument may contain a pico configuration in HOCON format.

Info

Example - Updating a pico objectPico Object

This command adds the properties value1 and value2:

Code Block
languagetext
$ mzsh topo set topo://container:main1/pico:ec2/obj:config.properties.example_object '{
 value1=1
 value2=2
}'

The following commands does not overwrite the properties value1 and value2 in example_object but adds value3:

Code Block
$ mzsh topo set topo://container:main1/pico:ec2/obj:config.properties.example_object '{
 value3=3
}'

...

mzsh topo unset topo://container:<container>/pico:<pico>

Info

Example - Removing a pico configurationPico Configuration

Code Block
languagetext
$ mzsh topo unset topo://container:main1/pico:ec2

Info

Example - Removing a pico attributePico Attribute

Code Block
languagetext
$ mzsh topo unset topo://container:main1/pico:ec2/val:ec_type ec

Excerpt

File Paths in Attributes

When you enter a path that is relative to MZ_HOME in the value of an attribute, it is recommend that you use ${mz.home} as a substitution.

In the following example MZ_HOME will be resolved to its current value e g /home/user/mz.

Info

Example - Resolved pathPath

Code Block
languagetext
$ mzsh topo set topo://container:main1/val:common.pico.rcp.tls.keystore $MZ_HOME/keys/platform.keys

The next example uses a path that is always relative to MZ_HOME.

Info

Example - Substituted pathPath

Code Block
languagetext
$ mzsh topo set topo://container:main1/obj:common.pico.rcp.tls.keystore '{ keystore=${mz.home}"/keys" }'

When you are using ${mz.home} as a substitution, ensure to set attributes as part of an object, using the obj keyword.

Conflicting Attributes

The name of an attribute may contain the full name of another attribute. For instance, mz.httpd.security.keystore is a system property but its name is also a part of mz.httpd.security.keystore.password.

In this case you must ensure that the name of both properties are surrounded by quotes, or one of the properties will be overwritten at activation.

Info

Example - Handling conflicting attributes, manual editingConflicting Attributes, Manual Editing

Code Block
common : {
    "pico.rcp.tls.keystore" : "home/mz/keys",
    "pico.rcp.tls.keystore.password" : "..."
}

When there are conflicting properties and you are using the mzsh topo command, also add single quotes, surrounding the target path (topo://..).

Info

Example - Handling conflicting attributes, scripted editingConflicting Attributes, Scripted Editing

Code Block
$ mzsh topo set 'topo://container:<platform container>/val:common."pico.rcp.tls.keystore"' "home/mz/keys"
$ mzsh topo set 'topo://container:<platform container>/val:common."pico.rcp.tls.keystore.password"' "..."

...

You can update the IP address, hostname, and ports int he JDBC URL using the mzsh topo get and mzsh topo set commands as shown in the examples below.

Info

Example - Get current config Current Config

Code Block
languagebash
$ mzsh topo get -s --format data-only topo://container:platform1/pico:platform/obj:config.properties.mz.jdbc
	{
		"password": "DR-4-48851644227183C2041D838568E117EC",
		"oracle": {
		"ons": ""
		},
		"type": "oracle",
		"user": "mzadmin",
		"url": "jdbc:oracle:thin:@//127.0.0.1:1521/orcl"
	}

...