OSS数据迁移命令行工具oss-import-cli使用文档
Last updated
2023-07-25 10:28:27
{"value":"## OSS\u6570\u636e\u8fc1\u79fb\u547d\u4ee4\u884c\u5de5\u5177oss-import-cli\u4f7f\u7528\u6587\u6863\n\n### \u4e00\u3001\u7b80\u4ecb\n\noss-import-cli\u662f\u7528\u4e8e\u5c06\u6570\u636e\u8fc1\u79fb\u5bfc\u5165\u5230cdncloud OSS\u7684\u5de5\u5177\uff0c\u652f\u6301\u4ece\u4ee5\u4e0b\u6570\u636e\u6e90\u5bfc\u5165\uff1a\n\n- \u672c\u5730\u6587\u4ef6\u5939\n- \u963f\u91cc\u4e91OSS\n- \u4e03\u725b\u4e91Kodo\n- \u817e\u8baf\u4e91Cos\n- \u767e\u5ea6\u4e91Bos\n- \u534e\u4e3a\u4e91Obs\n- Amazon s3\u53ca\u517c\u5bb9\n- \u91d1\u5c71\u4e91Ks3\n\n### \u4e8c\u3001\u652f\u6301\u64cd\u4f5c\uff1a\n\n- \u542f\u52a8\u5bfc\u5165\u4efb\u52a1\n- \u505c\u6b62\u5bfc\u5165\u4efb\u52a1\n- \u67e5\u770b\u5bfc\u5165\u4efb\u52a1\u8fdb\u5ea6\n- \u67e5\u770b\u5bfc\u5165\u4efb\u52a1\u4fe1\u606f\n- \u4e0a\u4f20\u672c\u5730\u6587\u4ef6\u5939\n\n### \u4e09\u3001\u4e0b\u8f7d\u5730\u5740\n\n| \u652f\u6301\u5e73\u53f0 | \u4e0b\u8f7d\u94fe\u63a5 |\n| ------------ | ------------------------------------------------------------ |\n| Windows | https:\/\/fo4qr5aa.hk03.1112oss.com\/oss-import-cli-win.zip |\n| Linux | https:\/\/fo4qr5aa.hk03.1112oss.com\/oss-import-cli-linux.zip |\n| MacOS(arm) | https:\/\/fo4qr5aa.hk03.1112oss.com\/oss-import-cli-macos-arm.zip |\n| MacOS(Intel) | https:\/\/fo4qr5aa.hk03.1112oss.com\/oss-import-cli-macos-intel.zip |\n\n### \u56db\u3001\u914d\u7f6e\u6587\u4ef6\u683c\u5f0f\n\n#### 1. \u963f\u91cc\u4e91OSS\n\n```yaml\nfrom: aliyun\nsync: false #(hk-02\u533a\u4e0d\u652f\u6301)\nthird:\n accessKey: *************************\n secretKey: *************************\n bucket: flametest\n subdir: nginx_cache_config_hk-master\/\n domain:\n endpoint: https:\/\/oss-cn-guangzhou.aliyuncs.com\ncdncloud:\n zone: hk-02 #\u76ee\u6807\u53ef\u7528\u533a,\u5982hk-02\/hk-03\/us-02\n ossid: #\u65b0\u533a\u4e0d\u9700\u8981\u586b\u5199\u7a7a\u95f4id\n bucket: ag1q4l4p #\u65b0\u533a\u7a7a\u95f4\u7f16\u53f7\n subdir: \/test\/nginx\/\n```\n\n#### 2. \u817e\u8baf\u4e91COS\n\n```yaml\nfrom: tencent\nsync: true #(hk-02\u533a\u4e0d\u652f\u6301)\nthird:\n accessKey: *************************\n secretKey: *************************\n bucket: test-1313771787\n subdir: test\/\n domain:\n endpoint: https:\/\/test-1313771787.cos.ap-guangzhou.myqcloud.com\ncdncloud:\n zone: hk-02 #\u76ee\u6807\u53ef\u7528\u533a,\u5982hk-02\/hk-03\/us-02\n ossid: #\u65b0\u533a\u4e0d\u9700\u8981\u586b\u5199\u7a7a\u95f4id\n bucket: ag1q4l4p\n subdir: \/test\/cos\/\n```\n\n#### 3. \u91d1\u5c71\u4e91\n\n```yaml\nfrom: ksyun\nsync: false #(hk-02\u533a\u4e0d\u652f\u6301)\nthird:\n accessKey: *************************\n secretKey: *************************\n bucket: ix9omi2z\n subdir: \/test\n domain:\n region: GUANGZHOU\n endpoint: ks3-cn-guangzhou.ksyuncs.com\ncdncloud:\n zone: hk-02 #\u76ee\u6807\u53ef\u7528\u533a,\u5982hk-02\/hk-03\/us-02\n ossid: #\u65b0\u533a\u4e0d\u9700\u8981\u586b\u5199\u7a7a\u95f4id\n bucket: ag1q4l4p\n subdir: \/img\/ksyun\/\n```\n\n#### 4. \u767e\u5ea6\u4e91\n\n```yaml\nfrom: baidu\nsync: true #(hk-02\u533a\u4e0d\u652f\u6301)\nthird:\n accessKey: *************************\n secretKey: *************************\n bucket: flame\n subdir: test\/\n domain:\n endpoint: https:\/\/gz.bcebos.com\ncdncloud:\n zone: hk-02 #\u76ee\u6807\u53ef\u7528\u533a,\u5982hk-02\/hk-03\/us-02\n ossid: #\u65b0\u533a\u4e0d\u9700\u8981\u586b\u5199\u7a7a\u95f4id\n bucket: ag1q4l4p\n subdir: \/test\/bos\/\n```\n\n### 5. CDNCloud\u8001\u533a\n\n```yaml\nfrom: cdncloud\nsync: false #(hk-02\u533a\u4e0d\u652f\u6301)\nthird:\n accessKey: *************************\n secretKey: *************************\n bucket: lricuq2b\n subdir:\n domain:\n region: default\n endpoint: https:\/\/hk03.1112oss.com\ncdncloud:\n zone: hk-02 #\u76ee\u6807\u53ef\u7528\u533a,\u5982hk-02\/hk-03\/us-02\n ossid: #\u65b0\u533a\u4e0d\u9700\u8981\u586b\u5199\u7a7a\u95f4id\n bucket: 42sa1v9a #\u8001\u533a\u7684\u6876id\u6216\u65b0\u533a\u7684\u7a7a\u95f4id\n subdir: \/img\/whitelist\/\n\n```\n\n### \u4e94\u3001\u547d\u4ee4\u884c\u53c2\u6570\u683c\u5f0f\n\n```bash\noss-import-cli <command> [options]\n```\n\n#### 1. command\u547d\u4ee4\n\n| \u547d\u4ee4 | \u529f\u80fd\u63cf\u8ff0 |\n| ------ | ---------------------------------------- |\n| start | \u542f\u52a8\u4e00\u4e2a\u5bfc\u5165\u4efb\u52a1 |\n| stop | \u505c\u6b62\u5f53\u524d\u5bfc\u5165\u4efb\u52a1 |\n| info | \u67e5\u770b\u5f53\u524d\u5bfc\u5165\u4efb\u52a1\u7684\u8be6\u7ec6\u53c2\u6570\u914d\u7f6e\u4e0e\u6267\u884c\u72b6\u6001 |\n| view | \u67e5\u770b\u5f53\u524d\u5bfc\u5165\u4efb\u52a1\u7684\u6267\u884c\u8fdb\u5ea6 |\n| upload | \u4ece\u672c\u5730\u6587\u4ef6\u5939\u4e0a\u4f20\u5bfc\u5165 |\n\n#### 2. options\u53ef\u9009\u53c2\u6570\n\n| \u53c2\u6570 | \u542b\u4e49 | \u7c7b\u578b | \u8bf4\u660e\/\u8303\u4f8b |\n| --------------------- | ------------------------------------------- | ------ | ------------------------------------------------------------ |\n| -c <\u914d\u7f6e\u6587\u4ef6\u540d.yml> | \u4f7f\u7528\u6307\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6\u5bfc\u5165 | string | start\u547d\u4ee4\u53c2\u6570 |\n| -j <jobId> | \u6307\u5b9a\u4efb\u52a1id\uff0c\u4e0d\u6307\u5b9a\u5219\u968f\u673a\u751f\u6210 | string | start\/stop\/info\/view\u547d\u4ee4 |\n| -f <\u6e90\u5bf9\u8c61\u5b58\u50a8\u5382\u5546\u540d> | \u6307\u5b9a\u4ece\u54ea\u4e2a\u5382\u5546\u7684\u5bf9\u8c61\u5b58\u50a8\u5bfc\u5165 | string | start\u547d\u4ee4\u53c2\u6570\uff0cqiniu-\u4e03\u725b <br \/>aliyun-\u963f\u91cc\u4e91 tencent-\u817e\u8baf\u4e91 baidu-\u767e\u5ea6\u4e91<br \/>ksyun-\u91d1\u5c71\u4e91 huawei-\u534e\u4e3a\u4e91 aws-Amazon S3<br \/>cdncloud-1112oss\u5176\u4ed6\u533a |\n| -a <accessKey> | \u7b2c\u4e09\u65b9\u5bf9\u8c61\u5b58\u50a8\u7684AccessKey | string | start\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6 |\n| -s <secretKey> | \u7b2c\u4e09\u65b9\u5bf9\u8c61\u5b58\u50a8\u7684SecretKey | string | start\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6 |\n| -b <\u6e90bucket> | \u7b2c\u4e09\u65b9\u5bf9\u8c61\u5b58\u50a8\u7684bucket | string | start\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6 |\n| -e <endpoint> | \u7b2c\u4e09\u65b9\u5bf9\u8c61\u5b58\u50a8\u7684endpoint\u5730\u5740 | string | start\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6 |\n| -u <\u6e90\u5b50\u76ee\u5f55> | \u7b2c\u4e09\u65b9\u5bf9\u8c61\u5b58\u50a8\u8981\u5bfc\u5165\u7684\u5b50\u76ee\u5f55 | string | start\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6,\u4e0d\u4f20\u4e3a\u6839\u76ee\u5f55 |\n| -d <\u6e90\u57df\u540d> | \u4e03\u725bbucket\u7684\u81ea\u5b9a\u4e49\u57df\u540d | string | start\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6\uff0c\u4e03\u725b\u4e13\u7528 |\n| -o <ossId> | cdncloud\u7684ossId | string | start\/upload\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6 |\n| -B <bucketId> | cdncloud\u7684bucketId | string | start\/upload\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6 |\n| -U <\u76ee\u6807\u5b50\u76ee\u5f55> | \u5bfc\u5165\u5230\u76ee\u6807\u5b50\u76ee\u5f55 | string | start\/upload\u547d\u4ee4\u53c2\u6570\uff0c\u4f18\u5148\u4e8e\u914d\u7f6e\u6587\u4ef6 |\n| -p <\u672c\u5730\u5b50\u76ee\u5f55> | \u8981\u5bfc\u5165\u7684\u672c\u5730\u76ee\u5f55 | string | Upload\u547d\u4ee4\u53c2\u6570 |\n| -S <true\/false> | \u540c\u6b65\u6a21\u5f0f\u5f00\u5173\uff0c\u9ed8\u8ba4\u4e3atrue | bool | \u540c\u6b65\u6a21\u5f0f\uff1a\u8df3\u8fc7\u5df2\u7ecf\u5b58\u5728\u540c\u540d\u4e14md5\u76f8\u540c\u7684\u6587<br \/>\u4ef6\uff0c\u4ec5\u5bfc\u5165\u4e0d\u540c\u7684\u6216\u4e0d\u5b58\u5728\u7684\u3002false\u4e3a\u5168\u91cf\u8986\u76d6\u6a21\u5f0f, hk-02\u533a\u6682\u4e0d\u652f\u6301\u540c\u6b65\u6a21\u5f0f |\n| -z <\u53ef\u7528\u533a\u53f7> | cdncloud\u7684\u76ee\u6807\u53ef\u7528\u533a\u53f7\uff0c\u5982hk-02\/hk-03\/us-02 | string | start\/upload\u547d\u4ee4\u53c2\u6570 |\n\n\n### \u516d\u3001\u5bfc\u5165\u4efb\u52a1\u64cd\u4f5c\u547d\u4ee4\u8303\u4f8b\n\n#### 1. \u4f7f\u7528\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u5bfc\u5165\n\n```bash\n.\/oss-import-cli start -c example-baidu.yml\n```\n\n#### 2. \u4f7f\u7528\u547d\u4ee4\u884c\u53c2\u6570\u8fdb\u884c\u5bfc\u5165\n\n```bash\n.\/oss-import-cli start -f aliyun -a LTAI5tEnhmf4YzBma2VsPkAj -s eMp9lcywf7WopbgfiTima88T3rQLFs -b flametest -u \/test -e https:\/\/oss-cn-guangzhou.aliyuncs.com -o euzv51rb -B ag1q4l4p -U \/test\/aliyun\/ -S true\n```\n\n#### 3. \u5bfc\u5165\u672c\u5730\u6587\u4ef6\u5939\n\n```bash\n.\/oss-import-cli upload -p \/Volumes\/APPS\/mp3\/ -o euzv51rb -B ag1q4l4p -U \/test\/mp3\/\n```\n\n#### 4. \u505c\u6b62\u5f53\u524d\u6b63\u5728\u5bfc\u5165\u7684\u4efb\u52a1\n\n\u505c\u6b62\u5f53\u524d\u4efb\u52a1\u6709\u4e24\u79cd\u65b9\u6cd5\uff0c\u7b2c\u4e00\u79cd\u662f\u5728start\u4efb\u52a1\u6267\u884c\u63a7\u5236\u53f0\u4e0a\u6309CTRL+C\u7ec8\u6b62\u5bfc\u5165\u4efb\u52a1\n\n\u7b2c\u4e8c\u79cd\u662f\u65b0\u5f00\u4e00\u4e2a\u547d\u4ee4\u7a97\u53e3\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\n\n```bash\n.\/oss-import-cli stop\n```\n\n#### 5. \u67e5\u770b\u5f53\u524d\u6b63\u5728\u5bfc\u5165\u7684\u4efb\u52a1\u53c2\u6570\u4e0e\u6267\u884c\u72b6\u6001\n\n```bash\n.\/oss-import-cli info\n```\n\n#### 6. \u8ddf\u8e2a\u5f53\u524d\u6b63\u5728\u5bfc\u5165\u7684\u4efb\u52a1\u6267\u884c\u8fdb\u5ea6\n\n```bash\n.\/oss-import-cli view\n```\n\n"}