mcollective安装和使用
修改activemq的配置并重启:
# vi apache-activemq-5.6.0/conf/activemq.xml
在
</persistenceAdapter>
下面增加:
<plugins>
<statisticsBrokerPlugin/>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username=”mcollective” password=”secret” groups=”mcollective,everyone”/>
<authenticationUser username=”admin” password=”secret” groups=”mcollective,admin,everyone”/>
</users>
</simpleAuthenticationPlugin>
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry queue=”>” write=”admins” read=”admins” admin=”admins” />
<authorizationEntry topic=”>” write=”admins” read=”admins” admin=”admins” />
<authorizationEntry topic=”mcollective.>” write=”mcollective” read=”mcollective” admin=”mcollective” />
<authorizationEntry queue=”mcollective.>” write=”mcollective” read=”mcollective” admin=”mcollective” />
<authorizationEntry topic=”ActiveMQ.Advisory.>” read=”everyone” write=”everyone” admin=”everyone”/>
</authorizationEntries>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>
在
<transportConnector name=”openwire” uri=”tcp://0.0.0.0:61616″/>
下面增加:
<transportConnector name=”stomp” uri=”stomp://0.0.0.0:61613“/>
重启activemq:
# apache-activemq-5.6.0/bin/activemq stop
# apache-activemq-5.6.0/bin/activemq start
所有机器上安装mcollective:
# yum install mcollective mcollective-client mcollective-common rubygem-stomp
修改配置文件client.cfg:
# /etc/mcollective/client.cfg
plugin.psk = unset
connector = stomp
plugin.stomp.host = 10.24.1.47
plugin.stomp.port = 61613
plugin.stomp.user = mcollective
plugin.stomp.password = secret
修改配置文件server.cfg:
# /etc/mcollective/server.cfg
daemonize = 1
plugin.psk = unset
connector = stomp
plugin.stomp.host = 10.24.1.47
plugin.stomp.port = 61613
plugin.stomp.user = mcollective
plugin.stomp.password = secret
启动mcollective:
# service mcollective restart
密码plugin.stomp.password错误可能导致如下错误:
mcollectived[13674]: connection.receive returning EOF as nil
测试:
# mco ping
cc time=48.53 ms
compute1 time=88.36 ms
—- ping statistics —-
2 replies max: 88.36 min: 48.53 avg: 68.44
# mco controller stats
Determining the amount of hosts matching filter for 2 seconds …. 2
cc> total=6, replies=4, valid=6, invalid=0, filtered=1, passed=5
compute1> total=5, replies=3, valid=5, invalid=0, filtered=1, passed=4
Finished processing 2 / 2 hosts in 57.54 ms
# mco inventory cc
Inventory for cc:
Server Statistics:
Version: 2.0.0
Start Time: 2012-08-20 14:06:19 +0800
Config File: /etc/mcollective/server.cfg
Collectives: mcollective
Main Collective: mcollective
Process ID: 27169
Total Messages: 7
Messages Passed Filters: 6
Messages Filtered: 1
Expired Messages: 0
Replies Sent: 5
Total Processor Time: 0.03 seconds
System Time: 0.01 seconds
Agents:
discovery rpcutil
Configuration Management Classes:
No classes applied
Facts:
mcollective => 1
感觉这个东西还是不太好用。puppet插件也只是用来启动puppet代理之类的,没有大作用。