Emi*_*ama 5 linux cluster synchronization failed
我找不到任何文章来回答这个问题,所以我最好的办法是在这里发布:
场景我们在生产环境中有 2 个应用程序服务器托管一个 PHP 网站,我希望在这两个文件夹之间同步一些文件夹,同样为开发环境设置没有问题,我已经按照 URL“ http:/ ”中的所有说明进行操作/www.cloudedify.com/synchronising-files-in-cloud-with-csync2/ ”,我似乎仍然有相同的结果,出于故障排除目的,两个盒子上的防火墙都已禁用:
配置文件:cysnc2.cfg
nossl * *;
group production {
host server1;
host server2;
key /etc/csync-production-group.key;
include /etc/httpd/sites-available;
include /xxxxxx/public_html/files
include /xxxxxxx/magento/media/catalog/product
include /xxxxxxx/magento/media/brands
exclude *.log;
exclude /xxxx/public_html/file/cache;
exclude /xxxxx/public_html/magento/var/cache;
exclude /xxxx/public_html/logs;
exclude /xxxxx/public_html/magento/var/log;
backup-directory /data/sync-conflicts/;
backup-generations 2;
auto younger;
}
Run Code Online (Sandbox Code Playgroud)
/etc/xinetd.d/csync2 csync2.cfg
service csync2
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
group = root
server = /usr/sbin/csync2
server_args = -i -D /data/sync-db/
port = 30865
type = UNLISTED
log_type = FILE /data/logs/csync2/csync2-xinetd.log
log_on_failure += USERID
}
Run Code Online (Sandbox Code Playgroud)
我已经确保守护进程在端口 30865 上侦听两台服务器,并且两台服务器上的密钥都匹配
我在每台服务器上运行了一个 tcpdump,输出如下:
12:20:31.366771 IP server1.49919 > server2.csync2: Flags [S], seq 445156159, win 14600, options [mss 1460,sackOK,TS val 794864936 ecr 0,nop,wscale 7], length 0
12:20:31.366810 IP server2.csync2 > server1.49919: Flags [S.], seq 450593575, ack 445156160, win 14480, options [mss 1460,sackOK,TS val 794798911 ecr 794864936,nop,wscale 7], length 0
12:20:31.367101 IP server1.49919 > server2.csync2: Flags [.], ack 1, win 115, options [nop,nop,TS val 794864937 ecr 794798911], length 0
12:20:31.367138 IP server1.49919 > server2.csync2: Flags [P.], seq 1:9, ack 1, win 115, options [nop,nop,TS val 794864937 ecr 794798911], length 8
12:20:31.367147 IP server2.csync2 > server1.49919: Flags [.], ack 9, win 114, options [nop,nop,TS val 794798912 ecr 794864937], length 0
12:20:31.368625 IP server2.csync2 > server1.49919: Flags [R.], seq 1, ack 9, win 114, options [nop,nop,TS val 794798913 ecr 794864937], length 0
Run Code Online (Sandbox Code Playgroud)
我还有什么遗漏或应该做的吗?
小智 1
我必须删除我提供给 csync2 的 -N 主机的 127.0.0.1 条目。“app1”的 127.0.0.1 条目导致 csync2 客户端想要绑定到 127.0.0.1,而不是使用内部网络。
相反,对于守护程序,我使用包装器而不是直接调用 csync2 来强制执行我的 -N 主机名首选项。
#!/bin/sh
# cluster-csync2.sh
CSYNC2_SYSTEM_DIR=/etc /opt/cluster/bin/csync2 -i -D /var/lib/csync2 -N `hostname -s`
Run Code Online (Sandbox Code Playgroud)
我的 /etc/inetd.conf 条目(端口在 /etc/services 中定义):
csync2 stream tcp nowait root /opt/cluster/bin/cluster-csync2.sh cluster-csync2.sh
Run Code Online (Sandbox Code Playgroud)