検索

このコンテンツは選択した言語では利用できません。

C.5. Substituting ZooKeeper node contents

download PDF

Syntax

You can substitute the contents of a ZooKeeper node using the zk property resolver. The property resolver can be specified either as an absolute node:
${zk:/PathToNode}
Or you can reference configuration properties from a specific container using the following syntax:
${zk:ContainerName/Property}
The preceding syntax is effectively a short cut to the following property resolver:
${zk:/fabric/registry/containers/config/ContainerName/Property}

Recursive variable substitution

It is also possible to use a variable within a variable (recursive substitution). For example, the dosgi profile's io.fabric8.dosgi.properties resource defines the following property:
exportedAddress=${zk:${karaf.name}/ip}

How to reference the current version of a resource

A potential problem arises with ZooKeeper property resolver if you need to reference a ZooKeeper node that has a version number embedded in it. For example, suppose you want to reference the my-profile profile's my-resource resource, which can be done using the following ZooKeeper URL:
 ${zk:/fabric/configs/versions/1.0/profiles/my-profile/my-resource}
Notice that the profile version number, 1.0, is embedded in this path. But if you decide to upgrade this profile to version 1.1, this means you must manually edit all occurrences of this ZooKeeper URL, changing the version number to 1.1 in order to reference the upgraded resource. To avoid this extra work, and to ensure that the resolver always references the current version of the resource, you can use the following trick which exploits recursive variable substitution:
 ${zk:/fabric/configs/versions/${zk:/fabric/configs/containers/${karaf.name}}/profiles/my-profile/my-resource}
This works because the /fabric/configs/containers/${karaf.name} ZooKeeper node contains the current profile version deployed in the container.
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.