rsync

rsync同步文件简单使用

家住魔仙堡 提交于 2020-01-16 01:18:11
注:本文基于rsync-3.1.2-6.el7_6.1编写 1、环境准备 机器 用途 192.168.0.100 rsync服务端 192.168.0.120 rsync客户端 2、服务端配置 安装rsync 由于使用CentOS 7系统,因此,rsync已经安装好,如果没安装直接使用yum安装即可, yum install -y rsync 配置rsyncd.conf [ root@CentOS-7-4 /home ] # cat /etc/rsyncd.conf uid = nobody gid = nobody use chroot = false max connections = 4 pid file = /var/run/rsyncd.pid log file = /var/log/rsyncd.log lock file = /var/run/rsync.lock transfer logging = yes [ test ] path = /testdir/ auth users = testuser secrets file = /etc/rsyncd.secrets read only = false uid = root gid = root 其中, log file 即为rsync日志,出现问题的时候查看这个来看报错信息 path 即为test模块映射的目录

Rsync daemon服务器端安装配置步骤

Deadly 提交于 2020-01-15 19:22:05
1、查看rsync是否安装 rpm -qa rsync yum install rsync openssh-clients -y 2、添加用户 rsync useradd rsync -s /sbin/nologin -M tail -1 /etc/passwd 3、配置rsyncd.conf vim /etc/rsyncd.conf #rsync_config_ __ start ##rsyncd.conf start## uid = rsync //虚拟用户,远端的命令需要使用rsync访问共享目录 gid = rsync //虚拟用户组 use chroot = no //安全 max connections = 200 //最大连接数 timeout = 300 //超时设置 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock //锁文件,避免冲突。避免同时进行操作 log file = /var/log/rsyncd.log //日志 [backup] //模块名称 path = /backup //服务器端nfs共享目录 ignore errors //忽略错误 read only = false //可读可写权限 list = false //不允许列表,ls hosts allow = 172

CentOS6 & CentOS7服务启动文件

点点圈 提交于 2020-01-14 19:50:47
1.CentOS6 (1)以rsync为例 #!/bin/bash # chkconfig: 2345 20 80 # description: rsync.sh function start_rsync { if [ ! -s /var/run/rsyncd.pid ];then /usr/bin/rsync --daemon else echo -e "\033[33mRsync is already running\033[0m" fi } function stop_rsync { if [ -s /var/run/rsyncd.pid ];then kill `cat /var/run/rsyncd.pid` else echo -e "\033[33mRsync is no running\033[0m" return 1 fi } function restart_rsync { stop_rsync if [ $? -ne 1 ];then sleep 1 start_rsync fi } case $1 in start) start_rsync ;; stop) stop_rsync ;; restart) restart_rsync ;; *) echo -e "\033[33mUsage: start | stop | restart \033[0m" ;;

rsync同步文件

青春壹個敷衍的年華 提交于 2020-01-14 18:12:25
一.服务端(需要被同步文件的主机) 1. 安装rsync yum install -y rsync 2. 配置,新增配置文件/etc/rsyncd.conf [global] uid = root gid = root use chroot = no max connections = 10 list = yes pid file = /var/run/rsyncd.pid lock file = /var/run/rsyncd.lock log file = /var/log/rsyncd.log hosts allow = 192.168.217.130 //白名单,允许同步的机器IP地址 [data] //数据目录别名,同步时需要用到 path = /usr/local/src //别名对应的同步目录 ignore errors read only = yes auth users = vicxiang //同步时用到的用户名 secrets file = /etc/sery.pass //同步时用到的账号密码配置文件 3. 配置,新增配置文件/etc/sery.pass vicxiang:123456 修改文件权限 chmod 600 /etc/sery.pass 4. 启动rsync服务 rsync --daemon --config=/etc/rsyncd.conf 5

shell脚本设置钉钉告警模板

走远了吗. 提交于 2020-01-14 11:38:06
shell脚本模板 #!/bin/bash source ~/.bash_profile logfile=/tmp/rsync_dags.log time=$(date "+%Y-%m-%d %H:%M:%S") webhook='https://oapi.dingtalk.com/robot/send?access_token=4e13850af53becaa396694e4dq076d7feeecd7161c1ae3fec73036f263eb394c' ###webhook这个就是图五中要求复制下来的url host='spark001' 报警函数: function SendMsgToDingding() { curl $webhook -H 'Content-Type: application/json' -d " { 'msgtype': 'text', 'text': { 'content': ' 时间:$time 服务器:$host 告警信息:rsync error报错$errorcount次 报错日志路径:[/tmp/rsync_dags.log] 报错脚本:[/home/admin/program/airflow/rsync_dags.sh] 请马上处理!!!' #####content里的内容根据自己的报警内容编辑 }, 'at': { 'isAtAll':

rsync 备份服务搭建(完成)

邮差的信 提交于 2020-01-13 20:09:18
rsync服务守护进程 服务器端配置过程: 1. 检查rsync是否安装: rpm -qa rsync 2.添加rsync服务的用户,管理本地目录 useradd-s /sbin/nologin -M rsync 3.生成rsyncd.conf 配置文件(默认没有需要手动创建) touch /etc/rsyncd.conf 4. 写入配置到 /etc/rsyncd.conf 文件中 #rsync_config #created by HQ at 2017 ##rsyncd.conf start## uid = rsync gid = rsync use chroot = no max connections = 200 timeout = 300 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log ignore errors read only = false list = false hosts allow = 172.16.1.0/24 hosts deny = 0.0.0.0/32 ##这两个同时写,那就会造成其他IP段也能通过rsync传文件,解决办法,保留一个 auth users = rsync_backup secrets file

基于Docker构建带有Rsync的Jenkins

帅比萌擦擦* 提交于 2020-01-13 18:40:44
1.编辑Dockerfile文件 FROM jenkins USER root ADD sources.list /etc/apt/sources.list RUN apt-get update && apt-get install -y rsync RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ADD rsync.password /etc/rsync.password RUN chmod 600 /etc/rsync.password && chown jenkins:jenkins /etc/rsync.password ADD timezone /etc/timezone USER jenkins    注:sources.list 为国内的debian源。 rsync.password 为rsync远程同步的密码文件。 timezone 为时区文件否则,jenkins会差8个小时。内容Asia/Shanghai。 2.构建镜像 docker build -t jenkins:jenkins-chao . 3.构建Docker容器 docker run --name myjenkins -uroot -p 8081:8080 -p 50000:50000 -v /srv/jenkins_home:/var

Git/rsync mix for projects with large binaries and text files

笑着哭i 提交于 2020-01-13 13:12:40
问题 Is anyone aware of a project that can effectively combine git version control for text-based files and something like rsync for large binary files (like data)? Obviously, this is a little beyond what a DVCS should do, but I am curious if anyone has written a smart wrapper around git to do such things to sync with a central repository. 回答1: You might like git-annex. From its homepage: git-annex allows managing files with git, without checking the file contents into git. While that may seem

rsync local code with a remote clearcase dynamic view

时光怂恿深爱的人放手 提交于 2020-01-13 06:22:46
问题 I want to syncrhonize a local path with a dynamic clearcase view hosted in a remote machine only accesible through ssh: local:/me | <== ssh == | me@remote_host:/vobs/me/view_1 Those familiar with clearcase know that in order create a dynamic view you must issue the following command in the remote host 'cleartool setview view_1' where view_1 is the reference to the pre-existant tagged dynamic view, problem is that when i try to run that command with the --rsync-path option to rsync, it never

CentOS配置rsync+inotify实时同步

北城以北 提交于 2020-01-12 05:22:32
一、rsync简介 1.rsync是一个快速备份工具,可以在不同主机之间镜像同步整个目录树,支持增量备份,保持连接和权限,在传输前压缩,非常适合异地备份、镜像服务器等 2.rsync有上行和下行同步 上行:恢复 下行:备份 二、安装配置rsync 1.rsync默认已经安装,只需要进行配置 2.配置 1)建立配置文件 vim /etc/rsyncd.conf uid = nobody gid = nobody use chroot = yes #禁锢在源目录 address = 192.168.1.10 #监听地址(本机) port 837 #监听端口 log file = /var/log/rsyncd.log #日志文件 pid file = /var/run/rsyncd.pid #pid文件 hosts allow = 192.168.1.3 #允许访问自己的客户机地址,可以是网段 [111] #共享模块名称 path = /var/www/html #源目录的实际路径 comment = Document Root of www.love.com read only = no #是否为只读 dont compress = *.gz *.bz2 *.tgz *.zip *.rar *.z #同步时不再压缩的文件类型 auth users = backuper #授权账户