cfengine

cfengine学习笔记03[原创]

终于到最后一篇了,也就是cfengine最便捷的所在了,让你只通过一台机器管理你想要管理的任意一个或多个服务器,是不是很神奇,请往下看

前两篇已经把基本的配置都写好且配置好了,这里我仅仅捡关键的写了,cfservd.conf,update.conf及供维护服务器端使用的cfagent.conf文件参考上篇文章,这片文章中我们仅仅需要配置cfrun.hosts文件
内容如下

#
# This is the host list for cfrun
#
# Only these hosts will be contacted by remote connection
#

domain=b.c #设置域
access=root #设置需要访问的用户

192.168.220.130 #维护主机的ip,每个写一行

这样一切准备就绪后,就可以执行/var/cfengine/bin/cfrun -v了,显示结果如下


Domain name = b.c

GNU Cfengine server daemon –

2.2.8

Free Software Foundation 1994-

Donated by Mark Burgess, Oslo University College, Norway

————————————————————————

Host name is: conversion.localhost

Operating System Type is linux

Operating System Release is 2.6.18-8.el5xen

Architecture = i686

Using internal soft-class linux for host linux

The time is now Wed Oct 15 21:53:51 2008

————————————————————————

Additional hard class defined as: 32_bit

Additional hard class defined as: linux_2_6_18_8_el5xen

Additional hard class defined as: linux_i686

Additional hard class defined as: linux_i686_2_6_18_8_el5xen

Additional hard class defined as: linux_i686_2_6_18_8_el5xen__1_SMP_Thu_Mar_15_21_02_53_EDT_2007

GNU autoconf class from compile time: compiled_on_linux_gnu

Address given by nameserver: 127.0.0.1

Checking integrity of the state database

Checking integrity of the module directory

Checking integrity of the input data for RPC

Checking integrity of the output data for RPC

Checking integrity of the PKI directory

Making sure that locks are private…

Loaded /var/cfengine/ppkeys/localhost.priv

Loaded /var/cfengine/ppkeys/localhost.pub

Looking for a source of entropy in /var/cfengine/randseed

cfrun(0): .......... [ Hailing 192.168.220.130 ] ..........
Connecting to server 192.168.220.130 to port 0 with options
Loaded /var/cfengine/ppkeys/root-192.168.220.130.pub
Connect to 192.168.220.130 = 192.168.220.130 on port 5308
Loaded /var/cfengine/ppkeys/root-192.168.220.130.pub

...............................................................
cfrun:conversion.localhost: Strong authentication of server=192.168.220.130connection confirmed
192.168.220.130 replies..

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

cfengine:test:
Executing script /usr/bin/rsync -r no@192.168.220.129::software/upload/ /tmp/test/...(timeout=0,uid=-1,gid=-1)
cfengine:aoyun-web-2: Finished script /usr/bin/rsync -r no@192.168.220.1129::software/upload/ /tmp/test/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Connection with 192.168.220.130 completed

以上是执行的全过程,我做了一个rsync的操作,这样如果要是需要很多台server同时手动rsync操作或其他操作的话,就可以使用这个了


总之cfengine还是很强大的,cfagent.conf配置文件中有需要参数可以调整,还希望大家在实际使用当中仔细学习了。

Related Post

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.