当前位置: 首页 > 编程日记 > 正文

centos6.5 rsync+inotify同步配置笔记

以两台服务器为例:

主服务器: 192.168.1.100

从服务器: 192.168.1.101

1.安装rsync (主服务器与从服务器同时安装)

使用xinetd管理rsync

yum install rsync xinetd

设置开机启动

vi /etc/xinetd.d/rsync

  ...

  修改为 disable = no 

  ...

启动xinetd

/etc/init.d/xinetd start

2.主服务器配置

vi /etc/rsyncd.conf

pid file = /var/run/rsyncd.pid

port = 873
address = 192.168.1.100

uid = www
gid = www

use chroot = yes
read only = yes

hosts allow = 192.168.1.101
hosts deny = *

max connections = 10

transfer logging = yes
log file = /data/logs/rsync_server.log
syslog facility = local3

timeout = 600

[data_1]
path = /data/www/data_1/
exclude = application/Runtime/ www/logs/  runtime/
auth users = www
list = yes
ignore errors
secrets file = /etc/rsyncd.password
comment = data_1

vi /etc/rsyncd.password

...

  test

  ...

  设置权限

  chmod 600 /etc/rsyncd.conf 

  chmod 600 /etc/rsyncd.password

  重启rsync服务

  /etc/init.d/xinetd restart

  检查服务是否运行

  lsof -i:873

修改inotify参数
sysctl -w fs.inotify.max_queued_events="9999999"
sysctl -w fs.inotify.max_user_watches="9999999"
sysctl -w fs.inotify.max_user_instances="65535"

  编辑inotify监控脚本

  vi /opt/sh/inotify.sh

src=/data/www/data_1/
des1=data_1
host1=192.168.1.101
user1=www

/usr/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' -e modify,delete,create,attrib $src | while read file D E F;

do
/usr/bin/rsync -uoavzcr --progress $src $user1@$host1::$des1 --password-file=/etc/rsyncd.password
done

  

3.从服务器配置

同主服务器一样安装rsync和xinetd

配置从服务器rsyncd.conf

pid file = /var/run/rsyncd.pid

port = 873
address = 192.168.1.101

uid = www
gid = www

use chroot = yes
read only = no #一定关闭

hosts allow = 192.168.1.100
hosts deny = *

max connections = 10

transfer logging = yes
log file = /data/logs/rsync_slave.log
syslog facility = local3

timeout = 600

[data_1]
path = /data/www/data_1/
exclude = application/Runtime/ www/logs/  runtime/
auth users = www
list = yes
ignore errors
secrets file = /etc/rsyncd.password
comment = data_1

4.开始同步测试

在两台服务器分别建立一样的目录层级

mkdir /data/www/data_1/


  主服务器开启inotify监控脚本

  chmod +x /opt/sh/inotify.sh

  /opt/sh/inotify.sh

  加入开机启动

  echo "/opt/sh/inotify.sh &" >> /etc/rc.local

  在主服务器添加测试文件观察从服务器是否自动同步

  touch /data/www/data_1/1.txt

PS:

1.rsync配置权限统一修改为600

2.inotify脚本注意添加运行权限

3.注意主服务器与从服务器需要同步的文件夹初始权限需要相同

4.关键在于从服务器的配置

转载于:https://www.cnblogs.com/coder-ct/p/6439014.html

相关文章:

HOG 特征计算实现

// 获取HOG直方图 cv::Mat getHog(Point pt,std::vector<Mat> &integrals) {// 判断当前点的位置是否符合条件 if( pt.x - R < 0 ||pt.y - R < 0 ||pt.x R > integrals[0].cols ||pt.y R > integrals[0].rows ){return Mat();}// 直方图Mat hist(Size(…

Spring+SpringMVC+Mybatis整合

一、简单测试工程搭建1、Mybatis所需要的的jar包&#xff08;包含数据库驱动包和相关的日志包&#xff09;、SpringMVC和Spring的jar包2、然后构建一个基本的工程&#xff0c;这里我们使用mapper代理的方式进行Mybatis的编写&#xff0c;关于mapper代理请参考Mybatis简单入门中…

【Tools】Markdown数学符号公式(史上最全公式表)

Markdown数学符号&公式 文章目录Markdown数学符号&公式1. 希腊字母表2. 希腊字母3. 数学符号表4. 数学符号5. 数学符号补充表6. 数学符号补充1. 希腊字母表 符号代码符号代码α\alphaα\alphaA\AlphaA\Alphaβ\betaβ\betaB\BetaB\Betaγ\gammaγ\gammaΓ\GammaΓ\gam…

Editplus下载、安装并最佳配色方案(强烈推荐)

不多说&#xff0c;直接上干货&#xff01; Editplus下载 第一步&#xff1a;进入官网 https://www.editplus.com/ 第二步&#xff1a;下载 https://www.editplus.com/download.html Editplus安装 我这里&#xff0c;直接以一个压缩包来安装&#xff0c;需要的&#xff0c;请…

MySQL数据库开发规范-EC

最近一段时间一边在线上抓取SQL来优化&#xff0c;一边在整理这个开发规范&#xff0c;尽量减少新的问题SQL进入生产库。今天也是对公司的开发做了一次培训&#xff0c;PPT就不放上来了&#xff0c;里面有十来个生产SQL的案例。因为规范大部分还是具有通用性&#xff0c;所以也…

操作系统与内存管理

操作系统内存管理 文章目录操作系统内存管理1. 虚拟地址空间2. 内存地址空间含义及分配3. 虚拟内存诞生的前世与今生&#xff1f;3.1 内存管理的好处3.2 **内存管理实现总体策略**4. 不同进程如何划分内存地址空间&#xff1f;5 内存分配与回收5.1 buffer和cache5.2 malloc背后…

圆形 LBP 特征

template <typename _Tp> staticinline void elbp_(InputArray _src, OutputArray _dst,int radius, int neighbors) {// 得到数据矩阵Mat src _src.getMat();// 输出矩阵_dst.create(src.rows-2*radius, src.cols-2*radius, CV_32SC1);Mat dst _dst.getMat();// 初始化…

40个Java多线程问题总结

&#xff08;转&#xff09; 这篇文章作者写的真是不错 40个问题汇总 1、多线程有什么用&#xff1f; 一个可能在很多人看来很扯淡的一个问题&#xff1a;我会用多线程就好了&#xff0c;还管它有什么用&#xff1f;在我看来&#xff0c;这个回答更扯淡。所谓"知其然知其所…

SLAM十四讲笔记1

文章目录ch02 初识SLAMch02-01 经典视觉SLAM框架ch02-02 SLAM问题的数学表述ch03 三维空间刚体运动ch03.01 旋转矩阵&#xff1a;点和向量,坐标系01 向量a在线性空间的基[e1,e2,e3][e_1,e_2,e_3][e1​,e2​,e3​]下的坐标为[a1,a2,a3]T[a_1,a_2,a_3]^T[a1​,a2​,a3​]T.02 向量…

12、OpenCV实现图像的空间滤波——图像平滑

1、空间滤波基础概念 1、空间滤波基础 空间滤波一词中滤波取自数字信号处理&#xff0c;指接受或拒绝一定的频率成分&#xff0c;但是空间滤波学习内容实际上和通过傅里叶变换实现的频域的滤波是等效的&#xff0c;故而也称为滤波。空间滤波主要直接基于领域&#xff08;空间域…

计算 LBP 特征

#include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp> // 计算原始LBP特征 cv::Mat OLBP(cv::Mat& srcImage) {const int nRows …

三维重建【四】-------------------结构光 三维重建----论文调研

1. 动态目标实时三维重建-结构光方案 动态目标 三维重建 Stripe boundary codes for real-time structured-light range scanning of moving objects 我们提出了一种新的实时结构光扫描方法。在分析现有结构光技术的基本假设之后&#xff0c;我们基于编码投影条纹之间的边界&…

APP开发定制

app是什么意思? APP&#xff0c;application的简称&#xff0c;是智能手机的第三方应用程序&#xff0c;常见的有微信、手机qq、今日头条、手机支付宝、腾讯视频、微店等&#xff0c;随着智能手机和ipad等移动终端设备的普及&#xff0c;人们逐渐习惯了使用APP客户端上网的方式…

Haar 特征提取

double HaarExtract(double const ** image ,int type_, cv::Rect roi) {double value;double wh1, wh2;double bk1, bk2;int x roi.x;int y roi.y;int width roi.width;int height roi.height;switch (type_){// Haar水平边缘case 0: // HaarHEdgewh1 calcIntegral(image…

awk的基本⽤法

awk的基本⽤法 awk是报告⽣成器&#xff0c;格式化⽂本输出&#xff0c;有多种版本。centos中的是gawk即GNU awk版本。 awk⼯作原理&#xff1a;第⼀步&#xff1a;执⾏BEGIN{action;...}语句块中的语句。第⼆步&#xff1a;从⽂件或标准输⼊&#xff08;stdin&#xff09;读取…

视音频数据处理入门:RGB、YUV像素数据处理【转】

转自&#xff1a;http://blog.csdn.net/leixiaohua1020/article/details/50534150 视音频数据处理入门系列文章&#xff1a; 视音频数据处理入门&#xff1a;RGB、YUV像素数据处理 视音频数据处理入门&#xff1a;PCM音频采样数据处理 视音频数据处理入门&#xff1a;H.264视频…

SVO(SVO: fast semi-direct monocular visual odometry)

SVO&#xff08;SVO: fast semi-direct monocular visual odometry&#xff09;翻译 文章目录SVO&#xff08;SVO: fast semi-direct monocular visual odometry&#xff09;翻译1、介绍2、系统概述3、符号4、运动估计4.1、 基于稀疏模型的图像对齐4.2、 通过特征对齐松弛4.3、…

MSER 候选车牌区域检测

#include "opencv2/highgui/highgui.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> // Mser车牌目标检测 std::vector<cv::Rect> mserGetPlate(cv::Mat srcImage…

从HelloWorld看Knative Serving代码实现

为什么80%的码农都做不了架构师&#xff1f;>>> 摘要&#xff1a; Knative Serving以Kubernetes和Istio为基础&#xff0c;支持无服务器应用程序和函数的部署并提供服务。我们从部署一个HelloWorld示例入手来分析Knative Serving的代码细节。 概念先知 官方给出的这…

svo_note

SVO论文笔记1.frame overviews2. Motion Estimate Thread2.1 Sparse Model-based Image Alignment 基于稀疏点亮度的位姿预估2.2 Relaxation Through Feature Alignment 基于图块的特征点匹配2.3 Pose and Structure Refinement3 Mapping Thread3.1 depth-filter3.2 初始化参考…

Druid 配置 wallfilter

这个文档提供基于Spring的各种配置方式 使用缺省配置的WallFilter <bean id"dataSource" class"com.alibaba.druid.pool.DruidDataSource" init-method"init" destroy-method"close">...<property name"filters" v…

vue下的bootstrap table + jquery treegrid, treegrid无法渲染的问题

在mian.js导入的包如下&#xff1a;该bootstrap-table-treegrid.js需要去下载&#xff0c;在复制到jquery-treegrid/js/ 1 import $ from jquery 2 import bootstrap/dist/css/bootstrap.min.css 3 import bootstrap/dist/js/bootstrap.min 4 import bootstrap-table/dist/boot…

内存和缓存的区别

今天看书的时候又看到了内存和缓存&#xff0c;之所以说又&#xff0c;是因为之前遇到过查过资料&#xff0c;但是现在又忘了(图侵删)。 所以又复习一遍&#xff0c;记录一下&#xff0c;有所纰漏的地方&#xff0c;欢迎指正。 同志们&#xff0c;上图并不是内存和缓存中的任何…

【Boost】noncopyable:不可拷贝

【CSDN】&#xff1a;boost::noncopyable解析 【Effective C】&#xff1a;条款06_若不想使用编译器自动生成地函数&#xff0c;就该明确拒绝 1.example boost::noncopyable 为什么要boost::noncopyable 在c中定义一个类的时候&#xff0c;如果不明确定义拷贝构造函数和拷贝赋…

BigData NoSQL —— ApsaraDB HBase数据存储与分析平台概览

一、引言时间到了2019年&#xff0c;数据库也发展到了一个新的拐点&#xff0c;有三个明显的趋势&#xff1a; 越来越多的数据库会做云原生(CloudNative)&#xff0c;会不断利用新的硬件及云本身的优势打造CloudNative数据库&#xff0c;国内以阿里云的Cloud HBase、POLARDB为代…

ubuntu clion 创建桌面快捷方式

ubuntu clion 创建桌面快捷方式 首先在终端下输入 cd /usr/share/applications/进入applications目录下&#xff0c;建立一个clion.desktop文件 sudo touch clion.desktop然后在vim命令下编辑该文件 sudo vim clion.desktop进入vim后&#xff0c;按i插入开始编辑该文件&…

Flex 布局:语法篇

2019独角兽企业重金招聘Python工程师标准>>> 布局的传统解决方案&#xff0c;基于盒状模型&#xff0c;依赖 display 属性 position 属性 float 属性。它对于那些特殊布局非常不方便&#xff0c;比如&#xff0c;垂直居中就不容易实现。 2009年&#xff0c;W3C 提…

特征运动点估计

cv::Mat getRansacMat(const std::vector<cv::DMatch>& matches, const std::vector<cv::KeyPoint>& keypoints1, const std::vector<cv::KeyPoint>& keypoints2, std::vector<cv::DMatch>& outMatches) {// 转换特征点格式std::vecto…

Vue+Element-ui+二级联动封装组件

通过父子组件传值 父组件&#xff1a; 1 <template>2 <linkage :citysList"citysList" :holder"holder" saveId"saveId"></linkage>3 </template>4 <script>5 import linkage from ./common/linkage6 export de…

MOG2 成员函数参数设定

pMOG2->setDetectShadows(true); // 背景模型影响帧数 默认为500 pMOG2->setHistory(1000); // 模型匹配阈值 pMOG2->setVarThreshold(50); // 阴影阈值 pMOG2->setShadowThreshold(0.7);前景中模型参数&#xff0c;设置为0表示背景&#xff0c;255为前景&#xff…