cdc-file-transfer 使用说明

cdc-file-transfer 主要是场景是windows 到linux 主机的数据同步,包含了stream 以及rsync 两大工具

使用注意事项

  • 首次执行会进行server copy,但是目前有点问题,如下,通过测试似乎和openssh 版本有关系,使用最新的没发现问题

 

 

  • linux server 支持问题

默认官方提供的软件包使用的glibc 那本有点高,所以低版本系统会有问题,解决方法是可以自己构建一个低版本的
信息如下:

 

 

  • vcruntime140_1.dll 问题
    可以下载相关的vcruntime140_1.dll 拷贝到windows/system32 目录下,我提供了一个在下边的链接中
  • windows 机器需要ssh 以及scp 工具,windows 的可以通过安装微软开源的(参考以下链接),但是注意测试(以前有碰到过类似的问题)
  • windows 主机到linux 机器需要免密登录,windows openssh 可能木有ssh-copy-id 可以通过拷贝公钥到linux 主机的~/.ssh/authorized_keys 文件中
  • 其他配置参数推荐通过%USERPROFILE%\.ssh\config 修改
    参考
 
Host linux_device
  HostName linux.device.com
  User user
  Port 12345
  IdentityFile C:\path\to\id_rsa
  UserKnownHostsFile C:\path\to\known_hosts
  • 基于环境变量的scp ssh 配置
set CDC_SSH_COMMAND="C:\path with space\to\ssh.exe"
set CDC_SCP_COMMAND="C:\path with space\to\scp.exe"
  • 同步模式,rsync 模式参考
cdc_rsync C:\path\to\assets\* user@linux.device.com:~/assets -vr
  • stream 模式
    实际上是一个windows 服务,后台任务
 
启动
cdc_stream start C:\path\to\assets user@linux.device.com:~/assets
停止
cdc_stream stop user@linux.device.com:~/assets

自己源码编译的问题

  • ccache: error: Failed to create temporary file for /root/.ccache/tmp/main.stdout: Read-only file system
    添加--sandbox_writable_path=$HOME/.ccache 配置
 
bazel build --config linux --compilation_mode=opt --linkopt=-Wl,--strip-all --copt=-fdata-sections --copt=-ffunction-sections --linkopt=-Wl,--gc-sections --sandbox_debug --sandbox_writable_path=$HOME/.ccache  //cdc_rsync_server
  • gcc: error: unrecognized command line option '-std=c++17'
    可以基于centos 的devtoolset
 
yum install devtoolset-9-gcc-c++
scl enable devtoolset-9 bash

注意对于以前执行的可以通过bazel clean 以及bazel sync 处理下,不然可能会有错误

  • --gc-section: unknown option
    如果碰到可以删除-linkopt=-Wl,--gc-sections 试试
 
bazel build --config linux --compilation_mode=opt --linkopt=-Wl,--strip-all --copt=-fdata-sections --copt=-ffunction-sections --sandbox_debug --sandbox_writable_path=$HOME/.ccache  //cdc_rsync_server

说明

以上是一个初步的整理,直接使用官方的因为centos 7 glibc 版本问题,通过自己构建的,对于cdc_rsync 测试是通过的,cdc_stream 暂时还没测试
构建支持centos 7 的版本已经发布到github 中了,大家可以使用

参考资料

https://github.com/google/cdc-file-transfer
https://github.com/rongfengliang/windows_dlls
https://github.com/PowerShell/Win32-OpenSSH
https://github.com/PowerShell/openssh-portable
https://www.cnblogs.com/rongfengliang/p/16644473.html
https://stackoverflow.com/questions/60336940/g-error-unrecognized-std-c17-what-is-g-version-and-how-to-install
https://github.com/bazelbuild/bazel/issues/12124
https://github.com/google/j2cl/issues/21
https://github.com/rongfengliang/cdc-file-transfer-centos7

posted on 2023-01-10 17:10  荣锋亮  阅读(221)  评论(1编辑  收藏  举报

导航