Linux服务器的代码同步
来源:互联网 发布:软件毕业设计题目 编辑:程序博客网 时间:2024/04/30 00:36
配置rsync 同步数据 rpm包安装rsync及配置
[root@Hammerhome]# rpm -qa |grep rsync #检查系统是否安装了rsync软件包
rsync-2.6.8-3.1
[root@Hammer CentOS]# rpm -ivh rsync-2.6.8-3.1.i386.rpm #如果没有安装则手动安装
[root@test rsync-3.0.4]# vim/etc/xinetd.d/rsync
1 配置rsync servervi /etc/xinetd.d/rsync
将disable=yes改为no
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
2 配置rsync自动启动
[root@test etc]# chkconfig rsync on
[root@test etc]# chkconfig rsync --list
rsync on
3 配置rsyncd.conf
[root@test etc]# vim rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]
path = /srv
comment = This is test
auth users = scihoo
uid = root
gid = root
secrets file = /home/rsync.ps
read only = no
list = no
4 确保etc/services中rsync端口号正确
[root@test etc]# vim /etc/services
rsync 873/tcp # rsync
rsync 873/udp # rsync
5配置rsync密码(在上边的配置文件中已经写好路径)/home/rsync.ps(名字随便写,只要和上边配置文件里的一致即可),格式(一行一个用户)
[root@test etc]# vi/home/rsync.ps
scihoo:scihoo
6 配置rsync密码文件权限
[root@test home]# chown root.rootrsync.ps
[root@test home]# chmod 400rsync.ps
7 启动配置
[root@test home]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
8 如果xinetd没有的话,需要安装一下
[root@test home]# yum -y install xinetd
启动rsync server
RSYNC服务端启动的两种方法
9、启动rsync服务端(独立启动)
[root@test home]# /usr/bin/rsync --daemon
10、启动rsync服务端 (有xinetd超级进程启动)
[root@test home]# /etc/init.d/xinetd reload
11 加入rc.local
在各种操作系统中,rc文件存放位置不尽相同,可以修改使系统启动时把rsync--daemon加载进去。
[root@test home]# vi /etc/rc.local
/usr/local/rsync –daemon #加入一行
12 检查rsync是否启动
[root@test home]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
xinetd 4396 root 5u IPv4 633387 TCP *:rsync(LISTEN)
客户端配置
1 配置三个过程就可以了
1.1 设定密码文件
1.2 测试rsync执行指令
1.3 将rsync指令放入工作排程(crontab)
[root@aj1 home]# vi/etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftpserver, as it \
# allows crc checksumming etc.
service rsync
{
disable = yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
1.1 配置密码文件 (注:为了安全,设定密码档案的属性为:600。rsync.ps的密码一定要和RsyncServer密码设定案里的密码一样)
[root@aj1 home]# vi rsync.ps
sciooo
[root@aj1 home]# chown root.root .rsync.ps #注意必须给权限
[root@aj1 home]# chmod 600 .rsync.ps # 必须修改权限
1.2 从服务器上下载文件
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.psscihoo@192.168.0.206::backup /home/
从本地上传到服务器上去
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps/home scihoo@192.168.0.206::backup
[root@Hammerhome]# rpm -qa |grep rsync #检查系统是否安装了rsync软件包
rsync-2.6.8-3.1
[root@Hammer CentOS]# rpm -ivh rsync-2.6.8-3.1.i386.rpm #如果没有安装则手动安装
[root@test rsync-3.0.4]# vim/etc/xinetd.d/rsync
1 配置rsync servervi /etc/xinetd.d/rsync
将disable=yes改为no
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
2 配置rsync自动启动
[root@test etc]# chkconfig rsync on
[root@test etc]# chkconfig rsync --list
rsync on
3 配置rsyncd.conf
[root@test etc]# vim rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]
path = /srv
comment = This is test
auth users = scihoo
uid = root
gid = root
secrets file = /home/rsync.ps
read only = no
list = no
4 确保etc/services中rsync端口号正确
[root@test etc]# vim /etc/services
rsync 873/tcp # rsync
rsync 873/udp # rsync
5配置rsync密码(在上边的配置文件中已经写好路径)/home/rsync.ps(名字随便写,只要和上边配置文件里的一致即可),格式(一行一个用户)
[root@test etc]# vi/home/rsync.ps
scihoo:scihoo
6 配置rsync密码文件权限
[root@test home]# chown root.rootrsync.ps
[root@test home]# chmod 400rsync.ps
7 启动配置
[root@test home]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
8 如果xinetd没有的话,需要安装一下
[root@test home]# yum -y install xinetd
启动rsync server
RSYNC服务端启动的两种方法
9、启动rsync服务端(独立启动)
[root@test home]# /usr/bin/rsync --daemon
10、启动rsync服务端 (有xinetd超级进程启动)
[root@test home]# /etc/init.d/xinetd reload
11 加入rc.local
在各种操作系统中,rc文件存放位置不尽相同,可以修改使系统启动时把rsync--daemon加载进去。
[root@test home]# vi /etc/rc.local
/usr/local/rsync –daemon #加入一行
12 检查rsync是否启动
[root@test home]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
xinetd 4396 root 5u IPv4 633387 TCP *:rsync(LISTEN)
客户端配置
1 配置三个过程就可以了
1.1 设定密码文件
1.2 测试rsync执行指令
1.3 将rsync指令放入工作排程(crontab)
[root@aj1 home]# vi/etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftpserver, as it \
# allows crc checksumming etc.
service rsync
{
disable = yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
1.1 配置密码文件 (注:为了安全,设定密码档案的属性为:600。rsync.ps的密码一定要和RsyncServer密码设定案里的密码一样)
[root@aj1 home]# vi rsync.ps
sciooo
[root@aj1 home]# chown root.root .rsync.ps #注意必须给权限
[root@aj1 home]# chmod 600 .rsync.ps # 必须修改权限
1.2 从服务器上下载文件
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.psscihoo@192.168.0.206::backup /home/
从本地上传到服务器上去
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps/home scihoo@192.168.0.206::backup
0 0
- Linux服务器的代码同步
- windows本地代码同步到Linux开发服务器的方法
- svn客户端提交项目代码后自动同步svn服务器上的项目代码到linux服务器上
- 同步服务器间的数据代码
- 保持Linux服务器间的文件同步
- 保持Linux服务器间的文件同步
- linux的ntp服务器时间同步设置
- Linux服务器文件同步的问题
- eclipse地下如何通过CVS同步代码服务器的代码
- Linux服务器时间同步
- Linux 服务器 文件同步
- Linux服务器时间同步
- Linux服务器同步时间
- Linux服务器时间同步
- linux服务器同步时间
- Linux 服务器时间同步
- Linux服务器时间同步
- Linux服务器时间同步
- Exported service does not require permission警告
- BeautifulSoup4的安装及使用
- Android ZXing 2.3.0编译方法
- Wing IDE 破解版/注册机/注册码/破解方法
- linux下安装jdk,让eclipse使用sun jdk
- Linux服务器的代码同步
- java软件托盘MenuItem 显示中文出现框框乱码、读取ini配置文件乱码
- vim配置
- Hbase性能优化之配置
- 嵌入式ARM系统实战开发教程下载
- asm335x系列adc和触摸屏驱动
- 多线程多任务断点续传
- linux安装mysql
- 马年吉祥--万事顺意