Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新客户端或者隧道信息时,突然中断服务会导致数据丢失 #412

Closed
yisier opened this issue Feb 17, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@yisier
Copy link

yisier commented Feb 17, 2020

版本0.23.2和0.26.2均复现了
这个过程没办法截图,只说下我的情况以及操作过程和最终结果

我的服务器(centos 7,nps 0.23.2)上有几十个客户端,当我重启服务器后发现只有几个了,重启过程中有人在修改或者删除客户端(隧道)信息

经过反复测试,发现在删除隧道时clients.json 和tasks.json 会突然变成0kb,然后又变回原大小,不知道是不是我的设备问题,还说是nps在更新数据文件时会将所有数据放在内存中操作后再实例化到文件中,如果是这样的话,很有可能在操作数据时服务器突然宕机或者网络中断而导致数据丢失,并且基本上不可能恢复,就像我这种情况。

建议,在不更改存储方式的情况下,能否加个定时备份conf文件夹下数据的功能(在配置文件中设置备份时间以及频率)

@yisier yisier added the bug Something isn't working label Feb 17, 2020
@ffdfgdfg
Copy link
Collaborator

file, err := os.Create(filePath)

应该由于这个函数直接将文件截断导致的,有什么好办法吗

kiririx pushed a commit to kiririx/nps that referenced this issue Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants