git自动化部署+rsync文件同步
1、进入线上git裸仓库

2、编辑post-receive
#!/bin/sh
unset GIT_DIR
cd /var/www/
git pull http://web:xxxxxxx@120.31.131.xxx:8099/root/withdraw_api.git
3、使用rsync
①、服务器端 A (192.168.48.128)
yum -y install rsync # 安装rsync同步服务
echo "root:root" > /etc/rsyncd.secrets #账号密码
chmod 600 /etc/rsyncd.secrets #这一步不可缺少,不然会报错。
# 编辑配置文件 /etc/rsyncd.conf
pid file = /var/run/rsyncd.pid
port = 873
address = 192.168.48.128 # 绑定本机ip
uid = root
#gid = root
use chroot = yes
read only = yes
#limit access to private LANs
#hosts allow=192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0
#hosts deny=*
max connections = 5
#motd file = /etc/rsyncd.motd
#This will give you a separate log file
#log file = /var/log/rsync.log
#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
#模块名 配置同步的文件目录
[rhel4home]
path = /var/www/html/
list=yes
ignore errors
auth users = root
secrets file = /etc/rsyncd.secrets
comment = This is RHEL 4 data
#exclude = easylife/ samba/ #排除要同步的目录
#添加端口放行
/sbin/iptables -I INPUT -p tcp --dport 873 -j ACCEPT
②、客户端 B(192.168.48.129)
yum -y install rsync # 安装rsync同步服务
# 客户端密码 /etc/rsyncd.secrets(仅保留明文密码就行)
root
rsync -auv --password-file=/etc/rsyncd.secrets root@192.168.48.128::rhel4home /var/www/html
说明:
客户端git推送文件到线上master裸仓库会触发git钩子并执行定义好的脚本同步拉取最新代码到项目部署目录
rsync作用是多台服务器同步一套代码
git自动化部署+rsync文件同步的更多相关文章
- Jenkins+Docker+Git 自动化部署
Jenkins+Docker+Git 自动化部署图文教程 https://blog.csdn.net/qq_38252039/article/details/89791247 前言: 通过几天的学习和 ...
- Rsync文件同步
Rsync文件同步 本章结构 关于rsync 1.一款增量备份工具,remote sync,远程同步,支持本地复制或者与其他SSH.rsync主机同步,官方网站:http://rsync.samba. ...
- CentOS系统rsync文件同步 安装配置
rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync 它的特性如下: 可以镜像保存整个目录树和文件系统. 可以很容易做到保持原来文件的权限.时间.软硬 ...
- rsync 文件同步和备份
rsync 是同步文件的利器,一般用于多个机器之间的文件同步与备份,同时也支持在本地的不同目录之间互相同步文件.在这种场景下,rsync 远比 cp 命令和 ftp 命令更加合适,它只会同步需要更新的 ...
- Rsync文件同步工具
前段时间因公司需求,需要把备份的文件进行同步保存,后面就想到了我们大家都最熟悉的文件同步工作Rsync,于是就捣鼓了一下午时间,然后总结了下大概过程和参数详情. 首先了解了下rsync同步的大致原理: ...
- linux 下的 rsync 文件同步
rsync是linux下的一款快速增量备份工具Remote Sync,是一款实现远程同步功能的软件,它在同步文件的同时,可以保持原来文件的权限.时间.软硬链接等附加信息.rsync是用 “rsync ...
- inotify 与 rsync文件同步实现与问题
首先分别介绍inotify 与 rsync的使用,然后用两者实现实时文件同步,最后说一下这样的系统存在什么样的问题. 1. inotify 这个具体使用网上很多,参考 inotify-tools 命令 ...
- rsync文件同步、Inotify-tools参数详解
inotifywait用于等待文件或文件集上的一个待定事件,可以监控任何文件和目录设置,并且可以递归地监控整个目录树: inotifywatch用于收集被监控的文件系统计数据,包括每个inotify事 ...
- Rsync文件同步服务器配置
rsync 是一个Unix/Linux系统下的文件同步和传输工具.rsync是用 “rsync 算法”提供了一个客户机和远程文件服务器的文件同步的快速方法.可以用来做备份或镜像.一.配置文件rsync ...
随机推荐
- 【POJ 3292】 Semi-prime H-numbers
[POJ 3292] Semi-prime H-numbers 打个表 题意是1 5 9 13...这样的4的n次方+1定义为H-numbers H-numbers中仅仅由1*自己这一种方式组成 即没 ...
- mongodb+php通过_id查询
在php中通过_id 在mongodb中查找特定记录: <?php $conn=new Mongo("127.0.0.1:27017"); #连接指定端口远程主机 $db=$ ...
- git svn 报错
删除 openjdk 时 remove 了一大堆软件. 可能由于这个原因导致使用 git svn 命令时出现类似下面的错误. sam@sam-CW65S:pics$ git svn rebase Ca ...
- PowerDesigner逆向工程,从SQL Server数据库生成Physical Model
提前声明:这种方式貌似只能是Power Designer安装在数据库服务器的时候才可以,因为我按照成功的这个再去从本机逆向连接远程服务器的时候,一直提示:test failed......不讲了,尴尬 ...
- SpringInAction4笔记——装配
重点:常用的上下文环境 AnnotationConfigApplicationContext ClassPathXmlApplicationContext FileSystemXmlApplicati ...
- org.gradle.api.publication.maven.internal.DefaultMavenFactory错误
Error:Unable to load class 'org.gradle.api.publication.maven.internal.DefaultMavenFactory'. Possible ...
- 20170223 遇到自建表里面相同key值数据不唯一
我怎么发现这个表里 key值相同数据不唯一, 这两条看起来是完全相同的, 其实排序不能能合并已经说明问题.
- IE67下float左右对齐
例子: <style> .h1{text-align: left;} .leftA{color: #000} .rightA{color: #ccc; float: right;} < ...
- spring boot 打印sql
配置: logging.level.gov.chinatax.ctims.dao.mapper=DEBUG or logging: level: gov.chinatax.ctims.dao.mapp ...
- I2C测试【转】
本文转载自: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ...