Puppet管理之Mcollective安装与配置
2012-05-23 22:08:02   来源:互联网   评论:0 点击:

【Mcollective 导读】在大规模分布式系统,Puppet管理功能十分强大,但一直苦于变更的速度很难提升.偶有机会在看puppet 资料时,提到Mcolle...

【Mcollective 导读】

在大规模分布式系统,Puppet管理功能十分强大,但一直苦于变更的速度很难提升.偶有机会在看puppet 资料时,提到Mcollective加速效果不错,原文描述:

“MCollective能够将应用速度提高到一个令人吃惊的程度。

我们部署了一个实例,并利用mc进行预配置。仅仅在29秒内,我们便完成了40个实例。

我们要求mc在实例中安装Apache,启动实例并告知我们完成。整个过程大约耗时31秒。

停止大约40个Apache服务器实例耗时约为7秒,通过关机的方式关闭实例约为12秒。”

若puppet管理能实现上面这个速度,那岂不是很爽!开始尝试使用mc(Mcollective)的安装过程与测试!

 

【Mcollective 基础】

MCollective( Marionette Collective,以下简称为mc)工具为命令行界面(CLI),但它可与数千个实例进行通信,

而且传输速度非常惊人。无论这些实例位于什么位置,都能以线速进行传输。mc工具作为中间件,

使用的是一个类似多路传送的推送信息系统。

具备请参阅:http://docs.puppetlabs.com/mcollective/

 

【Mcollective 安装准备】

下载安装包:

a.创建安装包下载目录

mkdir /tmp/activemq/

b.进入/tmp/activemq/

cd !$

3.使用wget下载相应的rpm包

wget -c http://downloads.puppetlabs.com/mcollective/tanukiwrapper-3.5.9-1.el5.x86_64.rpm
wget -c http://downloads.puppetlabs.com/mcollective/activemq-5.5.0-1.el5.noarch.rpm
wget -c http://downloads.puppetlabs.com/mcollective/activemq-info-provider-5.5.0-1.el5.noarch.rpm
wget -c http://downloads.puppetlabs.com/mcollective/mcollective-1.0.1-1.el5.noarch.rpm
wget -c http://downloads.puppetlabs.com/mcollective/mcollective-common-1.0.1-1.el5.noarch.rpm
wget -c http://downloads.puppetlabs.com/mcollective/mcollective-client-1.0.1-1.el5.noarch.rpm

官方下载地址:http://downloads.puppetlabs.com/mcollective/

 

【Mcollective  安装过程】

1.安装java,需要java 1.6.0以上版本。

yum -y install sun-java

2.安装相应的rpm包,注意安装顺序,是有依赖关系的。

rpm -ivh  tanukiwrapper-3.5.9-1.el5.x86_64.rpm activemq-5.5.0-1.el5.noarch.rpm activemq-info-provider-5.5.0-1.el5.noarch.rpm

yum -y install rubygem-stomp ##mcollective需要依赖ruby-stomp

 

rpm -ivh  mcollective-common-1.0.1-1.el5.noarch.rpm mcollective-client-1.0.1-1.el5.noarch.rpm

rpm -ivh mcollective-1.0.1-1.el5.noarch.rpm
到此安装过程结束,接下来就是Mcollective配置了。

 


【Mcollective 配置】
a. 修改activemq.xml配置文件
vim /etc/activemq/activemq.xml 
省略部分配置文件,我没有改动,只改动加粗,或者加色的部分
<users>
 <authenticationUser username="admin" password="secret" groups="mcollective,admins,everyone"/> ##这个用户和密码配置mcollective时要用到。
<authenticationUser username="mcollective" password="secret" groups="mcollective,admins,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="ActiveMQ.Advisory.>" read="everyone" write="everyone" admin="everyone"/>
                </authorizationEntries>
              </authorizationMap>
            </map>
          </authorizationPlugin>
        </plugins>
<transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:6166"/>
            <transportConnector name="stomp" uri="stomp://0.0.0.0:6163"/>
        </transportConnectors>
 请注意红色的部分,要改成stomp,后面的url是监听的IP地址和端口。
b.修改/etc/mcollective/server.cfg,这个是mcollective的主配置文件。
cat /etc/mcollective/server.cfg 
topicprefix = /topic/mcollective
libdir = /usr/libexec/mcollective ##以后添加插件都要放到这个目录下.
logfile = /var/log/mcollective.log
loglevel = info
daemonize = 1
# Plugins
securityprovider = psk
plugin.psk = unset
connector = stomp
plugin.stomp.host = localhost  ##如作为客户端的话。需要修改这里,指向mcoolective的IP。
plugin.stomp.port = 6163
plugin.stomp.user = mcollective ##这个是activemq.xml里的用户名
plugin.stomp.password = secret  ##这个是activemq.xml里定义的密码
# Facts
factsource = yaml
plugin.yaml = /etc/mcollective/facts.yaml
【Mcollective客户端配置
1.客户端需要安装mcollective相关软件,安装过程如上面,只需要配置server.cfg,client.cfg。
cat /etc/mcollective/server.cfg  
省略部分配置
connector = stomp
plugin.stomp.host = 192.168.2.220  ##这里指向mcollective服务端的IP地址
plugin.stomp.port = 6163
plugin.stomp.user = mcollective   ## 用于连接服务端的用户名
plugin.stomp.password = secret    ## 用于连接服务羰的密码
如一台机器又作服务端,又作为客户端,需要配置client.cfg,只需要指定server的IP和连接的用户名和密码,
基本上和server.cfg一样。在测试中,我client.cfg也指定了服务端。
配置好主服务端和客户端,我们开启相应的服务,在服务端
# /etc/init.d/activemq  start
#/etc/init.d/mcollective start
客户端只需要启动
#/etc/init.d/mcollective  start
查看日志,如没有异常,接下来就是进行测试。
【Mcollective 测试】
在服务端执行相应命令,进行功能测试。
[root@primarylb mcollective]# mc-ping
primarylb.test.com                   time=57.94 ms
backuplb.test.com                    time=95.19 ms
[root@primarylb mcollective]# mc-find-hosts
primarylb.test.com
backuplb.test.com
[root@primarylb 1.8]# mc-controller stats
Determining the amount of hosts matching filter for 2 seconds .... 2

        primarylb.test.com> total=46 replies=22 valid=46 invalid=0 filtered=18 passed=28
         backuplb.test.com> total=23 replies=13 valid=23 invalid=0 filtered=5 passed=18

---- mcollectived controller summary ----
           Nodes: 2 / 2
      Start Time: Wed Oct 12 15:58:04 +0800 2011
  Discovery Time: 2002.05ms
      Agent Time: 52.90ms
      Total Time: 2054.95ms

[root@primarylb mcollective]# mc-find-hosts  -A mc-rpc  rpcutil agent_inventory -I primarylb.test.com
Determining the amount of hosts matching filter for 2 seconds .... 1

 * [ ============================================================> ] 1 / 1

primarylb.test.com
   Agents:
        [{:agent=>"discovery",
          :author=>"R.I.Pienaar <rip@devco.net>",
          :license=>"Apache License, Version 2"},
         {:url=>"http://www.puppetlabs.com/mcollective",
          :name=>"filemgr",
          :timeout=>5,
          :description=>"File Manager",
          :agent=>"filemgr",
          :author=>"Mike Pountney <mike.pountney@gmail.com>",
          :version=>"0.3",
          :license=>"Apache 2"},
         {:url=>"http://marionette-collective.org/",
          :name=>"Utilities and Helpers for SimpleRPC Agents",
          :timeout=>10,
          :description=>
           "General helpful actions that expose stats and internals to SimpleRPC clients",
          :agent=>"rpcutil",
          :author=>"R.I.Pienaar <rip@devco.net>",
          :version=>"1.0",
          :license=>"Apache License, Version 2.0"}]

Finished processing 1 / 1 hosts in 55.68 ms
[root@primarylb mcollective]#mc-rpc filemgr status file=/etc/puppet/puppet.conf ## 要安装filemgr插件
Determining the amount of hosts matching filter for 2 seconds .... 1

 * [ ============================================================> ] 1 / 1

primarylb.test.com
Type: file
         Access time:
        Wed Oct 12 14:10:52 +0800 2011
              Status: present
             Present: 1
                Mode: 100644
   Modification time:
        Tue Oct 11 17:20:08 +0800 2011
                 MD5: 4b520679f63967447dacb00c87ac8c3f
         Change time:
        Tue Oct 11 17:20:08 +0800 2011
   Modification time: 1318324808
               Owner: 0
         Change time: 1318324808
                Size: 1574
               Group: 0
                Name: /etc/puppet/puppet.conf
         Access time: 1318399852

Finished processing 1 / 1 hosts in 79.03 ms
我安装了部分插件,更多插件可以参阅http://projects.puppetlabs.com/projects/mcollective-plugins/wiki

Mcollective 总结

因为本次安装用的是虚拟机(环境CentOS),不具备大规模的测试条件,到底能加速到什么程度,

这里就无法给出个样子,puppetd 管理,puppet实验室,puppet  pro里都有讲过mcollective,

这也是学习的一个过程吧,如果谁有环境可以好好地测试下这个性能到底如何,同时结合使用puppet 和Mcollective尝试更多的插件.另外也借一下别人的总结:MCollective为一款面向研发人员的云工具。

虽然其仅有CLI,但是为其创建一个简易G

相关热词搜索:Puppet Mcollective 安装

上一篇:第一页
下一篇:分布式服务框架 Zookeeper

分享到: 收藏
评论排行