您的位置:首页 > 理论基础 > 计算机网络

func统一网络控制器安装配置

2013-09-30 15:05 417 查看
Func 是红帽子公司 Fedora平台统一网络控制器
Func(Fedora UnifiedNetwork Controller https://fedorahosted.org/func),目的是为了解决这一系列统一管理监控问题而设计开发的系统管理基础框架。能有效的简化多服务器系统管理工作的工具,易于学习,易于使用,易于扩展,而且功能强大。 Func的特点有:
1、Func可以在主控机上一次管理任意多台或任意多个服务器组。
2、Func基于Certmaster(https://fedorahosted.org/certmaster/)建立了Master-Slaves主从SSL证书管控体系,可以将证书自动分发到所有受控服务器。
3、Func命令行可以直接发送远程命令或者远程获取数据。
4、Func 开发者已经完成了大多数常用任务模块的开发,包括命令执行模块、文件传输模块、IPtables模块、查看硬件信息模块、Mount模块、进程模块、服务模块、重启系统模块等。
5、可以通过Func提供的Python API轻松编写扩展模块,以实现具体功能扩展。而且任何Func命令行能完成的工作,都能通过API编程实现。
6、Func通讯基于XMLRPC和SSL标准协议。

系统:Master : centos 5.8 x86
Minion: centos 6.3 x86配置hosts文件,使master与minions可以相互解析。func安装
一、Master控制端配置1.安装fedora发布的epel yum源,rpm –Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm如果下载地址失效可以从这里针对自己的版本进行下载http://fedoraproject.org/wiki/EPEL2.安装funcfunc基于certmaster,本次会一同安装,都在epel源里,我这里安装的时候提示少个依赖包python-simplejson,网上搜了一个(如果你的源里有的话可以不用下载)wget ftp://ftp.pbone.net/mirror/ftp.centos.org/5.9/os/i386/CentOS/python-simplejson-2.0.9-8.el5.i386.rpmrpm -ivh python-simplejson-2.0.9-8.el5.i386.rpmyum install func3.配置certmastervi/etc/certmaster/certmaster.conf#configuration for certmasterd and certmaster-ca
[main]autosign= nolisten_addr= 192.168.15.188 #监听IP,也可以不写listen_port= 51235 #监听端口,自己定义cadir =/etc/pki/certmaster/cacert_dir= /etc/pki/certmastercertroot= /var/lib/certmaster/certmaster/certscsrroot =/var/lib/certmaster/certmaster/csrscert_extension= certsync_certs = False###############################################################
4.iptables允许,启动certmaster服务 #func
/sbin/iptables -A INPUT -s 192.168.15.183 -p tcp --dport 51235 -j ACCEPT
/sbin/iptables -A INPUT -s 192.168.1.200 -p tcp --dport 51235 -j ACCEPT
注意:Master端是启动certmaster服务,被控制端是启动funcd服务#/etc/init.d/certmaster start
二 minion被控制端
1.安装epel版本5wgethttp://mirrors.yun-idc.com/epel/5/i386/epel-release-5-4.noarch.rpmrpm -ivh epel-release-5-4.noarch.rpm
版本6rpm –Uvh http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm
2.安装func同样,还是少这个包【应该5.5及以下的系统版本会少】,如果你的系统没有报错缺少,可以跳过wget ftp://ftp.pbone.net/mirror/ftp.centos.org/5.9/os/i386/CentOS/python-simplejson-2.0.9-8.el5.i386.rpmrpm -ivh python-simplejson-2.0.9-8.el5.i386.rpmyum install func
3.minions客户端配置vi /etc/func/minion.conf#configuration for minions
[main]log_level= INFO #默认日志级别为debugacl_dir =/etc/func/minion-acl.d
listen_addr=listen_port= 51234 #默认端口被监控主机监听的端口minion_name=method_log_dir = /var/log/func/methods/
这里可选配置minion被控制端的监听地址,在/etc/func/minion.conf文件中,该监听端口用于响应master发送的指令。这个修改要在申请证书前完成,完成后不可修改。【由于没有了解到更深层的东西,所以端口的修改建议不要做,保留默认的51234端口。】
与certmaster关联配置vi /etc/certmaster/minion.conf#configuration for minions
[main]certmaster= server.puppet.com #配置master的地址或master主机名【要能够互相解析】certmaster_port= 51235 #服务端的侦听端口log_level= DEBUGcert_dir = /etc/pki/certmaster
4.启动funcd服务/sbin/iptables -A INPUT -s 192.168.15.188 -p tcp --dport 51234 -j ACCEPT #允许master访问minions/etc/init.d/funcd start服务启动后会自动向master服务器提交证书申请这个服务启动有没有成功都不会报错,如果有报错,会在日志 /var/log/func/func.log里,
注意:master连接minions时,要求minions监听在相同的端口Funcd's listening port can be configured in /etc/func/minion.conf inthe listen_port option.Overlord's will also check this file and setting todetermine which ports to connect to the minions with.Note that currentlyoverlord requires all minions to be listening on the same port.

如果以上都没有报错可以进行第三步证书签署,有报错先解决了。

证书签署及验证操作
1. master服务器端
certmaster-ca –l 查看证书请求
certmaster-ca –s hostname 签署证书(这个hostname即是通过-l列出来的)为客户端签署证书
certmaster-ca--list-signed查看已经签署了哪些证书
2.以上的操作都能在日志里面看到,涉及的日志有
/var/log/certmaster/*
/var/log/func/*
3. 使用简例(master端)
1.列出有多少个minions
[root@Master_station~]# func "*" list_minions
myvmware_station.example.commyvmware_station2.example.com2. 查看minions是否都在线[root@Master_station ~]# func "*" ping[ ok ... ] myvmware_station.example.com[ ok ... ] myvmware_station2.example.com 3.[root@server ~]#func "myvmware_station2.example.com" call cpu usage
有返回数据,则说明安装完成正常,具体使用语法参考其他资料。
4.在master端执行funcd --list-modules可以查看已有的模块。
四 命令使用示例
操作对象可以使用正则匹配,可以列举多个【用分号对分隔】
查看已有模块
funcd --list-modules查看minions主机列表func “*” list_minions拷贝文件[拷贝到远端]func "myvmware_statio*" copyfile -f /tmp/check_disk.sh --remotepath=/tmp/file1
判断文件是否存在func "myvmware_statio*"call command exists /tmp/file1
执行脚本func "myvmware_statio*"call command run " /tmp/file1"
删除使用的临时文件func "myvmware_statio*"call command run "rm /tmp/file1"

本文出自 “刘园的博客” 博客,请务必保留此出处http://colynn.blog.51cto.com/5971950/1303808
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: