Pesquisar

Este conteúdo não está disponível no idioma selecionado.

A.3. Editing Other Resources

download PDF

Overview

In addition to agent properties and PID properties, the built-in text editor makes it possible for you edit any resource associated with a profile. This is particularly useful, if you need to store additional configuration files in a profile. The extra configuration files can be stored as profile resources (which actually correspond to ZooKeeper nodes) and then can be accessed by your applications at run time.
Note
The ZooKeeper registry is designed to work with small nodes only. If you try to store a massive configuration file as a profile resource, it will severely degrade the performance of the Fabric registry.

Creating and editing an arbitrary resource

You can create and edit arbitrary profile resources using the following command syntax:
JBossFuse:karaf@root> profile-edit --resource Resource Profile [Version]
Where Resource is the name of the profile resource you want to edit. If Resource does not already exist, it will be created.

broker.xml example

For example, the mq-base profile has the broker.xml resource, which stores the contents of an Apache ActiveMQ broker configuration file. To edit the broker.xml resource, enter the following console command:
JBossFuse:karaf@root> profile-edit --resource broker.xml mq-base 1.0
The text editor starts up, and you should see the following screen in the console window:
Profile:mq-base 1.0                                                                       L:1 C:1
<!--
  Copyright (C) FuseSource, Inc.
  http://fusesource.com

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties and fabric as variables in this configuration file -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="properties">
            <bean class="io.fabric8.mq.fabric.ConfigurationProperties"/>
        </property>

      ^X Quit    ^S Save    ^Z Undo    ^R Redo    ^G Go To    ^F Find    ^N Next    ^P Previous
Any changes you make to this file will take effect whenever the broker restarts.
Type ^X to quit the text editor and get back to the console prompt.

Referencing a profile resource

In order to use an arbitrary profile resource, you must be able to reference it. Because a profile resource is ultimately stored as a ZooKeeper node, you must reference it using a ZooKeeper URL. For example, the broker.xml resource from the previous example is stored under the following ZooKeeper location:
zk:/fabric/configs/versions/1.0/profiles/mq-base/broker.xml
In general, you can find version, Version, of the Profile profile's Resource resource at the following location:
zk:/fabric/configs/versions/Version/profiles/Profile/Resource
For example, the mq profile's io.fabric8.mq.fabric.server-broker PID defines the following properties, where the config property references the broker.xml resource:
connectors=openwire
config=zk\:/fabric/configs/versions/1.0/profiles/mq-base/broker.xml
group=default
standby.pool=default
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.