系统环境: rhel6 x86_64 iptables and selinux disabled

主机:192.168.122.160 server60.example.com

192.168.122.154 server54.example.com

相关网址: rpm.pbone.net

ftp://ftp.gnutls.org/pub/gnutls/libtasn1/libtasn1-2.1.tar.gz

http://www.sqlite.org/sqlite-2.8.17.tar.gz

http://internode.dl.sourceforge.net/sourceforge/librsync/librsync-0.9.7.tar.gz

ftp://ftp.gnu.org/pub/gnu/gnutls/gnutls-2.6.6.tar.bz2

http://oss.linbit.com/csync2/csync2-1.34.tar.gz

http://jaist.dl.sourceforge.net/sourceforge/inotify-tools/inotify-tools-3.13.tar.gz

所需的包:librsync-0.9.7-15.el6.x86_64.rpm
librsync-devel-0.9.7-15.el6.x86_64.rpm sqlite-2.8.17.tar.gz
gnutls-2.6.6.tar.bz2 csync2-1.34.tar.gz

以下步骤在server60server54上实施:

[root@server60
kernel]# yum install libtasn1-devel make xinetd -y

[root@server60
kernel]# rpm -ivh librsync-0.9.7-15.el6.x86_64.rpm

[root@server60
kernel]# rpm -ivh librsync-devel-0.9.7-15.el6.x86_64.rpm

[root@server60
kernel]# tar zxf sqlite-2.8.17.tar.gz

[root@server60
kernel]# cd sqlite-2.8.17

[root@server60
sqlite-2.8.17]# ./configure

此时会出现如下错误:

(1)configure:
error: no acceptable C compiler found in $PATH

(2)configure:
error: C++ preprocessor "/lib/cpp" fails sanity check

解决方法如下:

(1)[root@server60
sqlite-2.8.17]# yum install gcc -y

(2)[root@server60
sqlite-2.8.17]# yum install gcc-c++ -y

[root@server60
sqlite-2.8.17]# make && make install

[root@server60
sqlite-2.8.17]# ldconfig

[root@server60
kernel]# tar jxf gnutls-2.6.6.tar.bz2

[root@server60
kernel]# cd gnutls-2.6.6

[root@server60
gnutls-2.6.6]# ./configure

此时会出现如下错误:

(1)***
libgcrypt was not found. You may want to get it from

解决方法如下:

[root@server60
gnutls-2.6.6]# yum install libgcrypt-devel -y

[root@server60
gnutls-2.6.6]# make && make install

[root@server60
kernel]# tar zxf csync2-1.34.tar.gz

[root@server60
kernel]# cd csync2-1.34

[root@server60
csync2-1.34]# yum install byacc flex -y

[root@server60
csync2-1.34]# ./configure

此时会出现如下错误:

(1)configure:
error: gnutls not found; install gnutls, gnutls-openssl and libtasn1
packages for your system or run configure with --disable-gnutls

解决方法如下:

(2)[root@server60
csync2-1.34]# echo /usr/local/lib >> /etc/ld.so.conf

[root@server60 csync2-1.34]# ldconfig

[root@server60
csync2-1.34]# make && make install

以下步骤在server60上实施:

[root@server60
csync2-1.34]# make cert

[root@server60
csync2-1.34]# csync2 -k /etc/csync2.key
(server54不用重新创建key,并且生成key时需要不断地移动鼠标或敲击键盘)

[root@server60
csync2-1.34]# vim /etc/csync2.cfg

group mygroup

{

host
server60.example.com server54.example.com; (每台主机完整主机名)

#
host host4@host4-eth2;

#

key /etc/csync2.key;

#

include /opt/csync2; (同步目录)

#
include %homedir%/bob;

#
exclude %homedir%/bob/temp;

#
exclude *~ .*;

#

#
action

#
{

#
pattern /etc/apache/httpd.conf;

#
pattern /etc/apache/sites-available/*;

#
exec "/usr/sbin/apache2ctl graceful";

#
logfile "/var/log/csync2_action.log";

#
do-local;

#
}

#

#
backup-directory /var/backups/csync2;
(防错备份目录,根据自己的需求设置,每台主机上都要有)

#
backup-generations 3;

#

auto
younger; (同步以最新的文件为标准更新)

}

[root@server60
~]# scp /etc/csync2* root@192.168.122.154:/etc/

[root@server60
~]# cd /etc/xinetd.d/

[root@server60
xinetd.d]# cp rsync csync2

[root@server60
xinetd.d]# vim csync2

service
csync2

{

disable
= no

protocol
= tcp

flags
= REUSE

socket_type =
stream

wait = no

user =
root

server
= /usr/local/sbin/csync2

server_args
= -i

}

[root@server60
xinetd.d]# vim /etc/services

csync2
30865/tcp

[root@server60
xinetd.d]# scp /etc/xinetd.d/csync2
root@192.168.122.154:/etc/xinetd.d/

[root@server60
xinetd.d]# scp /etc/services root@192.168.122.154:/etc/

以下步骤在server60server54上实施:

[root@server60
~]# mkdir /opt/csync2

[root@server60
xinetd.d]# /etc/init.d/xinetd start

[root@server60
xinetd.d]# netstat -antple

tcp
0 0 :::30865 :::*
LISTEN 0 28973 24162/xinetd

端口说明启动成功.

测试同步是否正常:

注:所有机子上要有所有主机的解析

在两台机器中的任一台创建或者删除一个文件,然后查看其它机器是否创建或删除。

如果遇到问题就用csync2
-xv命令手动调试并,根据错误信息作调整。

:csync2相关命令介绍

csync2
-vvv -T
测试csync配置是否正确,可以看到相关SQL执行过程.

csync2
-xv
执行同步命令

csync2
-xvvv
执行同步命令,并显示出详细的信息.

应该注意的问题.

缓存相关的目录尽量不要用csync2去处理,这个程序目录尽量交给NFS处理.

Rhel6-csync配置文档的更多相关文章

  1. MYSQL服务器my.cnf配置文档详解

    MYSQL服务器my.cnf配置文档详解 硬件:内存16G [client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-re ...

  2. 转!!Java代码规范、格式化和checkstyle检查配置文档

    为便于规范各位开发人员代码.提高代码质量,研发中心需要启动代码评审机制.为了加快代码评审的速度,减少不必要的时间,可以加入一些代码评审的静态检查工具,另外需要为研发中心配置统一的编码模板和代码格式化模 ...

  3. Hibernate配置文档详解

    Hibernate配置文档有框架总部署文档hibernate.cfg.xml 和映射类的配置文档 ***.hbm.xml hibernate.cfg.xml(文件位置直接放在src源文件夹即可) (在 ...

  4. Java代码规范、格式化和checkstyle检查配置文档

    http://www.blogjava.net/amigoxie/archive/2014/05/31/414287.html 文件下载: http://files.cnblogs.com/files ...

  5. Spring Hibernate4 整合配置文档

    1 applicationContext.xml配置文档 <?xml version="1.0" encoding="UTF-8"?><bea ...

  6. Kerberos主从配置文档

    Kerberos主从配置文档   1. Kerberos主从同步机制 在Master上通过以下命令同步数据: kdb5_util dump /var/kerberos/krb5kdc/slave_db ...

  7. python常用模块-配置文档模块(configparser)

    python常用模块-配置文档模块(configparser) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. ConfigParser模块用于生成和修改常见配置文档,当前模块的名称 ...

  8. azkaban编译安装配置文档

    azkaban编译安装配置文档 参考官方文档: http://azkaban.github.io/azkaban/docs/latest/ azkaban的配置文件说明:http://azkaban. ...

  9. Python学习 :常用模块(四)----- 配置文档

    常用模块(四) 八.configparser 模块 官方介绍:A configuration file consists of sections, lead by a "[section]& ...

  10. configparser模块——配置文档

    configparser模块用于生成和修改常见配置文档. 预制配置文件:conf.ini [DEFAULT] ServerAliveInterval = 45 Compression = yes Co ...

随机推荐

  1. boldSystemFontOfSize 和 systemFontOfSize 的区别

    使用 UIFont 的下列方法: + systemFontOfSize + boldSystemFontOfSize + italicSystemFontOfSize p.p1 { margin: 0 ...

  2. Solr atomic update JSON方式

    http://yonik.com/solr/atomic-updates/ Solr supports several modifiers that atomically update values ...

  3. 调度系统任务创建---创建一个JoinTrigger的依赖任务(五)

    有时候我们需要创建一个任务,这个任务有多个下游任务,在所有下游任务执行成功后再触发一个join操作. 这种场景可以使用JoinTrigger的触发器来实现. 该场景对应的拓扑结构如下: 该触发器的详细 ...

  4. idea打包java可执行jar包

    1,在项目上鼠标右键 --> Open Module Settings 2, Artifacts --> + --> JAR --> From modules with dep ...

  5. 调用微信JsAPI端获取位置

    public partial class test : BasePage { protected test() { AccessPage = PageWebType.WX; } protected s ...

  6. Redis学习-基础环境介绍(二)

    1.通过VMware安装了Centos6.8系统 2.Reids安装过程,需要GCC环境 »通过下面命令,根据提示直接安装 1 yum install gcc 3.Redis选用的是3.2.4(建议使 ...

  7. application、viewstate、纯HTML提交方式

    Application - 全局公共变量组 存放位置:服务端 所有的访问用户都是访问的同一个变量 声明周期:永久 用法同session类似 viewstate-病例 因为http的无状态性,需要记录上 ...

  8. Git撤销操作

      撤销操作的相关文章 http://www.linuxidc.com/Linux/2015-06/119350.htm   ——撤销已经修改,但是还没有添加到暂存区的操作: 解决方案: 有两种情形: ...

  9. weex 小结 --官方扩展组件

    <wxc-tabbar>  页面底部的 tab 标签,通过点击在不同页面之间切换 属性: selected-index {number}:设置默认选中的 tab 索引,默认值为 0(第一个 ...

  10. hibernate hql

    hibernate在使用hql进行select count(*) from ObjectA left join fetch apath 时会报错,多余的left join去掉即可.