Saturday, August 10, 2013

rsync ---初設定

#########################
centos6.4
4張網卡
network 強制啟動
web server
setup
network
set firewall no
vim /etc/selinux/config
SELINUX=disabled
enforced-->disabled
########################
1.rsync ---設定
vim /etc/xinetd.d/rsync
簡單範本如下:
# default: off
# description: The rsync server is a good addition to am ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
然後下 ,
/etc/rc.d/init.d/xinetd restart

启动服务:rsync –daemon –config=/etc/rsyncd.conf
使上述設定生效.
備份的方法 3 : 使用 rsync
上述, 主要是要打開 rsync 這個 daemon, 一旦有 rsync client 要連接時, xinetd 會把它轉介給 rsyncd (跑 port 873).
##############################

如果出现

#  rsync -vau   --password-file=/home/passwrd1XX.secrets  /home/test root@174.XXXX::test
rsync: failed to connect to 174.XXXXX: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(107) [sender=2.6.8]
这都是端口问题!

看看端口
netstat -ntpl
如果没有873端口的话,就
yum -y install xinetd rsync

肯定是没安装xinetd!!!这么傻的问题!

service xinetd restart
就好了!

############################
2. 設定 /etc/rsyncd.conf :
以下區塊, 代表開放給某一台 rsync client 主機的設定, 簡單範本如下:
############################
vim /etc/rsyncd.conf
############################
[homelia]
path = /home/lia
auth users = home
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[home]
path = /home
auth users = home
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[mail]
path = /var/spool/mail
auth users = mail
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[public]
path = /public
auth users = public
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[mysql]
path = /var/lib/mysql
auth users = mysql
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[html]
path = /var/www/html
auth users = html
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[ftp]
path = /var/ftp
auth users = ftp
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[www]
path = /var/www
auth users = www
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[163.17.209.1]
path = /163.17.209.1
auth users = etc1
uid = root
gid = root
secrets file = /etc/r.p
read only = no

[163.17.209.6]
path = /163.17.209.6
auth users = etc6
uid = root
gid = root
secrets file = /etc/r.p
read only = no
3. ###############################
vim /etc/r.p
###############################
home:home
mail:mail
public:public
mysql:mysql
html:html
ftp:ftp
etc1:etc1
etc6:etc6
www:www
#####/etc/r.p##############
chown root.root /etc/r.p
chmod 600 /etc/r.p
############################################
/etc/rc.d/init.d/xinetd restart
############################################
mkdir /163.17.209.1
mkdir /163.17.209.5
mkdir /public
mkdir /home/teacher
mkdir /home/office
############################################HomeAny source

No comments:

Post a Comment