# 分布式文件资源同步器 **Repository Path**: xiaotao233/file-resource-synchronizer ## Basic Information - **Project Name**: 分布式文件资源同步器 - **Description**: 一个采用C++编写的分布式的文件资源同步管理系统(不再维护),计划支持子从节点双向同步数据和从分布式集群中拉取文件,计划支持P2P协议磁力链下载 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 6 - **Created**: 2020-10-05 - **Last Updated**: 2024-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 分布式文件同步器(不再开发维护) 因为设计太垃,bug太多,不再继续维护,有缘再重写 ## 目录 1. 编译 2. 配置文件 3. 运行与基本操作 ### 环境要求 - Linux - g++ - pthread ### 编译 #### 编译release版本 ```shell make clean default ``` #### 编译debug版本 ```shell make debug ``` #### 直接编译调试运行 ```shell make run ``` ### 配置文件 默认位置:`bin/config.conf` 文件内容示例 ```conf # 控制端口,默认7750 # port=7750 # 监听地址,默认0.0.0.0 # listen=0.0.0.0 # Web管理面板端口号 默认7749 # dashboard_port=7749 # Web管理面板监听地址,默认127.0.0.1 dashboard_listen=0.0.0.0 # 上游节点地址(可以是域名) master_addr=127.0.0.1 # 上游节点端口 master_port=7750 # 资源目录 默认是程序运行目录 resource_dir=/data/res ``` ### 运行 ```shell ./bin/main ``` 若在运行时指定配置文件位置,启动参数中使用-c选项即可,如 ```shell ./bin/main -c main/config.conf ``` #### 基本命令 - ls - 列出远程目录 - cd - 切换目录 - get - 拉取文件 - pull - 文件全同步 - ping - 测试连接 - connect - 与master建立被动控制长连接(暂时无用) - help - 查看命令帮助 ## 自动构建任务模块 你可以使用construct脚本自动完成任务模块的移除,声明,定义与注册操作,从而方便直接编写任务模块核心代码 ### 构建客户端任务(自定义任务名为pull) ```shell ./construct make clientTask pull ``` 构建后在文件`src/task/Pull/Pull.cpp`中编写代码即可 ### 移除客户端任务 ```shell ./construct rm clientTask pull ``` ### 构建命令行任务(命令为hello) ```shell ./construct make command hello ``` 构建后在文件`src/cli/hello/Hello.cpp`中编写代码即可 ### 移除命令行任务 ```shell ./construct rm command hello ```