dragonflyoss / Dragonfly

This repository has be archived and moved to the new repository https://github.com/dragonflyoss/Dragonfly2.
https://d7y.io
Apache License 2.0
6k stars 774 forks source link

How can I use dfget to download files from another node in the same network? #749

Closed NikiChr closed 5 years ago

NikiChr commented 5 years ago

I have a virtual network with containernet with 4 nodes that run dragonfly:

Do I have to start a server on 44.44.12.2 using dfget server to be able to access the node's files?

I naively tried to use dfget on 44.44.24.4 like this dfget --verbose -u http://44.44.12.2/root/.small-dragonfly/512MB.zip --notbs without running a server on 44.44.12.2. Which resulted in the following error:

--2019-07-30 20:03:20--  http://44.44.12.2/root/.small-dragonfly/512MB.zip
dfget version:0.4.2
workspace:/root/.small-dragonfly sign:529-1564517000.740
client:44.44.34.4 connected to node:44.44.12.1:8002
start download by dragonfly
migrated to node:44.44.12.1:8002
download FAIL(1104) cost:2.334s length:-1 reason:1003 error:{"Code":1104,"Msg":"download fail and not back source: 1003"}

And the following log entry:

2019-07-30 20:03:20.740 DEBU sign:529-1564517000.740 : initProperties[/etc/dragonfly/dfget.yml] success: {"Nodes":["44.44.12.1:8002"],"LocalLimit":20971520,"MinRate":65536,"TotalLimit":0,"ClientQueueSize":6}
2019-07-30 20:03:20.740 INFO sign:529-1564517000.740 : get cmd params:["dfget" "--verbose" "-u" "http://44.44.12.2/root/.small-dragonfly/512MB.zip" "--notbs"]
2019-07-30 20:03:20.740 INFO sign:529-1564517000.740 : get init config:{"url":"http://44.44.12.2/root/.small-dragonfly/512MB.zip","output":"/512MB.zip","localLimit":20971520,"minRate":65536,"pattern":"p2p","node":["44.44.12.1:8002"],"notbs":true,"verbose":true,"clientQueueSize":6,"startTime":"2019-07-30T20:03:20.740015963Z","sign":"529-1564517000.740","user":"root","workHome":"/root/.small-dragonfly","configFile":["/etc/dragonfly/dfget.yml","/etc/dragonfly.conf"]}
2019-07-30 20:03:20.740 INFO sign:529-1564517000.740 : target file path:/512MB.zip
2019-07-30 20:03:20.740 INFO sign:529-1564517000.740 : runtimeVariable: {"MetaPath":"/root/.small-dragonfly/meta/host.meta","SystemDataDir":"/root/.small-dragonfly/data","DataDir":"/root/.small-dragonfly/data","RealTarget":"/512MB.zip","TargetDir":"/","TempTarget":"/dfget-529-1564517000.740.tmp-232024637","Cid":"44.44.34.4-529-1564517000.740","TaskURL":"http://44.44.12.2/root/.small-dragonfly/512MB.zip","TaskFileName":"512MB.zip-529-1564517000.740","LocalIP":"44.44.34.4","PeerPort":0,"FileLength":-1,"DataExpireTime":180000000000,"ServerAliveTime":300000000000}
2019-07-30 20:03:20.740 INFO sign:529-1564517000.740 : local http result: err:dial tcp4 44.44.34.4:0: connect: connection refused, port:0 path:/check/
2019-07-30 20:03:20.878 INFO sign:529-1564517000.740 : local http result:512MB.zip-529-1564517000.740 err:<nil>, port:30056 path:/check/
2019-07-30 20:03:20.878 INFO sign:529-1564517000.740 : use peer server on port:30056
2019-07-30 20:03:20.878 INFO sign:529-1564517000.740 : do register to one of [44.44.12.1:8002 44.44.12.1:8002]
2019-07-30 20:03:20.881 INFO sign:529-1564517000.740 : do register to 44.44.12.1:8002, res:{"code":200,"msg":"success","data":{"taskId":"498cfdde851bb772111642e1d205f2bfb34a8e68033f71003e69d070229e2b84","fileLength":-1,"pieceSize":4194304}} error:<nil>
2019-07-30 20:03:20.881 INFO sign:529-1564517000.740 : do register result:{"code":200,"msg":"success","data":{"taskId":"498cfdde851bb772111642e1d205f2bfb34a8e68033f71003e69d070229e2b84","fileLength":-1,"pieceSize":4194304}} and cost:0.003s
2019-07-30 20:03:20.881 INFO sign:529-1564517000.740 : downloading piece:{"taskID":"498cfdde851bb772111642e1d205f2bfb34a8e68033f71003e69d070229e2b84","superNode":"44.44.12.1:8002","dstCid":"","range":"","result":502,"status":700,"pieceSize":0,"pieceNum":0}
2019-07-30 20:03:20.882 INFO sign:529-1564517000.740 : pull piece task result:{"code":602,"msg":"clientSucCount:0,cdnSucCount:0: {\"Code\":9,\"Msg\":\"peer should wait\"}"} and sleep 1.490s
2019-07-30 20:03:22.373 ERRO sign:529-1564517000.740 : pull piece task fail:{"code":500,"msg":"taskID: 498cfdde851bb772111642e1d205f2bfb34a8e68033f71003e69d070229e2b84: {\"Code\":7,\"Msg\":\"cdn status is fail\"}"} and will migrate
2019-07-30 20:03:22.374 INFO sign:529-1564517000.740 : do register to one of [44.44.12.1:8002]
2019-07-30 20:03:22.376 INFO sign:529-1564517000.740 : do register to 44.44.12.1:8002, res:{"code":200,"msg":"success","data":{"taskId":"498cfdde851bb772111642e1d205f2bfb34a8e68033f71003e69d070229e2b84","fileLength":-1,"pieceSize":4194304}} error:<nil>
2019-07-30 20:03:22.376 INFO sign:529-1564517000.740 : do register result:{"code":200,"msg":"success","data":{"taskId":"498cfdde851bb772111642e1d205f2bfb34a8e68033f71003e69d070229e2b84","fileLength":-1,"pieceSize":4194304}} and cost:0.002s
2019-07-30 20:03:22.376 INFO sign:529-1564517000.740 : pull piece task result:{"code":602,"msg":"clientSucCount:0,cdnSucCount:0: {\"Code\":9,\"Msg\":\"peer should wait\"}"} and sleep 0.695s
2019-07-30 20:03:23.073 ERRO sign:529-1564517000.740 : pull piece task fail:{"code":500,"msg":"taskID: 498cfdde851bb772111642e1d205f2bfb34a8e68033f71003e69d070229e2b84: {\"Code\":7,\"Msg\":\"cdn status is fail\"}"} and will migrate
2019-07-30 20:03:23.073 INFO sign:529-1564517000.740 : do register to one of []
2019-07-30 20:03:23.073 ERRO sign:529-1564517000.740 : register fail:{"Code":-100,"Msg":"empty response, unknown error"}
2019-07-30 20:03:23.073 ERRO sign:529-1564517000.740 : download piece fail: {"Code":-100,"Msg":"empty response, unknown error"}
2019-07-30 20:03:23.073 ERRO sign:529-1564517000.740 : download fail and not back source: 1003
2019-07-30 20:03:23.074 INFO sign:529-1564517000.740 : download FAIL cost:2.334s length:-1 reason:1003

I also tried running a server on 44.44.12.2 like this: dfget server --ip 44.44.12.2 --port 22222 and adding the port 22222 to the download dfget command which resulted in the same error messages. How can I address and download a file like 512MB.zip using the node 44.44.24.4?

starnop commented 5 years ago

Unfortunately, you can't download files directly from 44.44.24.2 which has been downloaded the file that you want. 😄

NikiChr commented 5 years ago

@Starnop thanks! I thought that you can use dfget server to supply files to the network. But I must have misunderstood that.