lsyncd / lsyncd

Lsyncd (Live Syncing Daemon) synchronizes local directories with remote targets
GNU General Public License v2.0
5.74k stars 476 forks source link

A directory is deleted, the deletion is omitted. #660

Open A-Wat opened 2 years ago

A-Wat commented 2 years ago

Hello,

Currently running two servers and using lsyncd to synchronize files. Provisionally, the source server is Server A and the destination server is Server B.

The OS of the two servers are MiracleLinux8.

When delete a directory on Server A, some directories in the target directory on Server B may remain. This is not always the case, but the more complex the contents of the directory, the more likely it is to occur.

If that event occurs, we have confirmed that the files in the target directory will be deleted on server B, but the directory itself and the internal directories will remain.

If you have the same experience or any good ideas, please let me know.

# lsyncd.conf settings
settings {
    logfile = "/var/log/lsyncd/lsyncd.log",
    statsuFile = "/var/log/lsyncd/lsyncd.status",
    statusInterval = 1,
}

sync {
    default.rsync,
    source = "/usr/share/nginx/html",
    target = "ServerB:/usr/share/nginx/html",
    delay = 1,
    delete = "running",
    init = false,
    rsync = {
        archive  = true,
        links      = true,
        update  = true,
        verbose = false,
        owner    = true,
        group    = true,
    }
}
# lsyncd.service settings
[Unit]
Description=
After=network.target

[Service]
User=root
Group=root
EnvironmentFile=/etc/lsyncd/lsyncd.conf
ExecStart=/usr/bin/lsyncd -pidfile /tmp/lsyncd.pid /etc/lsyncd/lsyncd.conf
PIDFile=/tmp/lsyncd.pid

[Install]
WantedBy=multi-user.target
A-Wat commented 2 years ago

As a supplement, Server A and Server B are synchronized in both directions.

After trial and error and checking the operation of the system, we have found out some things. When a directory is not deleted, or more precisely, when a directory is momentarily deleted, it seems to be reconstituted as a new directory.

This makes me think that the synchronization that deleted the directory on server A is reflected on server B, and that the deleted directory on server A is reconstituted by the synchronization settings from server B to server A.