备份
其实备份之前章节提过一次,就是备份 .node-red目录里面文件, 如何找到这个文件参考上一章节.
node_modules 这个目录是不需要备份的,它是节点依赖的第三方模块,可以通过到新的机器上执行下面命令进行安装:
npm install
群晖配置文件夹查找
这里主要说明一下没有手动添加映射的情况,需要使用 ssh
登录群晖控制台 然后 sudo -i
进入root用户,进入Docker
安装的数据卷中,如下图:
cd /volume1/@docker/btrfs/subvolumes/
# 查看所有文件
ls -all
#
total 0
drwx------ 1 root root 4244 Nov 30 10:15 .
drwx------ 1 root root 20 Oct 8 09:21 ..
drwxr-xr-x 1 root root 132 Nov 28 16:21 0495e2bc7a4d5e9cee898d8c77eefcb9524da485b52ef2233822e992fff5a597
drwxr-xr-x 1 root root 160 Nov 28 16:30 b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a
drwxr-xr-x 1 root root 160 Nov 28 16:30 b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a-init
drwxr-xr-x 1 root root 144 Nov 28 17:03 c5e5c2198e5e3ce07b10d4148103999a8ed16f305994eab88e7da7fcae07fdd3
drwxr-xr-x 1 root root 132 Nov 28 16:21 c7f40359388cc8048be15b6e9f5cb4f3a6d3a148805d4d22b5b7a09f131eef69
drwxr-xr-x 1 root root 140 Nov 28 16:21 d358ce23ec40676e1a40f672738a2f546c5322f77e05103b7ccec99818cc03cb
drwxr-xr-x 1 root root 132 Nov 28 17:02 dd7c6b14bfa9c8af0feee64fab215a22cb72d0f6257e82e278a12046b933c11b
drwxr-xr-x 1 root root 132 Nov 28 17:03 df7f3219cc17f294c0971302f67ea463b41e3043739bf93da4f29204306982b3
drwxr-xr-x 1 root root 140 Nov 28 16:21 e339f6988ffb8b6ca8d409f0013bf13d9a179c6e14f20c3ecf66440a3194f139
drwxr-xr-x 1 root root 160 Nov 30 10:15 f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af
drwxr-xr-x 1 root root 160 Nov 30 10:15 f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af-init
drwxr-xr-x 1 root root 132 Nov 28 17:03 f219262a27d3556f7ac42777e0893dc9099dcde1764b8c63ab5ee118dc8b7159
带有xxx-init这样标识的就是Docker的数据卷
, 暂时没有方法直接知晓容器对应的,用以下命令查找:
find ./ -name settings.js
#输出信息如下:我这里启动了两个Node Red
./6206e8cd8e80241f7df2871b454376b5ccbef98fd6751504dfcf18bc53bd8efd/usr/src/node-red/node_modules/node-red/red/api/editor/settings.js
./6206e8cd8e80241f7df2871b454376b5ccbef98fd6751504dfcf18bc53bd8efd/usr/src/node-red/node_modules/node-red/red/runtime/settings.js
./6206e8cd8e80241f7df2871b454376b5ccbef98fd6751504dfcf18bc53bd8efd/usr/src/node-red/node_modules/node-red/red/runtime/storage/localfilesystem/settings.js
./6206e8cd8e80241f7df2871b454376b5ccbef98fd6751504dfcf18bc53bd8efd/usr/src/node-red/node_modules/node-red/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a-init/usr/src/node-red/node_modules/node-red/red/api/editor/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a-init/usr/src/node-red/node_modules/node-red/red/runtime/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a-init/usr/src/node-red/node_modules/node-red/red/runtime/storage/localfilesystem/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a-init/usr/src/node-red/node_modules/node-red/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a/usr/src/node-red/node_modules/node-red/red/api/editor/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a/usr/src/node-red/node_modules/node-red/red/runtime/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a/usr/src/node-red/node_modules/node-red/red/runtime/storage/localfilesystem/settings.js
./b9d9696ccb74eed20bf99cbfeb9dd11ded4bb6119b9b0209676f7b9909b0f57a/usr/src/node-red/node_modules/node-red/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af-init/usr/src/node-red/node_modules/node-red/red/api/editor/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af-init/usr/src/node-red/node_modules/node-red/red/runtime/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af-init/usr/src/node-red/node_modules/node-red/red/runtime/storage/localfilesystem/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af-init/usr/src/node-red/node_modules/node-red/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af/usr/src/node-red/node_modules/node-red/red/api/editor/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af/usr/src/node-red/node_modules/node-red/red/runtime/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af/usr/src/node-red/node_modules/node-red/red/runtime/storage/localfilesystem/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af/usr/src/node-red/node_modules/node-red/settings.js
./f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af/data/settings.js
然后 cd f06a95eccfbcf414e5640008fe2d3cb0bf6fed88b421b44d0fa0e7bfbd00c6af/data
就是Node Red 相关文件了
卸载节点
多数情况下直接在界面上操作即可,但是有时候会有点不灵光,这时候就需要手动进行操作了,运行下面命令:
- 第一步
删除所有依赖模块rm -rf node_modules
- 第二步
打开package.json
删除对应节点信息 - 第三步
执行npm install
安装依赖 - 第四步
重启Node Red
vi package.json
#会看到下面类似信息
{
"name": "node-red-project",
"description": "A Node-RED Project",
"version": "0.0.1",
"private": true,
"dependencies": {
"@inmation/node-red-contrib-inmation": "^1.2.0",
"node-red-contrib-bigtimer": "^2.0.3",
"node-red-contrib-cheerio-function": "^1.0.0",
"node-red-contrib-gaode": "^1.0.0",
"node-red-contrib-home-assistant-websocket": "~0.1.3",
"node-red-contrib-iconv": "^0.0.2",
"node-red-contrib-key-value-store": "^0.1.8",
"node-red-contrib-pushbear": "^1.0.0",
"node-red-contrib-startup-trigger": "^0.1.0",
"node-red-contrib-time-range-switch": "^0.6.1",
"node-red-dashboard": "^2.10.1"
}
}