- 論壇徽章:
- 0
|
終于到最后一篇了,也就是cfengine最便捷的所在了,讓你只通過(guò)一臺(tái)機(jī)器管理你想要管理的任意一個(gè)或多個(gè)服務(wù)器,是不是很神奇,請(qǐng)往下看前兩篇已經(jīng)把基本的配置都寫好且配置好了,這里我僅僅撿關(guān)鍵的寫了,cfservd.conf,update.conf及供維護(hù)服務(wù)器端使用的cfagent.conf文件參考上篇文章,這片文章中我們僅僅需要配置cfrun.hosts文件內(nèi)容如下
#
# This is the host list for cfrun
#
# Only these hosts will be contacted by remote connection
#
domain=b.c #設(shè)置域
access=root #設(shè)置需要訪問(wèn)的用戶
192.168.220.130 #維護(hù)主機(jī)的ip,每個(gè)寫一行
這樣一切準(zhǔn)備就緒后,就可以執(zhí)行/var/cfengine/bin/cfrun -v了,顯示結(jié)果如下
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
以上是執(zhí)行的全過(guò)程,我做了一個(gè)rsync的操作,這樣如果要是需要很多臺(tái)server同時(shí)手動(dòng)rsync操作或其他操作的話,就可以使用這個(gè)了
總之cfengine還是很強(qiáng)大的,cfagent.conf配置文件中有需要參數(shù)可以調(diào)整,還希望大家在實(shí)際使用當(dāng)中仔細(xì)學(xué)習(xí)了。
本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u1/55815/showart_1308369.html |
|