a、配置 Sersync 环境变量

[root@SERSYNC sersync]# echo 'export PATH=$PATH:/usr/local/sersync/bin'>>/etc/profile

[root@SERSYNC sersync]# tail -1 /etc/profile export PATH=$PATH:/usr/local/sersync/bin [root@SERSYNC sersync]# . /etc/profile [root@SERSYNC sersync]# which sersync

启动的过程及结果:

注意:我们这里要启动的是多实例,即 confxml.xml 和 download_confxml.xml

[root@SERSYNC ~]# ls /usr/local/sersync/conf/*

/usr/local/sersync/conf/confxml.xml

/usr/local/sersync/conf/confxml.xml.bak.2014-06-04

/usr/local/sersync/conf/download_confxml.xml

[root@SERSYNC ~]# sersync -r -d -o /usr/local/sersync/conf/confxml.xml

set the system param

execute:echo 50000000 > /proc/sys/fs/inotify/max_user_watches

execute:echo 327679 > /proc/sys/fs/inotify/max_queued_events

parse the
command param

option: -r rsync all the local files to the remote servers before the sersync work

option: -d run as a daemon

option: -o config xml name: /usr/local/sersync/conf/confxml.xml

daemon thread num: 10

parse xml config file

host ip : localhosthost port: 8008

daemon start,sersync run behind the  console

use
rsync password-file :

user isrsync_bak

passwordfile is /etc/rsync.password config xml parse success

please set /etc/rsyncd.conf max connections=0 Manually

sersync working
thread 12 = 1(primary thread) + 1(fail retry thread) + 10(daemon sub
thr eads)

Max threads numbers is: 32 = 12(Thread pool nums) + 20(Sub threads)

chmod: cannot access `/usr/local/logs/rsync_fail_log.sh': No such file or
directory

------------------------------------------

rsync
the directory recursivly to the remote servers once
working please wait...

execute command: cd /data/web &&
rsync -aruz -R --delete ./ --timeout=100 rsync_bak

@172.16.100.1::web --password-file=/etc/rsync.password >/dev/null 2>&1

run the sersync:

watch path is: /data/web

[root@SERSYNC ~]# sersync -r -d -o /usr/local/sersync/conf/download_confxml.xml

set the system param

execute:echo 50000000 > /proc/sys/fs/inotify/max_user_watches

execute:echo 327679 > /proc/sys/fs/inotify/max_queued_events

parse the
command param

option: -r rsync all the local files to the remote servers before the sersync work

option: -d run as a daemon

option: -o config xml name: /usr/local/sersync/conf/download_confxml.xml

daemon thread num: 10

parse xml config file

host ip : localhosthost port: 8008

daemon start,sersync run behind the console

use rsync password-file :

user isrsync_bak

passwordfile is /etc/rsync.password config xml parse success

please set /etc/rsyncd.conf max connections=0 Manually

eads)

Max threads numbers is: 32 = 12(Thread pool nums) + 20(Sub threads)

please according
your cpu ,use -n param to
adjust the cpu rate

chmod: cannot access `/usr/local/logs/rsync_fail_log.sh': No such file or
directory

------------------------------------------

rsync the directory recursivly to the remote servers once

working please wait...

execute command: cd /data/download && rsync -aruz -R --delete ./ --timeout=100 rsync

_bak@172.16.100.1::download --password-file=/etc/rsync.password >/dev/null 2>&1

run the sersync:

watch path is: /data/download

b、开启后查看进程

[root@SERSYNC ~]# ps -ef |grep sersync

root      2114     1 0 01:56 ?        00:00:00 sersync -r -d -o
/usr/local/sersync/conf/confxml.

xml

root      2223     1 0 02:03 ?        00:00:00 sersync -r -d -o
/usr/local/sersync/conf/downloa

d_confxml.xml

root      2295 2244 0 02:08 pts/2    00:00:00 grep sersync

C、配置开机自启动

[root@SERSYNC ~]# cp /etc/rc.local /etc/rc.local.bak._$(date +%F)

[root@SERSYNC ~]# cat >>/etc/rc.local<< 'EOF'

> # sync data to 172.16.100.1,172.16.100.2

> sersync -d -o
/usr/local/sersync/conf/confxml.xml

> sersync -d -o
/usr/local/sersync/conf/download_confxml.xml

> EOF

linux开启 Sersync 守护进程进行数据同步的更多相关文章

  1. rsync 守护进程及实时同步

    目录 rsync 守护进程及实时同步 rsync简介 rsync特性 rsync应用场景 cp命令 scp命令 rsync的传输方式 rsync的传输模式 rsync实际使用 rsync命令 案例 r ...

  2. Linux实战教学笔记21:Rsync数据同步工具

    第二十一节 Rsync数据同步工具 标签(空格分隔): Linux实战教学笔记-陈思齐 ---本教学笔记是本人学习和工作生涯中的摘记整理而成,此为初稿(尚有诸多不完善之处),为原创作品,允许转载,转载 ...

  3. Linux学习之守护进程详解

    Linux系统守护进程详解                                                              ---转自:http://yuanbin.blog ...

  4. Linux架构--------Rsync守护进程推和拉

    一.Rsync基本概述 rsync是一款开源.快速.多功能.可实现全量及增量的本地或远程数据同步备份的优秀工具.rsync软件适用于Unix/linux/Windows等多种操作系统平台. 二.Rsy ...

  5. linux下daemon守护进程的实现(以nginx代码为例)

    ngx_int_t ngx_daemon(ngx_log_t *log) { int fd; // 让init进程成为新产生进程的父进程: // 调用fork函数创建子进程后,使父进程立即退出.这样, ...

  6. rsync (windows 服务端,linux客户端)将windows上的数据同步到linux服务器,反之也可

    一:总体概述. 1.windows上面首先装CW_rsync_Server.4.1.0_installer,安装时要输入的用户名密码要记住哦!接下来就是找到rsyncd.conf进入配置细节 2.li ...

  7. linux系统编程--守护进程,会话,进程组,终端

    终端: 在UNIX系统中,用户通过终端登录系统后得到一个Shell进程,这个终端成为Shell进程的控制终端(Controlling Terminal), 进程中,控制终端是保存在PCB中的信息,而f ...

  8. Linux 中的 守护进程

    什么是守护进程 脱离控制终端的,运行于后端的进程,由系统管理的,按计划自动启动/停止/重启,用以执行特定的任务. 为什么要有守护进程? 在某些需求场景下,我们希望某项系统任务能够按计划按预期,始终/自 ...

  9. linux下的守护进程daemon

    什么是守护进程?其实感觉守护进程并没有什么明确的定义,只是守护进程有一些特征,这是它需要遵循的. 守护进程的第一个特征是长时间在后台运行的程序,并且主要是为了提供某种服务,而为了能够让服务尽可能随时都 ...

随机推荐

  1. 洛谷P2258 子矩阵——题解

    题目传送 表示一开始也是一脸懵逼,虽然想到了DP,但面对多变的状态不知从何转移及怎么合理记录状态.之(借鉴大佬思路)后,豁然开朗,于是在AC后分享一下题解. 发现数据范围出奇地小,不过越是小的数据范围 ...

  2. 一本通&&洛谷——P1120 小木棍 [数据加强版]——题解

    题目传送 一道特别毒瘤能提醒人不要忘记剪枝的题. 首先不要忘了管理员的话.忘把长度大于50的木棍过滤掉真的坑了不少人(包括我). 显然是一道DFS题 .考虑剪枝. 找找搜索要面临的维度.状态:原始木棍 ...

  3. Maps.newHashMap 和 new HashMap的区别

    区别: (1)Map<String, Object> result = new HashMap<String,Object>(); 这种是java原生API写法,需要你手动加泛 ...

  4. Jmeter之HTTP请求图片上传功能

    在现在很多功能都存在图片上传,所以简单说明一下使用jmeter进行图片上传. 界面显示并说明 添加一个HTTP请求的取样器 1.获取上传图片的接口,配置路径和参数 2.在HTTP请求中,Impleme ...

  5. KETTLE——(例)简单的字段转换

    一个简单的小例子:结合数据抽取.简单的字段转换.数据输出. 资源库连接.数据输入.数据输出.参见之前的文章. ​ 基本的转换结构是这样的,我们从表中输入,选择我们需要的字段,已经对应的名称,然后将数据 ...

  6. @SuppressWarnings https://www.cnblogs.com/fsjohnhuang/p/4040785.html

    一.前言 编码时我们总会发现如下变量未被使用的警告提示: 上述代码编译通过且可以运行,但每行前面的“感叹号”就严重阻碍了我们判断该行是否设置的断点了.这时我们可以在方法前添加 @SuppressWar ...

  7. DataGridView数值列和日期列

    本文转自:http://www.cnblogs.com/conexpress/p/5923324.html 在使用DataGridView编辑数据的时候,编辑的单元格一般会显示为文本框,逻辑值和图片会 ...

  8. [Udemy] ES 7 and Elastic Stack - part 3

    Section 7: Analyzing Log Data with the Elastic Stack

  9. ios平台appstore不支持网页内嵌app解决方案

    苹果一直拒绝 UIWebView 内嵌 HTML5 页面的 iPhone.iPad APP应用上架到 App Store,建议这样的APP去做成Safari的Web应用.但是,苹果的审核人员只从界面. ...

  10. 20190909 SpringBoot集成Swagger

    SpringBoot集成Swagger 1. 引入依赖 // SpringBoot compile('org.springframework.boot:spring-boot-starter-web' ...