Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | 云栖社区 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Github | Search | About

26.3. ipfs 命令

创建 ipfs 用户

		
[root@netkiller ~]# adduser ipfs
[root@netkiller ~]# su - ipfs
[ipfs@netkiller ~]$
		
		

26.3.1. 基本命令

26.3.1.1. 初始化节点

				
[ipfs@netkiller ~]$ ipfs init
initializing IPFS node at /home/ipfs/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmZakCF5czhP53KPvMi8XQcYtVrQohw5N71Xce4eC1rWz3
to get started, enter:

	ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
				
				

目录结构

			
[ipfs@netkiller ~]$ ls .ipfs/
blocks  config  datastore  datastore_spec  keystore  version
			
				

26.3.1.2. 添加文件

				
[ipfs@netkiller ~]$ echo Helloworld > helloworld.txt
[ipfs@netkiller ~]$ ipfs add helloworld.txt
added QmS8R3nSbDHjQ7WRTjtX1pkiQ6BUpti9qTjweZkBgGPKiN helloworld.txt

[ipfs@netkiller ~]$ ipfs cat QmS8R3nSbDHjQ7WRTjtX1pkiQ6BUpti9qTjweZkBgGPKiN
Helloworld

[ipfs@netkiller ~]$ ipfs cat /ipfs/QmS8R3nSbDHjQ7WRTjtX1pkiQ6BUpti9qTjweZkBgGPKiN
Helloworld

				
				

添加文本

				
[ipfs@netkiller ~]$ echo 'Look! Things have changed!' | ipfs add
added QmSb8DSVmu4Qip56jcqPVz1Cx9RJ3vTf3d1Gf9ixaG2tWg QmSb8DSVmu4Qip56jcqPVz1Cx9RJ3vTf3d1Gf9ixaG2tWg

[ipfs@netkiller ~]$ ipfs cat QmSb8DSVmu4Qip56jcqPVz1Cx9RJ3vTf3d1Gf9ixaG2tWg
Look! Things have changed!

				
				

修改内容

				
[root@netkiller ~]# echo "version 1 of my text" | ipfs add
added QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy

[root@netkiller ~]# echo "version 2 of my text" | ipfs add
added QmTudJSaoKxtbEnTddJ9vh8hbN84ZLVvD5pNpUaSbxwGoa QmTudJSaoKxtbEnTddJ9vh8hbN84ZLVvD5pNpUaSbxwGoa

[root@netkiller ~]# ipfs cat QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy
version 1 of my text

[root@netkiller ~]# ipfs cat QmTudJSaoKxtbEnTddJ9vh8hbN84ZLVvD5pNpUaSbxwGoa
version 2 of my text


[root@netkiller ~]# echo "version 1" > version.txt
[root@netkiller ~]# ipfs add version.txt
added QmQBcXurY2QBpv7sg8zyS4UXQeHGCqx4DBp86kBLPDzS18 version.txt

[root@netkiller ~]# echo "version 2" > version.txt
[root@netkiller ~]# ipfs add version.txt
added QmWzK72EZJJhW96x1tgaz8yU3G6okJ9MfMxbLianzFLhY2 version.txt

[root@netkiller ~]# ipfs cat QmQBcXurY2QBpv7sg8zyS4UXQeHGCqx4DBp86kBLPDzS18
version 1

[root@netkiller ~]# ipfs cat QmWzK72EZJJhW96x1tgaz8yU3G6okJ9MfMxbLianzFLhY2
version 2
				
				

26.3.1.3. 查看文件

				
[ipfs@netkiller ~]$ ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
Hello and Welcome to IPFS!

██╗██████╗ ███████╗███████╗
██║██╔══██╗██╔════╝██╔════╝
██║██████╔╝█████╗  ███████╗
██║██╔═══╝ ██╔══╝  ╚════██║
██║██║     ██║     ███████║
╚═╝╚═╝     ╚═╝     ╚══════╝

If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!

 -------------------------------------------------------
| Warning:                                              |
|   This is alpha software. Use at your own discretion! |
|   Much is missing or lacking polish. There are bugs.  |
|   Not yet secure. Read the security notes for more.   |
 -------------------------------------------------------

Check out some of the other files in this directory:

  ./about
  ./help
  ./quick-start     <-- usage examples
  ./readme          <-- this file
  ./security-notes

				
				

26.3.1.4. 下载文件

				
[root@netkiller ~]# ipfs get /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
Saving file(s) to readme
 1.08 KB / 1.08 KB [======================================================================] 100.00% 0s
[root@netkiller ~]# ls
readme
				
				
				
[root@netkiller ~]# ipfs add readme.txt
added QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn readme.txt

[root@netkiller ~]# ipfs cat QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn
Helloworld

[root@netkiller ~]# ipfs get QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn
Saving file(s) to QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn
 880 B / 880 B [=========================================================================] 100.00% 0s

[root@netkiller ~]# ls
QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn  readme.txt

				
				

26.3.1.5. 列出文件或目录

				
[root@netkiller ~]# ipfs ls /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/
QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V 1688 about
QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y 200  contact
QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 322  help
QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y 12   ping
QmXgqKTbzdh83pQtKFb19SpMCpDDcKR2ujqk3pKph9aCNF 1692 quick-start
QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB 1102 readme
QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm 1173 security-notes
				
				
				
[root@netkiller ~]# ipfs add -r /etc/rc.d
added QmP4m7YRN25kcRgoJgn95yFR4GsVgbQppnpMGh3AxPzUbc rc.d/init.d/README
added QmemkmPhud9hBWhTDgnYfascZcXjX4H6j4oyqhKdSvFq8G rc.d/init.d/aegis
added QmR2zvwDZYQPw4arpaJQwGESPhmz6qBt8MqyrV5UR72JUy rc.d/init.d/agentwatch
added QmevSkKJVSF4amfHux7bMZCvaQQjuFsDxU1j7j7uvvJzBh rc.d/init.d/functions
added QmXCmPYb1wWcmAWk8tm1jgYsFgF16mTe2PsnNebw1gzWDw rc.d/init.d/jexec
added QmeQZxv7Fui5Ah9w9E9QuiyTrbm4XMKyJMthGLvbbtd5q4 rc.d/init.d/netconsole
added QmeDfRGHoLuSTZqk4zcwGKJQ1NUk9VhEYxFy1HC5d9hKxH rc.d/init.d/network
added QmYWStNUPtn9TgUT39D7vXMjXc5y917W7SsjPTZvCMK136 rc.d/rc.local
added QmS92vH7JY9CnP3DVZiQcHxqyi9FQXc1RTcyQvhCJnTCon rc.d/rc0.d/K01agentwatch
added QmabzShX1WxbdMfLmNK16M1edR5TP95iM5FBURSFwfdj4t rc.d/rc0.d/K05jexec
added QmcuWaJdg5JCckgdh5BomTwYjrn3ChrC2xa3yY61jQ1pGV rc.d/rc0.d/K50aegis
added QmYnJ5yxouhrbu81Nod3o1ZWKuwdHYYsbr7z4BgLCxxR2P rc.d/rc0.d/K50netconsole
added QmPNCeB2yS9EZ3cG3ousMtPkLNemkQaDfKt63S4NTBJg3z rc.d/rc0.d/K90network
added QmS92vH7JY9CnP3DVZiQcHxqyi9FQXc1RTcyQvhCJnTCon rc.d/rc1.d/K01agentwatch
added QmcuWaJdg5JCckgdh5BomTwYjrn3ChrC2xa3yY61jQ1pGV rc.d/rc1.d/K50aegis
added QmYnJ5yxouhrbu81Nod3o1ZWKuwdHYYsbr7z4BgLCxxR2P rc.d/rc1.d/K50netconsole
added QmPNCeB2yS9EZ3cG3ousMtPkLNemkQaDfKt63S4NTBJg3z rc.d/rc1.d/K90network
added QmabzShX1WxbdMfLmNK16M1edR5TP95iM5FBURSFwfdj4t rc.d/rc1.d/S95jexec
added QmYnJ5yxouhrbu81Nod3o1ZWKuwdHYYsbr7z4BgLCxxR2P rc.d/rc2.d/K50netconsole
added QmPNCeB2yS9EZ3cG3ousMtPkLNemkQaDfKt63S4NTBJg3z rc.d/rc2.d/S10network
added QmcuWaJdg5JCckgdh5BomTwYjrn3ChrC2xa3yY61jQ1pGV rc.d/rc2.d/S50aegis
added QmabzShX1WxbdMfLmNK16M1edR5TP95iM5FBURSFwfdj4t rc.d/rc2.d/S95jexec
added QmS92vH7JY9CnP3DVZiQcHxqyi9FQXc1RTcyQvhCJnTCon rc.d/rc2.d/S98agentwatch
added QmYnJ5yxouhrbu81Nod3o1ZWKuwdHYYsbr7z4BgLCxxR2P rc.d/rc3.d/K50netconsole
added QmPNCeB2yS9EZ3cG3ousMtPkLNemkQaDfKt63S4NTBJg3z rc.d/rc3.d/S10network
added QmcuWaJdg5JCckgdh5BomTwYjrn3ChrC2xa3yY61jQ1pGV rc.d/rc3.d/S50aegis
added QmabzShX1WxbdMfLmNK16M1edR5TP95iM5FBURSFwfdj4t rc.d/rc3.d/S95jexec
added QmS92vH7JY9CnP3DVZiQcHxqyi9FQXc1RTcyQvhCJnTCon rc.d/rc3.d/S98agentwatch
added QmYnJ5yxouhrbu81Nod3o1ZWKuwdHYYsbr7z4BgLCxxR2P rc.d/rc4.d/K50netconsole
added QmPNCeB2yS9EZ3cG3ousMtPkLNemkQaDfKt63S4NTBJg3z rc.d/rc4.d/S10network
added QmcuWaJdg5JCckgdh5BomTwYjrn3ChrC2xa3yY61jQ1pGV rc.d/rc4.d/S50aegis
added QmabzShX1WxbdMfLmNK16M1edR5TP95iM5FBURSFwfdj4t rc.d/rc4.d/S95jexec
added QmS92vH7JY9CnP3DVZiQcHxqyi9FQXc1RTcyQvhCJnTCon rc.d/rc4.d/S98agentwatch
added QmYnJ5yxouhrbu81Nod3o1ZWKuwdHYYsbr7z4BgLCxxR2P rc.d/rc5.d/K50netconsole
added QmPNCeB2yS9EZ3cG3ousMtPkLNemkQaDfKt63S4NTBJg3z rc.d/rc5.d/S10network
added QmcuWaJdg5JCckgdh5BomTwYjrn3ChrC2xa3yY61jQ1pGV rc.d/rc5.d/S50aegis
added QmabzShX1WxbdMfLmNK16M1edR5TP95iM5FBURSFwfdj4t rc.d/rc5.d/S95jexec
added QmS92vH7JY9CnP3DVZiQcHxqyi9FQXc1RTcyQvhCJnTCon rc.d/rc5.d/S98agentwatch
added QmS92vH7JY9CnP3DVZiQcHxqyi9FQXc1RTcyQvhCJnTCon rc.d/rc6.d/K01agentwatch
added QmabzShX1WxbdMfLmNK16M1edR5TP95iM5FBURSFwfdj4t rc.d/rc6.d/K05jexec
added QmcuWaJdg5JCckgdh5BomTwYjrn3ChrC2xa3yY61jQ1pGV rc.d/rc6.d/K50aegis
added QmYnJ5yxouhrbu81Nod3o1ZWKuwdHYYsbr7z4BgLCxxR2P rc.d/rc6.d/K50netconsole
added QmPNCeB2yS9EZ3cG3ousMtPkLNemkQaDfKt63S4NTBJg3z rc.d/rc6.d/K90network
added QmUy33heBFE59gc6PB2sevQ88gB7Lv3NDASFJF3S8f1qHK rc.d/init.d
added QmaDZHSDdtNyryWNwtxuMtJ8NduQdfhMMHk7JuTpNW5sTs rc.d/rc0.d
added QmX6D9eP1oHMg92rrVYarGAe4w3HQ9vURcncBRvPqtXSyG rc.d/rc1.d
added QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 rc.d/rc2.d
added QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 rc.d/rc3.d
added QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 rc.d/rc4.d
added QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 rc.d/rc5.d
added QmaDZHSDdtNyryWNwtxuMtJ8NduQdfhMMHk7JuTpNW5sTs rc.d/rc6.d
added QmRYPNdKdyCr6R7fE63g2u3sMD8SQh8TW6yQNAk9mT9Pay rc.d

[root@netkiller ~]# ipfs ls -v QmRYPNdKdyCr6R7fE63g2u3sMD8SQh8TW6yQNAk9mT9Pay
Hash                                           Size  Name
QmUy33heBFE59gc6PB2sevQ88gB7Lv3NDASFJF3S8f1qHK 36013 init.d/
QmYWStNUPtn9TgUT39D7vXMjXc5y917W7SsjPTZvCMK136 484   rc.local
QmaDZHSDdtNyryWNwtxuMtJ8NduQdfhMMHk7JuTpNW5sTs 383   rc0.d/
QmX6D9eP1oHMg92rrVYarGAe4w3HQ9vURcncBRvPqtXSyG 383   rc1.d/
QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 383   rc2.d/
QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 383   rc3.d/
QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 383   rc4.d/
QmTEuKk4acWJcsCDYJViMNoKZ2BQDY8NSHraV9gB9nAWm8 383   rc5.d/
QmaDZHSDdtNyryWNwtxuMtJ8NduQdfhMMHk7JuTpNW5sTs 383   rc6.d/

[root@netkiller ~]# ipfs ls -v QmUy33heBFE59gc6PB2sevQ88gB7Lv3NDASFJF3S8f1qHK
Hash                                           Size  Name
QmP4m7YRN25kcRgoJgn95yFR4GsVgbQppnpMGh3AxPzUbc 1171  README
QmemkmPhud9hBWhTDgnYfascZcXjX4H6j4oyqhKdSvFq8G 2266  aegis
QmR2zvwDZYQPw4arpaJQwGESPhmz6qBt8MqyrV5UR72JUy 3015  agentwatch
QmevSkKJVSF4amfHux7bMZCvaQQjuFsDxU1j7j7uvvJzBh 17514 functions
QmXCmPYb1wWcmAWk8tm1jgYsFgF16mTe2PsnNebw1gzWDw 41    jexec
QmeQZxv7Fui5Ah9w9E9QuiyTrbm4XMKyJMthGLvbbtd5q4 4345  netconsole
QmeDfRGHoLuSTZqk4zcwGKJQ1NUk9VhEYxFy1HC5d9hKxH 7304  network

				
				

26.3.2. 数据结构命令

26.3.2.1. 块

					
					
					
				

26.3.2.2. 对象

				
[ipfs@netkiller ~]$ ipfs object get QmS8R3nSbDHjQ7WRTjtX1pkiQ6BUpti9qTjweZkBgGPKiN
{"Links":[],"Data":"\u0008\u0002\u0012\u000bHelloworld\n\u0018\u000b"}
				
				

26.3.3. 高级命令

26.3.3.1. 守护进程

				
$ ipfs daemon
				
				

http://localhost:5001/webui

26.3.3.2. 发布并解析IPNS

				
[root@netkiller ~]# ipfs add readme.txt
added QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn readme.txt
[root@netkiller ~]# ipfs name publish QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn

Published to QmPNH1AKXNidUgsW6MaMABiNRhdXnqpTbthbYoZzhZE9ve: /ipfs/QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn

[root@netkiller ~]# ipfs cat /ipfs/QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn
				
				

验证发布

				
[root@netkiller ~]# ipfs add version.txt
added QmWzK72EZJJhW96x1tgaz8yU3G6okJ9MfMxbLianzFLhY2 version.txt

[root@netkiller ~]# ipfs name publish QmWzK72EZJJhW96x1tgaz8yU3G6okJ9MfMxbLianzFLhY2
Published to QmPNH1AKXNidUgsW6MaMABiNRhdXnqpTbthbYoZzhZE9ve: /ipfs/QmWzK72EZJJhW96x1tgaz8yU3G6okJ9MfMxbLianzFLhY2

[root@netkiller ~]# ipfs name resolve QmPNH1AKXNidUgsW6MaMABiNRhdXnqpTbthbYoZzhZE9ve
/ipfs/QmWzK72EZJJhW96x1tgaz8yU3G6okJ9MfMxbLianzFLhY2
				
				

26.3.3.3. 将 Pin 对象存储到本地

ls

				
[root@netkiller ~]# ipfs pin ls
QmQBcXurY2QBpv7sg8zyS4UXQeHGCqx4DBp86kBLPDzS18 recursive
QmTudJSaoKxtbEnTddJ9vh8hbN84ZLVvD5pNpUaSbxwGoa recursive
QmXgqKTbzdh83pQtKFb19SpMCpDDcKR2ujqk3pKph9aCNF indirect
QmcUcr4nbCDE4V1fPNZXoZa3YkCwjCv8Wd9EqLJeysAt48 indirect
QmcUnyBqYgAR5rxVQ1Pzw2DBh9evqSRBRogjshb9khJA9T indirect
QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y indirect
QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv recursive
QmTiu69XGzh1iqK6JuJNzoTiQ4SJEeQSso3uCHRwbXFba8 indirect
QmW2nvZqf6fwmcgBeeUEv2UyePizsFjjkNCubqRjmCZHNV indirect
QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 indirect
QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y indirect
QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy recursive
QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB indirect
QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm indirect
QmRpsaigHjE4udpVDXZ8T4YtA477M7YTox6xxxkbYjisgN indirect
QmWkLpc4aCRCgPYokdXGZU3zuupRognVGVccALY4aJH31W indirect
QmWzK72EZJJhW96x1tgaz8yU3G6okJ9MfMxbLianzFLhY2 recursive
QmaHUhxr4NPTsxc2iubLAVGAvJ6hRKfZsbDPYZDT6Bdcb1 indirect
QmSLNhoZCHiRUyAsPRsLRMscu2AromEYJgJJWw229DypXT indirect
QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn recursive
QmVbXqY6kY7iFjPNw1vNGggtRmNxTVLGAziLvC9GEsMLGR recursive
QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V indirect
Qmbh35NHRNYfpaXaj1bQF4gcVYKRjjBvD7eys4dK4iwNrY indirect
Qmen15DKJhF5ngxiBEzmpMyPA3HpMfXNqgogeyeati2sEx indirect
				
				

26.3.3.4. 查看状态

26.3.3.4.1. 仓库状态
					
[root@netkiller ~]# ipfs stats repo
NumObjects: 46
RepoSize:   3004401
StorageMax: 10000000000
RepoPath:   /root/.ipfs
Version:    fs-repo@6
					
					
26.3.3.4.2. 带宽状态
					
[root@netkiller ~]# ipfs stats bw
Total Up    Total Down  Rate Up     Rate Down
Bandwidth
TotalIn: 20 MB
TotalOut: 4.9 MB
RateIn: 4.4 kB/s
RateOut: 3.4 kB/s
					
					

26.3.4. 网络命令

26.3.4.1. 显示 IPFS 信息

				
[ipfs@netkiller ~]$ ipfs id
{
	"ID": "QmZakCF5czhP53KPvMi8XQcYtVrQohw5N71Xce4eC1rWz3",
	"PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDYWmvcJrJsIjgP+n/EwZyLify7KgZ3SnIrsN9k2z9iF1X9uq9tebH1Dx6tPFIoBndYCvZlrdafHkbL5XRjJ0j0W2ISVKC75I+u9bS4WHSD7gPI82AdlWEp6elL5Muw7DnyN8flOQyxtJqhjkMY5pSnCcLXuOmXZJ2YY+4jZSQ58QmsA17wLcn01so4impSOxjDkjuOuday9SxK5vmstq9Qp/h2neyUsDtx1+q0M0kjlkInRtfXCmtd14EHqcv4VgG+aCcF8UuWgNXBTLc/R5xqtxFx8KacWjf5xUOe7Sjat7tgaY5eBOphupy5zzXfP2YigTY0cz5jIKkPoFK+lppjAgMBAAE=",
	"Addresses": null,
	"AgentVersion": "go-ipfs/0.4.14/",
	"ProtocolVersion": "ipfs/0.1.0"
}
				
				

26.3.4.2. 节点

				
[ipfs@netkiller ~]$ ipfs bootstrap list
/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM
/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64
/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu
/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd
/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu
/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM
/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64
/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd
				
				

26.3.4.3. 管理P2P网络链接

				
[root@netkiller ~]# ipfs swarm peers
/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
				
				

26.3.5. 工具命令

26.3.5.1. 配置

				
"StorageMax": "10GB"	存储空间配额,默认为 10G
				
				
26.3.5.1.1. 显示配置
					
[ipfs@netkiller ~]$ ipfs config show
{
  "API": {
    "HTTPHeaders": {
      "Server": [
        "go-ipfs/0.4.14"
      ]
    }
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ]
  },
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
    "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
    "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
    "/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
    "/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
    "/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
    "/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
    "/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"
  ],
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true,
      "Interval": 10
    }
  },
  "Experimental": {
    "FilestoreEnabled": false,
    "Libp2pStreamMounting": false,
    "ShardingEnabled": false
  },
  "Gateway": {
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "PathPrefixes": [],
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "QmZakCF5czhP53KPvMi8XQcYtVrQohw5N71Xce4eC1rWz3"
  },
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "all"
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {
      "GracePeriod": "20s",
      "HighWater": 900,
      "LowWater": 600,
      "Type": "basic"
    },
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "DisableRelay": false,
    "EnableRelayHop": false
  }
}
					
					
26.3.5.1.2. 修改配置
				
[ipfs@netkiller ~]$ export EDITOR=/usr/bin/vim
[ipfs@netkiller ~]$ ipfs config edit

{
  "Identity": {
    "PeerID": "QmZakCF5czhP53KPvMi8XQcYtVrQohw5N71Xce4eC1rWz3",
    "PrivKey": "CAASpwkwggSjAgEAAoIBAQDYWmvcJrJsIjgP+n/EwZyLify7KgZ3SnIrsN9k2z9iF1X9uq9tebH1Dx6tPFIoBndYCvZlrdafHkbL5XRjJ0j0W2ISVKC75I+u9bS4WHSD7gPI82AdlWEp6elL5Muw7DnyN8flOQyxtJqhjkMY5pSnCcLXuOmXZJ2YY+4jZSQ58QmsA17wLcn01so4impSOxjDkjuOuday9SxK5vmstq9Qp/h2neyUsDtx1+q0M0kjlkInRtfXCmtd14EHqcv4VgG+aCcF8UuWgNXBTLc/R5xqtxFx8KacWjf5xUOe7Sjat7tgaY5eBOphupy5zzXfP2YigTY0cz5jIKkPoFK+lppjAgMBAAECggEAEA6l8rDsjRn9DzKISRIVjEWxfDKiSDg+QP/flJyxF5ajyzEP1BA0JPv6SuEvN8lDEkW+A83jH+wfVQKyoKlJwNkHblTZmRhdkZ6qywPFogUIQuHNQGTV0UaLChbxBzCBHHkHXPve9VFyKItmb3Ktlbgjvd77d0EAcU75XackCSi3mQkm73w+9YquTlJtIcpE9RX5k4ZRrdbY3waGd5ZzGCpzUeok009wbpPOxKBObyUdzSEhLRDS5gExwGRP8hGdxpU3Er1x6A+ojEkG3vjqCk/FoUiNyUXADKzLifjFDqFD8Ek4jIdM712YB2F8ERfVQo/AIt3c06Gzbc+DSXJ4AQKBgQD00k08k68bHF63NsD9qbfIY8iSge6D6k7h1USVRoQcGzeZsMHmSBUNr+sWH+nV8NZSOiej/KLoZcVlHhjqUouajZj2Ej7X4BCWF9TYt1DsKAjCOwqImmbSoISMZWtnWuqhemI1d+dEkOaYFL2oiqmGjx00Vo5eY9DaX9zRpREuzQKBgQDiO1swOPWAb4pl5s0IOc6/kOWFLnvkP8efM/tdwv3NYwq2iwurfGG395jCc35XcAlccIvsXoJ1+mGzaGeZu5ppSRKu2Vqg5YOVxSzBeoBRxl//KK2+wOwrHaEgIbN9vcjBZVYKR87VdwLJb4PlnaSyZac71ZQMjNzo0UsGhdmN7wKBgDoHdwM6xjCY4uJuegQmLEe1Tx9a6Nwft57T3DO9ySaYVO969BrPTx41anWODvEE6ugGnMrD4SFQrh8vqRwxgKGbmnwJCxhEJepNr8fGe8neG2VedTq3zlNydLiKeZC//glUZt7hktGvvtihYesHIvOgDH4RXiGFa0W3nzGZ/J6pAoGAZSEDclsD45X41/SEUtkEgr3S2+Ybm7ynD5O9GfzAV7+eWlttrAq94+7aapIWOB/tD1WANvlIeFSkt/5D0YT7UXVI1MB0stfmKl0p1JNeKS/0Watlf4/eAqgMDsEB64Oa6ljSTWYsH2BD7qfa3hnKNbUbPLQMqk+NsMVeNFxBFCECgYEA0l9L2nLelP/osGt2iQ1yRlAQ/EdaiHe9/RE3f+EQ2tFkGDw0sj8eC/vvLhrh9fDRco46bt3Jw5JGEfW+cJ/9u7ULvsAiWiMes0ENqGu0GE/yLD0guFrPdSJfzlWS5+mVxxOXMyHnp5xo0Vz5A3aoGt3Lq0neaKZAYXRwYkxcQd8="
  },
  "Datastore": {
    "StorageMax": "10GB",
    "StorageGCWatermark": 90,
    "GCPeriod": "1h",
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
			
				
					

26.3.5.2. 命令列表

				
[root@netkiller ~]# ipfs commands
ipfs
ipfs add
ipfs bitswap
ipfs bitswap ledger
ipfs bitswap reprovide
ipfs bitswap stat
ipfs bitswap unwant
ipfs bitswap wantlist
ipfs block
ipfs block get
ipfs block put
ipfs block rm
ipfs block stat
ipfs bootstrap
ipfs bootstrap add
ipfs bootstrap add default
ipfs bootstrap list
ipfs bootstrap rm
ipfs bootstrap rm all
ipfs cat
ipfs commands
ipfs config
ipfs config edit
ipfs config profile
ipfs config profile apply
ipfs config replace
ipfs config show
ipfs daemon
ipfs dag
ipfs dag get
ipfs dag put
ipfs dag resolve
ipfs dht
ipfs dht findpeer
ipfs dht findprovs
ipfs dht get
ipfs dht provide
ipfs dht put
ipfs dht query
ipfs diag
ipfs diag cmds
ipfs diag cmds clear
ipfs diag cmds set-time
ipfs diag sys
ipfs dns
ipfs file
ipfs file ls
ipfs files
ipfs files chcid
ipfs files cp
ipfs files flush
ipfs files ls
ipfs files mkdir
ipfs files mv
ipfs files read
ipfs files rm
ipfs files stat
ipfs files write
ipfs filestore
ipfs filestore dups
ipfs filestore ls
ipfs filestore verify
ipfs get
ipfs id
ipfs init
ipfs key
ipfs key gen
ipfs key list
ipfs key rename
ipfs key rm
ipfs log
ipfs log level
ipfs log ls
ipfs log tail
ipfs ls
ipfs mount
ipfs name
ipfs name publish
ipfs name pubsub
ipfs name pubsub cancel
ipfs name pubsub state
ipfs name pubsub subs
ipfs name resolve
ipfs object
ipfs object data
ipfs object diff
ipfs object get
ipfs object links
ipfs object new
ipfs object patch
ipfs object patch add-link
ipfs object patch append-data
ipfs object patch rm-link
ipfs object patch set-data
ipfs object put
ipfs object stat
ipfs p2p
ipfs p2p listener
ipfs p2p listener close
ipfs p2p listener ls
ipfs p2p listener open
ipfs p2p stream
ipfs p2p stream close
ipfs p2p stream dial
ipfs p2p stream ls
ipfs pin
ipfs pin add
ipfs pin ls
ipfs pin rm
ipfs pin update
ipfs pin verify
ipfs ping
ipfs pubsub
ipfs pubsub ls
ipfs pubsub peers
ipfs pubsub pub
ipfs pubsub sub
ipfs refs
ipfs refs local
ipfs repo
ipfs repo fsck
ipfs repo gc
ipfs repo stat
ipfs repo verify
ipfs repo version
ipfs resolve
ipfs shutdown
ipfs stats
ipfs stats bitswap
ipfs stats bw
ipfs stats repo
ipfs swarm
ipfs swarm addrs
ipfs swarm addrs listen
ipfs swarm addrs local
ipfs swarm connect
ipfs swarm disconnect
ipfs swarm filters
ipfs swarm filters add
ipfs swarm filters rm
ipfs swarm peers
ipfs tar
ipfs tar add
ipfs tar cat
ipfs update
ipfs version