当前位置: 首页 > news >正文

通达oa 做网站深圳市大鹏建设局网站

通达oa 做网站,深圳市大鹏建设局网站,wordpress+更新+慢,做网站可以用什么数据库文章目录Linxu服务器文件双向同步 rsyncsersync基础信息安装rsync安装配置根据配置文件创建相应的目录、文件、防火墙规则创建需要同步的目录创建同步用户防火墙启动rsyncd服务测试异常处理sersync安装sersync配置test21配置test22配置sersync启动test21启动test22启动测试新增… 文章目录Linxu服务器文件双向同步 rsyncsersync基础信息安装rsync安装配置根据配置文件创建相应的目录、文件、防火墙规则创建需要同步的目录创建同步用户防火墙启动rsyncd服务测试异常处理sersync安装sersync配置test21配置test22配置sersync启动test21启动test22启动测试新增文件修改内容删除文件Linxu服务器文件双向同步 rsyncsersync 基础信息 系统Centos7.8 服务器信息 服务器IPtest2110.8.10.21test2210.8.10.22 软件版本信息 软件包版本rsyncsersync Rsync安装包下载地址https://github.com/WayneD/rsync/releases sersync下载地址https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz 安装 rsync 安装 查看是否已经安装 rpm -qa | grep rsync安装 yum -y install rsync配置 修改test21服务器文件/etc/rsyncd.conf # /etc/rsyncd: configuration file for rsync daemon mode# See rsyncd.conf man page for more options.# configuration example:uid root # 指定运行rsync daemon的用户 gid root # 指定运行rsync daemon的组 use chroot no address 10.8.10.21 # 指定监听地址 port 873 # 默认监听端口 max connections 0 #最大连接数0为无限制 pid file /var/run/rsyncd.pid # 指定pid文件 log file /var/log/rsyncd.log # 指定日志文件 exclude lostfound/ # 指定不同步的目录 ignore errors #transfer logging yes #timeout 900 #ignore nonreadable yes #dont compress *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2# [ftp] # path /home/ftp # comment ftp export area [update] # update模块 path /root/updatedir # update模块需要同步目录 comment test rsync sersync # update模块的简要说明 read only no # 是否只读 list no # 当用户查询该服务器上的可用模块时是否列出该模块 auth users rsync_daemon # 同步文件使用到的虚拟用户 secrets file /etc/rsync_update.passwd # 指定该虚拟用户对应的密码文件该文件权限为(400) hosts allow 10.8.10.22 # 指定可以连接该模块的主机x.x.x.x x.x.x.x/x修改test22服务器文件/etc/rsyncd.conf # /etc/rsyncd: configuration file for rsync daemon mode# See rsyncd.conf man page for more options.# configuration example:uid root # 指定运行rsync daemon的用户 gid root # 指定运行rsync daemon的组 use chroot no address 10.8.10.22 # 指定监听地址 port 873 # 默认监听端口 max connections 0 #最大连接数0为无限制 pid file /var/run/rsyncd.pid # 指定pid文件 log file /var/log/rsyncd.log # 指定日志文件 exclude lostfound/ # 指定不同步的目录 ignore errors #transfer logging yes #timeout 900 #ignore nonreadable yes #dont compress *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2# [ftp] # path /home/ftp # comment ftp export area [update] # update模块 path /root/updatedir # update模块需要同步目录 comment test rsync sersync # update模块的简要说明 read only no # 是否只读 list no # 当用户查询该服务器上的可用模块时是否列出该模块 auth users rsync_daemon # 同步文件使用到的虚拟用户 secrets file /etc/rsync_update.passwd # 指定该虚拟用户对应的密码文件该文件权限为(400) hosts allow 10.8.10.21 # 指定可以连接该模块的主机x.x.x.x x.x.x.x/x根据配置文件创建相应的目录、文件、防火墙规则 创建需要同步的目录 在两个服务器上分别创建需要同步的目录 [roottest21 ~]# mkdir /root/updatedir [roottest22 ~]# mkdir /root/updatedir创建同步用户 创建虚拟用户rsync_daemon使用的密码文件/etc/rsync_update.passwd 该文件的权限必须为400 [roottest21 ~]# echo rsync_daemon:123456789 /etc/rsync_update.passwd [roottest21 updatedir]# chmod 400 /etc/rsync_update.passwd [roottest22 ~]# echo rsync_daemon:123456789 /etc/rsync_update.passwd [roottest22 updatedir]# chmod 400 /etc/rsync_update.passwd防火墙 这里我是关闭了防火墙如果防火墙开启防火墙规则要将873端口加入 启动rsyncd服务 [roottest21 ~]# systemctl start rsyncd [roottest22 ~]# systemctl start rsyncd查看端口 [roottest21 /]# ss -antuple | grep 873 tcp LISTEN 0 5 10.8.10.21:873 *:* users:((rsync,pid14221,fd3)) ino:72483 sk:ffff8800b7d75d00 -[roottest22 ~]# ss -antuple | grep 873 tcp LISTEN 0 5 10.8.10.22:873 *:* users:((rsync,pid1735,fd3)) ino:29740 sk:ffff880226eb87c0 -测试 test21向test22同步 [roottest21 updatedir]# ls [roottest21 updatedir]# touch file{1..5} [roottest21 updatedir]# rsync -av /root/updatedir/ rsync_daemon10.8.10.22::update Password: sending incremental file list ./ file1 file2 file3 file4 file5sent 314 bytes received 114 bytes 171.20 bytes/sec total size is 0 speedup is 0.00test22服务器查看 [roottest22 updatedir]# ls file1 file2 file3 file4 file5test22向test21同步 # 创建file6 - file10 空文件 [roottest22 updatedir]# touch file{6..10} # 文件同步 [roottest22 updatedir]# rsync -av /root/updatedir/ rsync_daemon10.8.10.21::update Password: sending incremental file list ./ file10 file6 file7 file8 file9sent 388 bytes received 114 bytes 111.56 bytes/sec total size is 0 speedup is 0.00test21服务器查看 [roottest21 updatedir]# ls file1 file10 file2 file3 file4 file5 file6 file7 file8 file9rsync数据同步成功我们可以设置linxu定时任务crontab每隔一段时间自动双向同步文件。 异常处理 提示权限不足 test22发送到test21可以正常发送test21发送到test22无法发送 [roottest21 updatedir]# rsync -av /root/updatedir/ rsync_daemon10.8.10.22::update Password: sending incremental file list rsync: failed to set times on . (in update): Permission denied (13) ./ file1 file2 file3 file4 file5 rsync: mkstemp .file1.PRynLL (in update) failed: Permission denied (13) rsync: mkstemp .file2.L3Zgd2 (in update) failed: Permission denied (13) rsync: mkstemp .file3.t4KaFi (in update) failed: Permission denied (13) rsync: mkstemp .file4.PZF46y (in update) failed: Permission denied (13) rsync: mkstemp .file5.NOJYyP (in update) failed: Permission denied (13)报错后查看网上各种资料描述说是目录权限改为755等试了之后都不行 随后又增加了一台服务器做测试发现新增的也不行 [roottest22 etc]# rsync -av /root/updatedir/ root10.8.10.20::update Password: sending incremental file list rsync: failed to set times on . (in update): Permission denied (13) rsync: recv_generator: failed to stat 123 (in update): Permission denied (13) ./sent 59 bytes received 173 bytes 51.56 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2]后来在stackoverflow发现有大佬提示说selinux问题导致我们查看服务器配置 参考文献:https://stackoverflow.com/questions/11039559/rsync-mkstemp-failed-permission-denied-13 [roottest21 etc]# getenforce Permissive [roottest20 updatedir]# getenforce Enforcing [roottest22 etc]# getenforce Enforcing发现的确21和2220配置不同 修改2220配置 [roottest20 updatedir]# setenforce 0 [roottest20 updatedir]# getenforce Permissive[roottest22 etc]# setenforce 0 [roottest22 etc]# getenforce Permissivesetenforce 0为临时修改永久修改vim /etc/sysconfig/selinux SELINUXenforcing 修改为 SELINUXdisable 或者 SELINUXpermissive再次执行发现可以同步成功 [roottest22 etc]# rsync -av /root/updatedir/ root10.8.10.20::update Password: sending incremental file list ./ 123sent 102 bytes received 38 bytes 40.00 bytes/sec total size is 0 speedup is 0.00[roottest22 etc]# rsync -av /root/updatedir/ root10.8.10.20::update Password: sending incremental file list ./ 123sent 102 bytes received 38 bytes 40.00 bytes/sec total size is 0 speedup is 0.00sersync 上面安装完成rsync我们只能通过定时任务触发文件同步sersync可以对文件的变更进行实时监听并触发rsync对变更的文件进行实时同步。 安装 下载:[点击下载] 将文件放在两台服务器中,并解压 [roottest22 sersync]# ll 总用量 712 -rw-------. 1 root root 727290 11月 10 13:11 sersync2.5.4_64bit_binary_stable_final.tar.gz [roottest22 sersync]# pwd /opt/sersync [roottest22 sersync]# tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz GNU-Linux-x86/ GNU-Linux-x86/sersync2 GNU-Linux-x86/confxml.xml [roottest22 sersync]# ls GNU-Linux-x86/ confxml.xml sersync2[roottest21 sersync]# ll 总用量 712 -rw-------. 1 root root 727290 11月 10 13:11 sersync2.5.4_64bit_binary_stable_final.tar.gz [roottest21 sersync]# pwd /opt/sersync [roottest21 sersync]# tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz GNU-Linux-x86/ GNU-Linux-x86/sersync2 GNU-Linux-x86/confxml.xml [roottest21 sersync]# ls GNU-Linux-x86/ confxml.xml sersync2sersync配置 test21配置 内容过多只显示了修改的位置,其他都是默认的 remote ip10.8.10.22 nameupdate/ auth starttrue usersrsync_daemon passwordfile/etc/rsync.pas/ [roottest21 GNU-Linux-x86]# vim confxml.xml ... sersynclocalpath watch/opt/updatedirremote ip10.8.10.22 nameupdate/!--remote ip192.168.8.39 nametongbu/--!--remote ip192.168.8.40 nametongbu/--/localpathrsynccommonParams params-artuz/auth starttrue usersrsync_daemon passwordfile/etc/rsync.pas/userDefinedPort startfalse port874/!-- port874 --timeout startfalse time100/!-- timeout100 --ssh startfalse//rsyncfailLog path/tmp/rsync_fail_log.sh timeToExecute60/!--default every 60mins execute once--crontab startfalse schedule600!--600mins--crontabfilter startfalseexclude expression*.php/excludeexclude expressioninfo/*/exclude/crontabfilter/crontabplugin startfalse namecommand//sersync ...watch 指定了监控的文件目录remote ip 指定远程rsync服务监听的ipname 指定了远程rsync服务开启的模块start“true” 说明远程rsync服务开启了用户密码验证users 指定了远程rsync服务用户密码验证指定的虚拟用户passwordfile 指定了连接远程rsync服务虚拟用户的密码文件权限需为400用户自己手动创建 创建密码文件 [roottest21 GNU-Linux-x86]# echo 123456789 /etc/rsync.pas [roottest21 GNU-Linux-x86]# chmod 400 /etc/rsync.pastest22配置 [roottest22 GNU-Linux-x86]# vim confxml.xml ... sersynclocalpath watch/opt/updatedirremote ip10.8.10.21 nameupdate/!--remote ip192.168.8.39 nametongbu/--!--remote ip192.168.8.40 nametongbu/--/localpathrsynccommonParams params-artuz/auth starttrue usersrsync_daemon passwordfile/etc/rsync.pas/userDefinedPort startfalse port874/!-- port874 --timeout startfalse time100/!-- timeout100 --ssh startfalse//rsyncfailLog path/tmp/rsync_fail_log.sh timeToExecute60/!--default every 60mins execute once--crontab startfalse schedule600!--600mins--crontabfilter startfalseexclude expression*.php/excludeexclude expressioninfo/*/exclude/crontabfilter/crontabplugin startfalse namecommand//sersync ...创建密码文件 [roottest22 GNU-Linux-x86]# echo 123456789 /etc/rsync.pas [roottest22 GNU-Linux-x86]# chmod 400 /etc/rsync.passersync启动 test21启动 [roottest21 updatedir]# /opt/sersync/GNU-Linux-x86/sersync2 -d -r -o /opt/sersync/GNU-Linux-x86/confxml.xml set the system param executeecho 50000000 /proc/sys/fs/inotify/max_user_watches executeecho 327679 /proc/sys/fs/inotify/max_queued_events parse the command param option: -d run as a daemon option: -r rsync all the local files to the remote servers before the sersync work option: -o config xml name /opt/sersync/GNU-Linux-x86/confxml.xml daemon thread num: 10 parse xml config file host ip : localhost host port: 8008 daemon startsersync run behind the console use rsync password-file : user is rsync_daemon passwordfile is /etc/rsync.pas config xml parse success please set /etc/rsyncd.conf max connections0 Manually sersync working thread 12 1(primary thread) 1(fail retry thread) 10(daemon sub threads) Max threads numbers is: 22 12(Thread pool nums) 10(Sub threads) please according your cpu use -n param to adjust the cpu rate ------------------------------------------ rsync the directory recursivly to the remote servers once working please wait... execute command: cd /root/updatedir rsync -artuz -R --delete ./ rsync_daemon10.8.10.22::update --password-file/etc/rsync.pas /dev/null 21 run the sersync: watch path is: /root/updatedir-d 以后台daemon的方式运行-r 第一次启动时使用rsync将本地文件全部同步至远程服务器。-o 加载配置文件 test22启动 [roottest22 updatedir]# /opt/sersync/GNU-Linux-x86/sersync2 -d -r -o /opt/sersync/GNU-Linux-x86/confxml.xml set the system param executeecho 50000000 /proc/sys/fs/inotify/max_user_watches executeecho 327679 /proc/sys/fs/inotify/max_queued_events parse the command param option: -d run as a daemon option: -r rsync all the local files to the remote servers before the sersync work option: -o config xml name /opt/sersync/GNU-Linux-x86/confxml.xml daemon thread num: 10 parse xml config file host ip : localhost host port: 8008 daemon startsersync run behind the console use rsync password-file : user is rsync_daemon passwordfile is /etc/rsync.pas config xml parse success please set /etc/rsyncd.conf max connections0 Manually sersync working thread 12 1(primary thread) 1(fail retry thread) 10(daemon sub threads) Max threads numbers is: 22 12(Thread pool nums) 10(Sub threads) please according your cpu use -n param to adjust the cpu rate ------------------------------------------ rsync the directory recursivly to the remote servers once working please wait... execute command: cd /root/updatedir rsync -artuz -R --delete ./ rsync_daemon10.8.10.21::tongbu1 --password-file/etc/rsync.pas /dev/null 21 run the sersync: watch path is: /root/updatedir测试 新增文件 在test21上传一个文件,在test22查看也同时存在 [roottest21 updatedir]# ll 总用量 4 -rw-------. 1 root root 253 11月 10 11:12 1.sh[roottest22 updatedir]# ll 总用量 4 -rw-------. 1 root root 253 11月 10 11:12 1.sh修改内容 修改test22 [roottest22 updatedir]# ll 总用量 4 -rw-------. 1 root root 253 11月 10 11:12 1.sh [roottest22 updatedir]# echo 1 1.sh [roottest22 updatedir]# ll 总用量 4 -rw-------. 1 root root 2 11月 10 13:59 1.sh [roottest22 updatedir]# cat 1.sh 1查看test21发现修改的内容同步成功 [roottest21 updatedir]# cat 1.sh 1删除文件 删除test21文件 [roottest21 updatedir]# rm 1.sh rm是否删除普通文件 1.shy [roottest21 updatedir]# ll 总用量 0在test22 查看发现文件也同步删除 [roottest22 updatedir]# ll 总用量 0
http://wiki.neutronadmin.com/news/277008/

相关文章:

  • 当阳市住房和城乡建设局网站空间如何安装wordpress
  • 网站开发主要技术海南手机网站建设公司哪家好
  • 同字形结构布局网站单仁咨询建设网站
  • 温岭市住房和城乡建设规划局网站优化大师破解版app
  • 建设网站的预期收益cms网站内容管理系统
  • 专业商城网站建设价格中山大良网站建设
  • 建设企业网站平台主要的目的是wordpress 二次元交互
  • 重庆九龙坡营销型网站建设公司哪家专业wordpress模板 极简
  • 网站对接qq群 虚拟主机wordpress漂亮手机网站模板下载
  • 地方旅游网站建设方案外贸推广服务公司
  • 重庆网站维护视频网站 建设
  • 郑州市建设厅网站成都企业网站建设介绍
  • 大悟网站制作为什么要建设营销型网站
  • 沈阳建网站网站 板块 模块
  • 做网站站长交加盟费网站建设中应注意的问题
  • 在线视频网站a做免费下载搜狗 优化网站
  • 太原做学校网站的公司网站需要流量
  • 做网站卖别人的软件可以吗百度关键词热度
  • 什么网站可以在线做考教师岗位的题管理咨询公司属于什么行业
  • 怎么做有图有声的网站网站营销网站营销推广
  • 院校建设网站群的原因企业网站开发职责
  • 按揭车在哪个网站可以做贷款有交做拼多多网站的吗
  • 各地残疾人联合会网站建设手机网站开发企业
  • 监控网站模版驻马店住房和城乡建设厅网站
  • wordpress 3d标签插件搜索引擎优化seo专员招聘
  • 博客网站的建设流程wordpress 手机模版
  • 网站排名怎么上去wordpress自动保存远程图片
  • 杭州的设计网站建设icp备案网站更名
  • 网站换空间会影响排名吗制作相册影集app
  • 集团网站建设定制网站建设高端制造股十大龙头