关于Syncthing使用的技巧和误区

     0评论

Syncthing是一款常用的、优秀的资料同步软件,我通常将其用在站点程序的更新上。Syncthing上手很快,但因为设计理念和UI翻译等,用户可能对一些功能或者表述有误解,本文总结了使用Syncthing两年多以来总结的一些技巧,澄清一些可能的误解。

理解

同步方向

Syncthing支持仅发送仅接收发送和接收三种工作模式,其区分是比较明显的。需要注意的,AB两台同步的机器,如果A设为仅接收,B设为发送和接收,那么B是不会收到任何A的变动的;如果A设为仅发送,B设为发送和接收,B的发送A也不会接收。于是,合理的使用方法是,要么AB都设为发送和接收,要么一个设为仅发送,一个设为仅接收

如果将仅发送的理解为master仅接收理解为slave,其角色和权限就容易理解多了。

.stignore是很有用的忽略列表配置文件,语法类似.gitignore,需要注意的是.stignore在每台设备上都是分别配置的,其不会在各设备间同步,如果A的.stignore忽略了test这个模式,而B没有这样做,实际上会发生这样的事情:

  • A不会扫描和通知B(广播)关于test的变动;
  • B对关于test的变动持开放的姿态,但不会收到任何关于A上面test的变动信息(可能接收到其它同步设备的);
  • B会扫描test以及推送其关于test变动的信息,但会被A忽略,A也会忽略其它同步设备关于test的信息;
  • B会接收来自其它同步设备推送的关于test的信息;

更详细的解释可以参看:Q what “direction” (of sync) does .stignore filter?

状态描述

web页显示的最后更改或者Last Change是指根据【他方的变动】【对自己做修改】的情况和时间。

web页显示的最后扫描或者Last Scan是指对【己方的目录】最后扫描的时间。

web页显示的Out Of Sync或者未同步是指尚未接他方推送的变动,如果已收到对方关于变动的通知,但因为下载问题或者.stignore的设定而未能下载这些变动,就会出现这个情况。

Out of Sync

Override Changes

Override Changes或者撤销变动,中文译法有些不准确。出现这个提示的原因通常是设为仅发送的一方(A,master)认为自己的资料是最新的,认为对方(B)推送的变动是应该被撤销的,即使B关于特定资料的修订时间要晚于本地;点这个按钮会强迫B对方撤销自己的变动,以其收到的A的版本为准更改资料。

Override Changes

reddit上对此的解释:

The send only device is not telling the other devices that they shouldn’t accept any changes, so they will operate as normal and sync any changes. Only the send only folder will not accept the changes so it is considering the other nodes out of sync. Override changes forces the send only devices current state onto every other device in the network putting them back in sync.

Can syncthing do the override automatically? I always have to click override manually.
No. If the override button shows up, you have to find out what files were changed by what machine and why. Then after you fixed the issue that is causing files to change or ignored the changing files via .stignore it should be fine again.

Syncthing Forum上的解释:

Override changes tells the master to take the global version of all files, increment it by one, and advertise it to everyone, causing everyone in the cluster to download all the files the master has (as this is now the newest version).

其它

新建一个同步是需要填写的Folder Path,并不是要将内容远程的【文件夹】同步到这个文件夹下,而是将远程目录【下】的所有资料存放在这个目录中,所以不用担心选中了一个与远程目录同名的本地目录,而出现多出一层目录的情况了。

技巧

版本

对比较重要的同步资料,可以使用简单版本控制,以便在出现误删时,可以获取相应的备份。

忽略

在双方都是接收与发送的角色配置下,如果需要配置.stignore,为防止两方配置不同而出现Out of Sync的情况,可以使用一个默认被同步的文件存放忽略配置,然后在.stignore中引用这个配置。比如将忽略的配置写在stignore-included.conf文件中,然后在所有同步设备的.stignore中写入:

#include stignore-included.conf

-- EOF --

本文最后修改于5年前 (2019-04-27)

差评不太行一般挺好非常不错 (No Ratings Yet)
读取中...
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址