[关闭]
@zhenxi 2017-10-12T22:35:30.000000Z 字数 5167 阅读 2049

ipfs命令行文档

IPFS


diag

ipfs diag SUBCOMMANDS

作用 生成诊断报告

  1. root@asch-build:~# ipfs diag cmds
  2. Command Active StartTime RunTime
  3. swarm/peers false Oct 12 10:15:17 56.806878ms
  4. diag/cmds true Oct 12 11:11:09 22.492793ms
  5. root@asch-build:~# ipfs diag sys
  6. {
  7. "diskinfo": {
  8. "free_space": 22549147648,
  9. "fstype": "61267",
  10. "total_space": 21190385664
  11. },
  12. "environment": {
  13. "GOPATH": "/root/work",
  14. "IPFS_PATH": ""
  15. },
  16. "ipfs_commit": "",
  17. "ipfs_version": "0.4.11",
  18. "memory": {
  19. "swap": 0,
  20. "virt": 988264000
  21. },
  22. "net": {
  23. "interface_addresses": ["/ip4/127.0.0.1",
  24. "/ip4/45.32.9.220",
  25. "/ip6/::1",
  26. "/ip6/fe80::5400:1ff:fe34:75b5"],
  27. "online": true
  28. },
  29. "runtime": {
  30. "arch": "amd64",
  31. "compiler": "gc",
  32. "gomaxprocs": 1,
  33. "numcpu": 1,
  34. "numgoroutines": 14173,
  35. "os": "linux",
  36. "version": "go1.9"
  37. }
  38. }

ADVANCED COMMANDS

pin

  1. // 获取本地pin的所有类型的文件
  2. root@asch-build:~# ipfs pin ls --type=all
  3. QmbjMZqjKxhS24WsZiq798bTd4xbmDzNmBkVpXF7Jdxnqh recursive
  4. QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm recursive
  5. QmeBpzHngbHes9hoPjfDCmpNHGztkmZFRX4Yp9ftKcXZDN indirect
  6. QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y indirect
  7. QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB indirect
  8. QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm indirect
  9. QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy recursive // 本地上传的
  10. QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv recursive
  11. QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o recursive
  12. QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn recursive
  13. QmWLdkp93sNxGRjnFHPaYg8tCQ35NBY3XPn6KiETd3Z4WR indirect
  14. QmXgqKTbzdh83pQtKFb19SpMCpDDcKR2ujqk3pKph9aCNF indirect
  15. QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 indirect
  16. QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y indirect
  17. QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V indirect
  18. root@asch-build:~# ipfs pin rm QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy // 不生效
  19. unpinned QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy
  20. root@asch-build:~# ipfs repo gc // 并没有回收任何东西
  21. root@asch-build:~# ipfs cat QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy
  22. ipfs rocks
  23. root@asch-build:~# ipfs add foo
  24. added QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy foo
  25. root@asch-build:~# ipfs pin ls --type=all
  26. QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy recursive
  27. QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V indirect
  28. QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm recursive
  29. QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y indirect
  30. QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB indirect
  31. QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn recursive
  32. QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y indirect
  33. QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm indirect
  34. QmbjMZqjKxhS24WsZiq798bTd4xbmDzNmBkVpXF7Jdxnqh recursive
  35. QmeBpzHngbHes9hoPjfDCmpNHGztkmZFRX4Yp9ftKcXZDN indirect
  36. QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 indirect
  37. QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o recursive
  38. QmWLdkp93sNxGRjnFHPaYg8tCQ35NBY3XPn6KiETd3Z4WR indirect
  39. QmXgqKTbzdh83pQtKFb19SpMCpDDcKR2ujqk3pKph9aCNF indirect
  40. QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv recursive
  41. root@asch-build:~# ipfs pin rm -r QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy
  42. unpinned QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy
  43. root@asch-build:~# ipfs repo gc
  44. removed QmNX1WDix4sunJnu3wc9aH3nLQhQQNR3pG3EmJkdnE3w1k
  45. removed QmdQsTFQiuQdJ1nwWxcWSDzLbjouEUt1zZBK9kDr6Qm2y8
  46. removed QmYRMUVULBfj7WrdPESnwnyZmtayN6Sdrwh1nKcQ9QgQeZ
  47. removed QmdL9t1YP99v4a2wyXFYAQJtbD9zKnPrugFLQWXBXb82sn
  48. removed QmZZRTyhDpL5Jgift1cHbAhexeE1m2Hw8x8g7rTcPahDvo
  49. removed QmTVFSinqPuE63eJYqaUuRWTx7zjKoREwZee5ok3qdqWqB
  50. removed QmcLwi5eu9xmKjrNxuTVfq2oGj2N88nRtx6LZXjX5RZKxg
  51. removed QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy // 刚才我们add的内容hash
  52. removed QmPhk6cJkRcFfZCdYam4c9MKYjFG9V29LswUnbrFNhtk2S
  53. removed QmT8onRUfPgvkoPMdMvCHPYxh98iKCfFkBYM1ufYpnkHJn
  54. removed QmYVMHnw3ZvJhqw32gbUoAeUVKMk8Cjw6yB53byEYnMiZM
  55. removed QmbRcHgmNeW6ikXxrzEtjXgh5SojNWrCSHe6Z8prhSJi94
  56. removed QmdxMF7iVtaDKbSjVfQ3FPokZr1iWeVygHiEnVfHAVabWZ
  57. removed QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ
  58. removed Qmb7oGTxge7amSArtJsGUAqswY8y1G7m5QNjV57Nj5sEHU
  59. removed QmZuT3fhDEYoxsZhAw44Ke8oeyeHsxPjLw9JumWqVSiCb3
  60. removed Qmd286K6pohQcTKYqnS1YhWrCiS4gz7Xi34sdwMe9USZ7u
  61. removed QmVQjvKzfVTTNFqrhiLiW1D6KCeTmqJx9k7CEy5jUpbiVd
  62. removed QmPEKipMh6LsXzvtLxunSPP7ZsBM8y9xQ2SQQwBXy5UY6e
  63. root@asch-build:~# ipfs cat QmRTV3h1jLcACW4FRfdisokkQAk4E4qDhUzGpgdrd4JAFy // 耗时很久,几分钟才返回了结果
  64. // 按理说这里不应该有数据。。 ipfs上传只保存一份数据,本地被gc后应该消失了才对
  65. ipfs rocks

NETWORK COMMANDS

id

  1. root@asch-build:~# ipfs id
  2. {
  3. "ID": "QmTTpxE4Fq9LYfR8L5jbUtB4CrAtJdfQQAJSBmTkrpZwxC",
  4. "PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDLVZUam2PzSoCxizQzG0PzTzc+QcjrMvocETHH3haiUyhxbA70ZiaaUR+NyMygMO8FkCRqZsLhaL0lKBiUVL3G6KbCnIglR2MnMH3T2OWpDYJzpD3mC1BXRbNrP0YdyVhD3l4ZDZNm/GQ+1DgeJ7ifKCUVJXPBgkEUXZP5vmKUoshx9oOMBku8KeErHfmKbzi4EPrwvXzIVvx1jADy9C6oPVF3VPEoFEbGVoQs0K0VVCKINLZPgInqoIRkQZFEyEw2vzvNZAkQWte2Wc/IkM5W//uXxdYJ41ufNTrihyqbCDJZtIl2t/ia3BG2/EHisaNfew/yVH85/RfvL5M3EIZTAgMBAAE=",
  5. "Addresses": null,
  6. "AgentVersion": "go-ipfs/0.4.11/",
  7. "ProtocolVersion": "ipfs/0.1.0"
  8. }

TOOL COMMANDS

version

  1. root@asch-build:~# ipfs version
  2. ipfs version 0.4.11

TroubleShooting

  1. root@asch-build:~# ipfs pin ls --type=all
  2. Error: Failed to get block for QmbjMZqjKxhS24WsZiq798bTd4xbmDzNmBkVpXF7Jdxnqh: ran out of retries trying to get past temporary error: open /root/.ipfs/blocks/GV/CIQMN6HH2JAUIWSR2JRMTPGNOUSBFKRZYHD5HLBYLY7MDRSLH2PAGVA.data: too many open files
  3. root@asch-build:~# ulimit -n 204800
  4. root@asch-build:~# sudo echo 200000 > /proc/sys/fs/file-max
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注