Развертывание Activemq в кластере Azure Kubernetes завершается неудачно, когда мы пытаемся сохранить данные, используя azure хранилище - PullRequest
0 голосов
/ 17 апреля 2020

Состояние Pod отображается как работающее, но когда мы смотрим журналы ниже, появляется сообщение об ошибке.

INFO: Loading '/opt/activemq/bin/env'
INFO: Using java '/docker-java-home/jre/bin/java'
bin/activemq: 1: bin/activemq: ps: not found
INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)
INFO: Creating pidfile /opt/activemq/data/activemq.pid
Java Runtime: Oracle Corporation 1.8.0_181 /usr/lib/jvm/java-8-openjdk-amd64/jre
  Heap sizes: current=62976k  free=58715k  max=932352k
    JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/opt/activemq/tmp -Dactivemq.classpath=/opt/activemq/conf:/opt/activemq/../lib/: -Dactivemq.home=/opt/activemq -Dactivemq.base=/opt/activemq -Dactivemq.conf=/opt/activemq/conf -Dactivemq.data=/opt/activemq/data
Extensions classpath:
  [/opt/activemq/lib,/opt/activemq/lib/camel,/opt/activemq/lib/optional,/opt/activemq/lib/web,/opt/activemq/lib/extra]
ACTIVEMQ_HOME: /opt/activemq
ACTIVEMQ_BASE: /opt/activemq
ACTIVEMQ_CONF: /opt/activemq/conf
ACTIVEMQ_DATA: /opt/activemq/data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@6e06451e: startup date [Fri Apr 17 17:11:32 UTC 2020]; root of context hierarchy
 INFO | Using Persistence Adapter: MultiKahaDBPersistenceAdapter[/opt/activemq/data/kahadb][KahaDBPersistenceAdapter[/opt/activemq/data/CalcJobStatus-kahadb/queue#3a#2f#2fCalcJobStatusQueue], KahaDBPersistenceAdapter[/opt/activemq/data/large-message-kahadb/success.#3e#2cfailure.#3e], KahaDBPersistenceAdapter[/opt/activemq/data/default-kahadb/#210]]
 INFO | JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
 INFO | KahaDB is version 6
 INFO | KahaDB is version 6
 INFO | KahaDB is version 6
 INFO | PListStore:[/opt/activemq/data/5.13.0/tmp_storage] started
 INFO | Apache ActiveMQ 5.15.6 (5.13.0, ID:activemqcontainer-d8b9665c6-rkg4j-33325-1587143494107-0:1) is starting
 INFO | pending local transactions: []
 INFO | Listening for connections at: tcp://activemqcontainer-d8b9665c6-rkg4j:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600&wireFormat.maxInactivityDuration=300000&keepAlive=true&stackTraceEnabled=false&cacheEnabled=false
 INFO | Connector openwire started
 INFO | Apache ActiveMQ 5.15.6 (5.13.0, ID:activemqcontainer-d8b9665c6-rkg4j-33325-1587143494107-0:1) started
 INFO | For help or more information please see: http://activemq.apache.org
 WARN | Failed startup of context o.e.j.w.WebAppContext@4d9ac0b4{/admin,file:/opt/apache-activemq-5.15.6/webapps/admin/,null}
java.lang.IllegalStateException: Parent for temp dir not configured correctly: writeable=false
        at org.eclipse.jetty.webapp.WebInfConfiguration.makeTempDirectory(WebInfConfiguration.java:336)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebInfConfiguration.resolveTempDirectory(WebInfConfiguration.java:304)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:69)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:468)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:504)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.security.SecurityHandler.doStart(SecurityHandler.java:391)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.security.ConstraintSecurityHandler.doStart(ConstraintSecurityHandler.java:449)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]

Ниже приведены файлы, используемые для развертывания activemq, и используемое изображение https://hub.docker.com/r/rmohr/activemq/

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: azure-managed-disk
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: managed-premium
  resources:
    requests:
      storage: 10Gi

apiVersion: v1
kind: ConfigMap
metadata:
  name: active-mq-xml
data:
 activemq.xml: |
    <?xml version="1.0" encoding="UTF-8"?>

    <beans xmlns="http://www.springframework.org/schema/beans"
        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 as variables in this configuration 
            file -->
         <!-- Allows us to use system properties as variables in this configuration file -->
        <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <value>file:${activemq.conf}/credentials.properties</value>
            </property>
        </bean>

       <!-- Allows accessing the server log -->
        <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
              lazy-init="false" scope="singleton"
              init-method="start" destroy-method="stop">
        </bean>

        <!-- The <broker> element is used to configure the ActiveMQ broker. -->
        <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="5.13.0" dataDirectory="${activemq.data}" advisorySupport="false" useJmx="true">

            <destinationPolicy>
                <policyMap>
                    <policyEntries>
                        <policyEntry queue=">" enableAudit="false" />
                    </policyEntries>
                </policyMap>
            </destinationPolicy>


            <!-- The managementContext is used to configure how ActiveMQ is exposed 
                in JMX. By default, ActiveMQ uses the MBean server that is started by the 
                JVM. For more information, see: http://activemq.apache.org/jmx.html -->
            <managementContext>
                <managementContext createConnector="true" />
            </managementContext>

            <!-- Configure message persistence for the broker. The default persistence 
                mechanism is the KahaDB store (identified by the kahaDB tag). For more information, 
                see: http://activemq.apache.org/persistence.html -->
            <persistenceAdapter>
                <mKahaDB directory="${activemq.data}/kahadb">
                    <filteredPersistenceAdapters>
                        <filteredKahaDB queue="Queue">
                            <persistenceAdapter>
                                <kahaDB directory="${activemq.data}/Queue-kahadb" />
                            </persistenceAdapter>
                        </filteredKahaDB>
                        <filteredKahaDB queue="success.>,failure.>">
                            <persistenceAdapter>
                                <kahaDB directory="${activemq.data}/large-message-kahadb" />
                            </persistenceAdapter>
                        </filteredKahaDB>
                        <filteredKahaDB>
                            <persistenceAdapter>
                                <kahaDB directory="${activemq.data}/default-kahadb" />
                            </persistenceAdapter>
                        </filteredKahaDB>
                    </filteredPersistenceAdapters>
                </mKahaDB>
            </persistenceAdapter>


            <!-- The systemUsage controls the maximum amount of space the broker will 
                use before disabling caching and/or slowing down producers. For more information, 
                see: http://activemq.apache.org/producer-flow-control.html -->
            <systemUsage>
                <systemUsage sendFailIfNoSpace="true">
                    <memoryUsage>
                        <memoryUsage percentOfJvmHeap="70" />
                    </memoryUsage>
                    <storeUsage>
                        <storeUsage limit="1024 mb" />
                    </storeUsage>
                    <tempUsage>
                        <tempUsage limit="1024 mb" />
                    </tempUsage>
                </systemUsage>
            </systemUsage>

            <!-- The transport connectors expose ActiveMQ over a given protocol to 
                clients and other brokers. For more information, see: http://activemq.apache.org/configuring-transports.html -->
            <transportConnectors>
                <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
                        <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600&amp;wireFormat.maxInactivityDuration=300000&amp;keepAlive=true&amp;stackTraceEnabled=false&amp;cacheEnabled=false"/>
            </transportConnectors>


            <!-- destroy the spring context on shutdown to stop jetty -->
            <shutdownHooks>
                <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
            </shutdownHooks>

        </broker>

        <!-- Enable web consoles, REST and Ajax APIs and demos The web consoles 
            requires by default login, you can disable this in the jetty.xml file Take 
            a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details -->
        <import resource="jetty.xml" />

    </beans>


apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: activemqcontainer
spec:
  replicas: 1
  selector:
    matchLabels:
        app: activemqcontainer
  template:
    metadata:
      labels:
        app: activemqcontainer
    spec:
      securityContext:
        runAsUser: 1000
        fsGroup: 2000
        runAsNonRoot: false
      containers:
      - name: web
        image: aps2containerreg.azurecr.io/rmohractivemq
        imagePullPolicy: IfNotPresent
        ports:
          - containerPort: 61616
        volumeMounts:
        -  mountPath: /opt/activemq/data
           subPath: data
           name: volume
           readOnly: false
        - mountPath: /opt/activemq/conf/activemq.xml
          name: config-xml
          subPath: activemq.xml
          readOnly: false
      imagePullSecrets:
      - name: aps2secret
      volumes:
      - name: config-xml
        configMap:
            name: active-mq-xml
      - name: volume
        persistentVolumeClaim:
            claimName: azure-managed-disk

apiVersion: v1
kind: Service
metadata:
  name: activemqcontainer
spec:
  ports:
  - port: 61616
    targetPort: 61616
  selector:
    app: activemqcontainer

Пожалуйста, предложите что-нибудь не так в приведенной выше спецификации c и можем ли мы сохранить данные (/ opt / activemq / data) в общем хранилище, когда мы масштабируем экземпляры activemq

...