...
Code Block |
---|
language | bash |
---|
title | Установка Oracle Java 8 на Debian WheezyJessie |
---|
|
root@server:~# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trustyxenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trustyxenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections && \
aptitude update && \
aptitude install oracle-java8-installer |
Для Debian Wheezy рецепт тот же, но xenial
следует заменить на trusty
.
Code Block |
---|
language | bash |
---|
title | Проверка версии Java |
---|
|
root@server:~# java -version
java version "1.8.0_121144"
Java(TM) SE Runtime Environment (build 1.8.0_121144-b13b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.121144-b13b01, mixed mode) |
Настройка ActiveMQ
...
Основные параметры экземпляра брокера
Code Block |
---|
language | xml |
---|
title | /etc/hydra/activemq/instances-available/provisioning/activemq.xml |
---|
collapse | true |
---|
|
<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 http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="provisioning" dataDirectory="${activemq.data}">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:
http://activemq.apache.org/slow-consumer-handling.html
-->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
</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="false"/>
</managementContext>
<!--
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://127.0.0.1:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://127.0.0.1:61613?transport.hbGracePeriodMultiplier=1.5"/>
</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>
<camelContext xmlns="http://camel.apache.org/schema/spring" id="camel">
<route>
<from uri="oracleTopic:topic:AIS_NET.HP_COMMANDS_1?clientId=ActiveMQ&durableSubscriptionName=HP"/>
<to uri="activemq:queue:hydra_commands_1"/>
</route>
<route>
<from uri="activemq:queue:hydra_command_results_1"/>
<to uri="oracleTopic:topic:AIS_NET.HP_COM_RES_1?clientId=ActiveMQ&durableSubscriptionName=HP"/>
</route>
<route>
<from uri="oracleTopic:topic:AIS_NET.HP_PROFILES_1?clientId=ActiveMQ&durableSubscriptionName=HP"/>
<to uri="activemq:queue:hydra_profiles_1"/>
</route>
<route>
<from uri="oracleTopic:topic:AIS_NET.HP_EQUIPMENT_BINDS_1?clientId=ActiveMQ&durableSubscriptionName=HP"/>
<to uri="activemq:queue:hydra_equipment_binds_1"/>
</route>
</camelContext>
<bean id="activeMQConfig" class="org.apache.activemq.camel.component.ActiveMQConfiguration">
<property name="cacheLevelName" value="CACHE_CONSUMER" />
<property name="concurrentConsumers" value="1" />
</bean>
<bean id="connectionFactoryOracleAQTopic" class="oracle.jms.AQjmsFactory"
factory-method="getQueueConnectionFactory">
<constructor-arg index="0">
<value>jdbc:oracle:thin:@//127.0.0.1:1521/hydra</value>
</constructor-arg>
<constructor-arg index="1" type="java.util.Properties">
<value></value>
</constructor-arg>
</bean>
<bean id="oracleTopicCredentials" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory">
<ref bean="connectionFactoryOracleAQTopic"/>
</property>
<property name="username">
<value>AIS_PROVISIONING</value>
</property>
<property name="password">
<value>read_manual</value>
</property>
</bean>
<bean id="oracleTopic" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="oracleTopicCredentials"/>
</bean>
<!--
Enable web consoles, REST and Ajax APIs and demos
Take a look at ${ACTIVEMQ_BASE}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>
</beans> |
...
Code Block |
---|
title | /etc/hydra/activemq/instances-available/provisioning/credentials.properties |
---|
collapse | true |
---|
|
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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.
## ---------------------------------------------------------------------------
# Defines credentials that will be used by components (like web console) to access the broker
activemq.username=system
activemq.password=manager |
...
Параметры ведения логов
Code Block |
---|
language | js |
---|
title | /etc/hydra/activemq/instances-available/provisioning/log4j.properties |
---|
collapse | true |
---|
|
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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.
## ---------------------------------------------------------------------------
#
# This file controls most of the logging in ActiveMQ which is mainly based around
# the commons logging API.
#
log4j.rootLogger=INFO, console, logfile
log4j.logger.org.apache.activemq.spring=WARN
log4j.logger.org.apache.activemq.web.handler=WARN
log4j.logger.org.springframework=WARN
log4j.logger.org.apache.xbean=WARN
log4j.logger.org.apache.camel=INFO
log4j.logger.org.eclipse.jetty=WARN
# When debugging or reporting problems to the ActiveMQ team,
# comment out the above lines and uncomment the next.
#log4j.rootLogger=DEBUG, logfile, console
# Or for more fine grained debug logging uncomment one of these
#log4j.logger.org.apache.activemq=DEBUG
#log4j.logger.org.apache.camel=DEBUG
# Console appender
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%5p | %m%n
log4j.appender.console.threshold=INFO
# File appender
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.file=${activemq.base}/data/provisioning-activemq.log
log4j.appender.logfile.maxFileSize=1024KB
log4j.appender.logfile.maxBackupIndex=5
log4j.appender.logfile.append=true
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
# use some of the following patterns to see MDC logging data
#
# %X{activemq.broker}
# %X{activemq.connector}
# %X{activemq.destination}
#
# e.g.
#
# log4j.appender.logfile.layout.ConversionPattern=%d | %-20.20X{activemq.connector} | %-5p | %m | %c | %t%n
###########
# Audit log
###########
log4j.additivity.org.apache.activemq.audit=false
log4j.logger.org.apache.activemq.audit=INFO, audit
log4j.appender.audit=org.apache.log4j.RollingFileAppender
log4j.appender.audit.file=${activemq.base}/data/provisioning-audit.log
log4j.appender.audit.maxFileSize=1024KB
log4j.appender.audit.maxBackupIndex=5
log4j.appender.audit.append=true
log4j.appender.audit.layout=org.apache.log4j.PatternLayout
log4j.appender.audit.layout.ConversionPattern=%-5p | %m | %t%n |
В данном примере настроена запись логов работы брокера в файл provisioning-activemq.log
, расположенный в директории с данными очередей. При установке ActiveMQ из пакета hydra-activemq
данный файл будет доступен как /var/log/hydra/activemq/provisioning-activemq.log
. В Docker логи приложения записываются в директорию с данными БД ActiveMQ, а именно: /var/hydra/activemq/provisioning-activemq.log
Согласно конфигурации выше, общий размер логов приложения составляет 5 MB ( 5 файлов по 1024KB, в Docker приложение самостоятельно ротирует логи). Если этого размера будет недостаточно, можно изменить следующие параметры:
log4j.appender.logfile.maxFileSize
- Максимальный размер лога, до его ротации
log4j.appender.audit.maxBackupIndex
- Максимальное количество логов
В случае необходимости можно изменить уровень логирования. Например, для выполнения отладки приложения, чтобы выяснить причины, почему в какой-то момент времени ActiveMQ
перестал работать.
Для этого необходимо изменить конфигурацию log4j.properties
на следующую:
Code Block |
---|
language | js |
---|
title | log4j.properties, уровень логирования DEBUG |
---|
collapse | true |
---|
|
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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.
## ---------------------------------------------------------------------------
#
# This file controls most of the logging in ActiveMQ which is mainly based around
# the commons logging API.
#
log4j.rootLogger=DEBUG, console, logfile
log4j.logger.org.apache.activemq=DEBUG
log4j.logger.org.apache.activemq.spring=DEBUG
log4j.logger.org.apache.activemq.web.handler=DEBUG
log4j.logger.org.springframework=DEBUG
log4j.logger.org.apache.xbean=DEBUG
log4j.logger.org.apache.camel=DEBUG
log4j.logger.org.eclipse.jetty=DEBUG
# Console appender
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%5p | %m%n
log4j.appender.console.threshold=INFO
# File appender
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.file=${activemq.base}/data/provisioning-activemq.log
log4j.appender.logfile.maxFileSize=512MB
log4j.appender.logfile.maxBackupIndex=12
log4j.appender.logfile.append=true
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
# use some of the following patterns to see MDC logging data
#
# %X{activemq.broker}
# %X{activemq.connector}
# %X{activemq.destination}
#
# e.g.
#
# log4j.appender.logfile.layout.ConversionPattern=%d | %-20.20X{activemq.connector} | %-5p | %m | %c | %t%n
###########
# Audit log
###########
log4j.additivity.org.apache.activemq.audit=false
log4j.logger.org.apache.activemq.audit=INFO, audit
log4j.appender.audit=org.apache.log4j.RollingFileAppender
log4j.appender.audit.file=${activemq.base}/data/provisioning-audit.log
log4j.appender.audit.maxFileSize=1024KB
log4j.appender.audit.maxBackupIndex=5
log4j.appender.audit.append=true
log4j.appender.audit.layout=org.apache.log4j.PatternLayout
log4j.appender.audit.layout.ConversionPattern=%-5p | %m | %t%n |
Может понадобится изменить параметры log4j.appender.logfile.maxFileSize и log4j.appender.audit.maxBackupIndex
исходя из интенсивности использования ActiveMQ.
Параметры веб-интерфейса контроля состояния очередей
Code Block |
---|
language | xml |
---|
title | Для ActiveMQ версии |
---|
|
...
...
Code Block |
---|
title | 13 и новее — /etc/hydra/activemq/instances-available/provisioning/jetty.xml |
---|
collapse | true |
---|
|
<!--
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to You 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.
-->
<!--
An embedded servlet engine for serving up the Admin consoles, REST and Ajax APIs and
some demos Include this file in your configuration to enable ActiveMQ web components
e.g. <import resource="jetty.xml"/>
-->
<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">
<bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService">
<property name="name" value="ActiveMQRealm" />
<property name="config" value="${activemq.conf}/jetty-realm.properties" />
</bean>
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="user,admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" />
</bean>
<bean id="securityConstraintMappingadminSecurityConstraint" class="org.eclipse.jetty.util.security.ConstraintMappingConstraint">
<property name="constraintname" refvalue="securityConstraintBASIC" />
<property name="pathSpecroles" value="/*" admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" />
</bean>
<bean id="securityHandlersecurityConstraintMapping" class="org.eclipse.jetty.security.ConstraintSecurityHandlerConstraintMapping">
<property name="loginServiceconstraint" ref="securityLoginServicesecurityConstraint" />
<property name="authenticatorpathSpec">
value="/api/*,/admin/*,*.jsp" />
</bean>
<bean id="adminSecurityConstraintMapping" class="org.eclipse.jetty.security.authentication.BasicAuthenticatorConstraintMapping" />
</property>
<property name="constraintMappingsconstraint">
<list>
<ref bean="securityConstraintMapping ref="adminSecurityConstraint" />
<property name="pathSpec" </list>value="*.action" />
</property>bean>
<property name="handler">
<bean id="secrewriteHandler" class="org.eclipse.jetty.serverrewrite.handler.HandlerCollectionRewriteHandler">
<property name="handlersrules">
<list>
<bean <bean id="header" class="org.eclipse.jetty.webapprewrite.WebAppContexthandler.HeaderPatternRule">
<property name="contextPathpattern" value="/admin*" />
<property name="resourceBasename" value="${activemq.home}/webapps/admin" X-FRAME-OPTIONS"/>
<property name="logUrlOnStartvalue" value="trueSAMEORIGIN" />
</bean>
</bean> </list>
</property>
</bean>
<bean id="secHandlerCollection" class="org.eclipse.jetty.webappserver.WebAppContexthandler.HandlerCollection">
<property name="handlers">
<list>
<ref bean="rewriteHandler"/>
<bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/fileserveradmin" />
<property name="resourceBase" value="${activemq.home}/webapps/fileserveradmin" />
<property name="logUrlOnStart" value="true" />
</bean>
<bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/api" />
<property name="resourceBase" value="${activemq.home}/webapps/api" />
<property name="parentLoaderPrioritylogUrlOnStart" value="true" />
</bean>
</bean>
<bean class="org.eclipse.jetty.webappserver.WebAppContexthandler.ResourceHandler">
<property name="contextPathdirectoriesListed" value="/apifalse" />
<property name="welcomeFiles">
<list>
<value>index.html</value>
</list>
</property>
<property name="resourceBase" value="${activemq.home}/webapps/api" />
</bean>
<bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
<property name="logUrlOnStartserveIcon" value="truefalse" />
</bean>
</list>
</property>
</bean>
<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
</bean>
<property name="loginService" ref="securityLoginService" />
<property name="authenticator">
<bean class="org.eclipse.jetty.serversecurity.handlerauthentication.ResourceHandlerBasicAuthenticator" />
</property>
<property name="directoriesListedconstraintMappings">
value="false" /> <list>
<ref <property namebean="welcomeFilesadminSecurityConstraintMapping" />
<ref bean="securityConstraintMapping" />
</list>
<list> </property>
<property name="handler" ref="secHandlerCollection" />
</bean>
<bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
<value>index.html<</value>bean>
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<!-- the default port number for the web console -->
</list> <property name="host" value="127.0.0.1"/>
<property name="port" value="8161"/>
</property>bean>
<bean id="Server" depends-on="jettyPort" class="org.eclipse.jetty.server.Server"
destroy-method="stop">
<property name="resourceBase" value="${activemq.home}/webapps/" /handler">
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
</bean> <property name="handlers">
<bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"> <list>
<ref <property namebean="serveIconcontexts" value="false" />
</bean><ref bean="securityHandler" />
</list>
</property>
</bean>
</property>
</bean>
<bean id="contextsinvokeConnectors" class="org.eclipsespringframework.jettybeans.serverfactory.handlerconfig.ContextHandlerCollectionMethodInvokingFactoryBean">
</bean> <property name="targetObject" ref="Server" />
<bean <property idname="ServertargetMethod" classvalue="org.eclipse.jetty.server.Server" init-method="start"setConnectors" />
<property name="arguments">
<list>
destroy-method="stop"> <property name="connectors <bean id="Connector" class="org.eclipse.jetty.server.ServerConnector">
<list>
<constructor-arg ref="Server" />
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector" <!-- see the jettyPort bean -->
<property name="host" value="127.0.0.1"#{systemProperties['jetty.host']}" />
<property name="port" value="8161#{systemProperties['jetty.port']}" />
</bean>
</list> </property><!--
<property name="handler"> Enable this <bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
connector if you wish to use https with web console
<property name="handlers"> -->
<list> <!-- bean id="SecureConnector" class="org.eclipse.jetty.server.ServerConnector">
<constructor-arg ref="Server" />
<constructor-arg>
<bean id="handlers" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<property name="keyStorePath" value="${activemq.conf}/broker.ks" />
<property name="keyStorePassword" value="password" />
</bean>
</constructor-arg>
<ref bean="contexts <property name="port" value="8162" />
</bean -->
</list>
</property>
<ref bean</bean>
<bean id="securityHandler" />
configureJetty" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="org.apache.activemq.web.config.JspConfigurer.configureJetty" />
<property name="arguments">
<list>
<ref bean="Server" />
<ref bean="secHandlerCollection" />
</list>
</property>
</bean>
</list> <bean id="invokeStart" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
depends-on="configureJetty, invokeConnectors">
<property </property>name="targetObject" ref="Server" />
<property name="targetMethod" value="start" />
</bean>
</property>
</bean>
</beans> |
Согласно данному примеру конфигурации веб-интерфейс контроля состояния очередей будет доступен по адресу http://127.0.0.1:8161/
.
Для версии ActiveMQ >= 5.14
Code Block |
---|
language | xml |
---|
title | Для ActiveMQ версии 5.12 и старше — /etc/hydra/activemq/instances-available/provisioning/jetty.xml |
---|
collapse | true |
---|
|
<!--
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to You 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.
-->
<!--
An embedded servlet engine for serving up the Admin consoles, REST and Ajax APIs and
some demos Include this file in your configuration to enable ActiveMQ web components
e.g. <import resource="jetty.xml"/>
-->
<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">
<bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService">
<property name="name" value="ActiveMQRealm" />
<property name="config" value="${activemq.conf}/jetty-realm.properties" />
</bean>
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="user,admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" />
</bean>
<bean id="adminSecurityConstraintsecurityConstraintMapping" class="org.eclipse.jetty.util.security.ConstraintConstraintMapping">
<property name="nameconstraint" valueref="BASICsecurityConstraint" />
<property name="rolespathSpec" value="admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" /*" />
</bean>
<bean id="securityConstraintMappingsecurityHandler" class="org.eclipse.jetty.security.ConstraintMappingConstraintSecurityHandler">
<property name="constraintloginService" ref="securityConstraintsecurityLoginService" />
<property name="pathSpecauthenticator" value="/api/*,/admin/*,*.jsp" />>
</bean> <bean id="adminSecurityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMappingauthentication.BasicAuthenticator" />
</property>
<property name="constraintconstraintMappings" ref="adminSecurityConstraint>
<list>
<ref bean="securityConstraintMapping" />
</list>
</property>
<property name="pathSpechandler">
value="*.action" /> </bean> <bean id="rewriteHandlersec" class="org.eclipse.jetty.rewriteserver.handler.RewriteHandlerHandlerCollection">
<property name="ruleshandlers">
<list>
<bean id="header" class="org.eclipse.jetty.rewritewebapp.handler.HeaderPatternRuleWebAppContext">
<property name="patterncontextPath" value="*/admin" />
<property name="nameresourceBase" value="X-FRAME-OPTIONS"${activemq.home}/webapps/admin" />
<property name="valuelogUrlOnStart" value="SAMEORIGINtrue" />
</bean>
</list> </property> </bean>
<bean id="secHandlerCollection" class="org.eclipse.jetty.serverwebapp.handler.HandlerCollectionWebAppContext">
<property name="handlers"> <list> <ref bean="rewriteHandler"/> <bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/adminfileserver" />
<property name="resourceBase" value="${activemq.home}/webapps/adminfileserver" />
<property name="logUrlOnStart" value="true" />
</bean> <bean class="org.eclipse.jetty.webapp.WebAppContext"> <property name="contextPath" value="/api" /> <property name="resourceBase" value="${activemq.home}/webapps/api" />
<property name="logUrlOnStartparentLoaderPriority" value="true" />
</bean>
<bean class="org.eclipse.jetty.serverwebapp.handler.ResourceHandlerWebAppContext">
<property name="directoriesListedcontextPath" value="false/api" />
<property name="welcomeFiles"> <list> <value>index.html</value> </list> </property>
<property name="resourceBase" value="${activemq.home}/webapps/api" />
</bean> <bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
<property name="serveIconlogUrlOnStart" value="falsetrue" />
</bean> </list> </property> </bean> <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler"> <property name="loginService" ref="securityLoginService" /> </bean>
<property name="authenticator"> <bean class="org.eclipse.jetty.securityserver.authenticationhandler.BasicAuthenticatorResourceHandler" />
</property> <property name="constraintMappings"directoriesListed" value="false" />
<list> <property <ref beanname="adminSecurityConstraintMappingwelcomeFiles" />
<ref bean="securityConstraintMapping" /> </list> <list>
</property> <property name="handler" ref="secHandlerCollection" /> </bean> <bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"> <<value>index.html</bean>value>
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start"> <!-- the default port number for the web console --> </list>
<property name="host" value="127.0.0.1"/> <property name="port" value="8161"/> </bean>property>
<bean id="Server" depends-on="jettyPort" class="org.eclipse.jetty.server.Server" destroy-method="stop"> <property name="handler"resourceBase" value="${activemq.home}/webapps/" />
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> </bean>
<property name="handlers"> <bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
<list> <ref bean <property name="contextsserveIcon" value="false" />
<ref bean="securityHandler" /></bean>
</list>
</property>
</bean>
</property>
</bean>
<bean id="invokeConnectorscontexts" class="org.springframeworkeclipse.beansjetty.factoryserver.confighandler.MethodInvokingFactoryBeanContextHandlerCollection">
<property name="targetObject" ref="Server" /></bean>
<property<bean nameid="targetMethodServer" valueclass="setConnectors" />
<property name="arguments">org.eclipse.jetty.server.Server" init-method="start"
<list> destroy-method="stop">
<bean id="Connector" class="org.eclipse.jetty.server.ServerConnector<property name="connectors">
<constructor-arg ref="Server" /> <list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<!-- see the jettyPort bean --> <property name="host" value="#{systemProperties['jetty.host']}" 127.0.0.1"/>
<property name="port" value="#{systemProperties['jetty.port']}8161" />
</bean>
</list>
<!-- </property>
<property name="handler">
Enable this connector if you wish to use https with web console<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<property name="handlers">
--> <list>
<!-- bean id="SecureConnector" class="org.eclipse.jetty.server.ServerConnector"> <constructor-arg ref="Server" /> <constructor-arg> <bean id="handlers" class="org.eclipse.jetty.util.ssl.SslContextFactory"> <property name="keyStorePath" value="${activemq.conf}/broker.ks" /> <property name="keyStorePassword" value="password" /> </bean> </constructor-arg> <property name="port" value <ref bean="8162contexts" />
</bean --> </list> </property> </bean>
<bean id<ref bean="configureJettysecurityHandler" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"/>
<property name="staticMethod" value="org.apache.activemq.web.config.JspConfigurer.configureJetty" /> <property name="arguments"> <list> <ref bean="Server" /> <ref bean="secHandlerCollection" />
</list>
</property> </bean> <bean id="invokeStart" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="configureJetty, invokeConnectors"> </property>
<property name="targetObject" ref="Server" /> </bean>
<property name="targetMethod" value="start" </>property>
</bean>
</beans> |
Согласно данному примеру конфигурации веб-интерфейс контроля состояния очередей будет доступен по адресу: http://127.0.0.1:8161/admin/queues.jsp
.
Данные для доступа к веб-интерфейсу контроля состояния очередей
Code Block |
---|
title | /etc/hydra/activemq/instances-available/provisioning/jetty-realm.properties |
---|
collapse | true |
---|
|
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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.
## ---------------------------------------------------------------------------
# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin |
...
Code Block |
---|
|
user@server:~$ links http://admin:admin@127.0.0.1:8161/admin/queues.jsp |