php中使用什么接口访问mysql
700
2022-11-01
Bidirectional file sync in RHEL 8 (csync2 + lsyncd)
Csync2 installation and setup
Add below to /etc/hosts
10.30.11.11 app110.30.11.12 app210.30.11.13 app3
Install Csync2 Repository
rpm -ivh required packages
yum install xinetd sqlite-devel csync2
create backup directory
mkdir -p /var/csync2/backup
create the authentication key on app1
csync2 -k /etc/csync2.key
add below content to the configuration file /etc/csync2_ebanking.cfg
nossl * *;group ebanking_media{ host app1 app2 pp3; key /etc/csync2.key; include /mnt/ebanking_media; auto younger; backup-directory /var/csync2/backup; backup-generations 3;}
Copy authentication key and configuration files to all servers
scp /etc/{sync2.key,csync2_ebanking.cfg} bda-cbs-ebprdapp2:/etc/scp /etc/{sync2.key,csync2_ebanking.cfg} bda-cbs-ebprdapp3:/etc/
Lsyncd installation and setup
Install EPEL Repository
dnf install -y the system
dnf update -y
Search for the lsyncd package
dnf --disablerepo="*" --enablerepo="epel" list available | grep lsyncd
Install lsyncd package
dnf install lsyncd
add below to /etc/lsyncd.conf with each servers
------ User configuration file for lsyncd.---- Simple example for default rsync, but executing moves through on the target.---- For more examples, see /usr/share/doc/lsyncd*/examples/---- sync{default.rsyncssh, source="/var/host="localhost", targetdir="/tmp/htmlcopy/"}settings { logident = "lsyncd", logfacility = "user", logfile = "/var/log/lsyncd/lsyncd.log", statusFile = "/var/log/lsyncd/status.log", statusInterval = 1}initSync = { delay = 1, maxProcesses = 1, action = function(inlet) local config = inlet.getConfig() local elist = inlet.getEvents(function(event) return event.etype ~= "Init" end) local directory = string.sub(config.source, 1, -2) local paths = elist.getPaths(function(etype, path) return "\t" .. config.syncid .. ":" .. directory .. path end) log("Normal", "Processing syncing list:\n", table.concat(paths, "\n")) spawn(elist, "/usr/sbin/csync2", "-C", config.syncid, "-x") end, collect = function(agent, exitcode) local config = agent.config if not agent.isList and agent.etype == "Init" then if exitcode == 0 then log("Normal", "Startup of '", config.syncid, "' instance finished.") elseif config.exitcodes and config.exitcodes[exitcode] == "again" then log("Normal", "Retrying startup of '", config.syncid, "' instance.") return "again" else log("Error", "Failure on startup of '", config.syncid, "' instance.") terminate(-1) end return end local rc = config.exitcodes and config.exitcodes[exitcode] if rc == "die" then return rc end if agent.isList then if rc == "again" then log("Normal", "Retrying events list on exitcode = ", exitcode) else log("Normal", "Finished events list = ", exitcode) end else if rc == "again" then log("Normal", "Retrying ", agent.etype, " on ", agent.sourcePath, " = ", exitcode) else log("Normal", "Finished ", agent.etype, " on ", agent.sourcePath, " = ", exitcode) end end return rc end, init = function(event) local inlet = event.inlet; local config = inlet.getConfig(); log("Normal", "Recursive startup sync: ", config.syncid, ":", config.source) spawn(event, "/usr/sbin/csync2", "-C", config.syncid, "-x") end, prepare = function(config) if not config.syncid then error("Missing 'syncid' parameter.", 4) end local c = "csync2_" .. config.syncid .. ".cfg" local f, err = io.open("/etc/" .. c, "r") if not f then error("Invalid 'syncid' parameter: " .. err, 4) end f:close() end}local sources = { ["/mnt/ebanking_media"] = "ebanking"}for key, value in pairs(sources) do sync {initSync, source=key, syncid=value}end
Start and enable xinetd and lsyncd services
systemctl enable -- now xinetdsystemctl enable -- now lsyncd
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~