puppet ActiveMQ MCollective CentOS6 安装笔记

Puppet 在CentOS6 上安装activemq mcollective 笔记

安装activemq mcollective 环境

rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum -y install java-1.8.0-openjdk activemq

编辑activemq的配置文件:/etc/activemq/activemq.xml

cat /etc/activemq/activemq.xml|grep -v "^$"
<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">
 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
 <property name="locations">
 <value>file:${activemq.conf}/credentials.properties</value>
 </property>
 </bean>
 <broker xmlns="http://activemq.apache.org/schema/core" brokerName="computer001" dataDirectory="${activemq.data}" schedulePeriodForDestinationPurge="60000">
 <destinationPolicy>
 <policyMap>
 <policyEntries>
 <policyEntry topic=">" >
 <pendingMessageLimitStrategy>
 <constantPendingMessageLimitStrategy limit="1000"/>
 </pendingMessageLimitStrategy>
 </policyEntry>
 </policyEntries>
 </policyMap>
 </destinationPolicy>
 <managementContext>
 <managementContext createConnector="false"/>
 </managementContext>
 <persistenceAdapter>
 <kahaDB directory="${activemq.data}/kahadb"/>
 </persistenceAdapter>
 <systemUsage>
 <systemUsage>
 <memoryUsage>
 <memoryUsage percentOfJvmHeap="70" />
 </memoryUsage>
 <storeUsage>
 <storeUsage limit="100 gb"/>
 </storeUsage>
 <tempUsage>
 <tempUsage limit="50 gb"/>
 </tempUsage>
 </systemUsage>
 </systemUsage>
<plugins>
 <simpleAuthenticationPlugin>
 <users>
 <authenticationUser username="client" password="client_password" groups="servers,clients,everyone"/>
 <authenticationUser username="server" password="server_password" groups="servers,everyone"/>
 </users>
 </simpleAuthenticationPlugin>
 
 <authorizationPlugin>
 <map>
 <authorizationMap>
 <authorizationEntries>
 <authorizationEntry queue="mcollective.>" write="clients" read="clients" admin="clients" />
 <authorizationEntry topic="mcollective.>" write="clients" read="clients" admin="clients" />
 <authorizationEntry queue="mcollective.nodes" read="servers" admin="servers" />
 <authorizationEntry queue="mcollective.reply.>" write="servers" admin="servers" />
 <authorizationEntry topic="mcollective.*.agent" read="servers" admin="servers" />
 <authorizationEntry topic="mcollective.registration.agent" write="servers" read="servers" admin="servers" />
 <authorizationEntry topic="ActiveMQ.Advisory.>" read="everyone" write="everyone" admin="everyone"/>
 </authorizationEntries>
 </authorizationMap>
 </map>
 </authorizationPlugin>
</plugins>
<managementContext>
<managementContext createConnector="true" connectorPort="1099"/> 
 </managementContext>
 <transportConnectors>
 <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
 <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
 <transportConnector name="stomp+nio" uri="stomp+nio://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
 <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
 <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
 </transportConnectors>
 <shutdownHooks>
 <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
 </shutdownHooks>
 </broker>
 <import resource="jetty.xml"/>
</beans>

配置文件,请参考:https://github.com/jorhett/learning-mcollective/blob/master/examples/activemq_59.xml

 

配置actvemq web控制台


cat /etc/activemq/jetty.xml |grep authenticate
<property name="authenticate" value="true" /> 将false 改为true,即可

启动activemq 服务

/etc/init.d/activemq start 

MC服务端安装 


yum install mcollective -y

MC服务端配置文件 


cat /etc/mcollective/server.cfg

daemonize = 1
direct_addressing = 1
# ActiveMQ connector settings:
connector = activemq
plugin.activemq.pool.size = 1
plugin.activemq.pool.1.host = 192.168.200.51 #填写activemq的IP地址或者dns,使用dns需要解析
plugin.activemq.pool.1.port = 61613 &amp;nbsp; #端口
plugin.activemq.pool.1.user = server # 用户名
plugin.activemq.pool.1.password = server_password #密码
plugin.activemq.heartbeat_interval = 30 &amp;nbsp;#心跳间隔
 
# How often to send registration messages
registerinterval = 600
 
# Plugins
securityprovider = psk
plugin.psk = psk_password
 
#
libdir = /usr/libexec/mcollective
logfile = /var/log/mcollective.log
loglevel = info


 

启动MC server服务

/etc/init.d/mcollective  start

注:每台MC 服务端都需要安装,并确保每台机器时间都是同步。

MC客户端安装

yum -y install mcollective-client

注:仅客户端需要安装。

MC客户端配置

cat /etc/mcollective/client.cfg

daemonize = 1
direct_addressing = 1
# ActiveMQ connector settings:
connector = activemq
plugin.activemq.pool.size = 1
plugin.activemq.pool.1.host = 192.168.200.51
plugin.activemq.pool.1.port = 61613
plugin.activemq.pool.1.user = client
plugin.activemq.pool.1.password = client_password
plugin.activemq.heartbeat_interval = 30
 
# How often to send registration messages
registerinterval = 600
 
# Plugins
securityprovider = psk
plugin.psk = psk_password
 
#
libdir = /usr/libexec/mcollective
logfile = /var/log/mcollective.log

ttl = 60
color = 1
rpclimitmethod = first

# Facts
factsource = yaml
plugin.yaml = /etc/mcollective/facts.yaml


MC客户端测试

 # mco ping

computer001 time=70.62 ms

computer002 time=30.12 ms

computer003 time=30.02 ms

此blog都是以前个人笔记,不保证时效性,更多请继续关注puppetfans文章!