赞
踩
- ipfs init initializing IPFS node at /Users/CHY/.ipfs generating 2048-bit RSA keypair...done peer identity: QmdKXkeEWcuRw9oqBwopKUa8CgK1iBktPGYaMoJ4UNt1MP to get started, enter:
-
- ipfs cat /ipfs/QmVLDAhCY3X9P2uRudKAryuQFPM5zqA3Yij1dY8FpGbL7T/readme
-
- cd /.ipfscd ~/.ipfscd /.ipfs ls blocks datastore version config keystore $ open ./



使用如下命令,进行简单测试
ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme

UI界面
ipfs节点默认存储空间为10个G
export EDITOR=/usr/bin/vim ipfs config edit
i可以开始编辑,编译完毕后按esc键,再输入:,再次输入wq保存并且退出
默认模式,块的大小是256kb,也就是256 * 1024 bytes,对应的size=262144。命令不需要加参数,即ipfs add 文件。
指定块大小模式。命令是ipfs add --chunker=size-1000。其中后边的1000可以是任意小于262144的数。
rabin可变块大小切割模式。命令是ipfs add --chunker=rabin-[min]-[avg]-[max] 文件。其中min,avg,max的值分别值最小块大小,平均块大小,最大块大小的意思,值在小于262144自行设定。
The chunker option, '-s', specifies the chunking strategy that dictates how to break files into blocks. Blocks with same content can be deduplicated. The default is a fixed block size of 256 * 1024 bytes, 'size-262144'. Alternatively, you can use the rabin chunker for content defined chunking by specifying rabin-[min]-[avg]-[max] (where min/avg/max refer to the resulting chunk sizes). Using other chunking strategies will produce different hashes for the same file.
ipfs add ipfs-logo.svg ipfs add --chunker=size-2048 ipfs-logo.svg ipfs add --chunker=rabin-512-1024-2048 ipfs-logo.svg

如上图,测试了一个6.8K的文件存储,存储设定1024B为一个分片,分片完后,可以查到这个文件分为了7个分片。

-o 文件名,也可以加上-a : 压缩成.tar格式,-C :压缩成.gz格
ipfs get QmZJBKrLFPvn8zEatZsxSJTtJkCFm4YeMwChDLRPPPerZ6 -o 1.pdf







如果上传的是一个文件夹,那么将文件夹拉回到本地,里面的文件是正常的存储格式,无需进行格式转化

进入web可视化界面,将哈希序列输入到搜索框,进行文件的查询,如果文件不支持预览,需要点击downloading进行下载查看



而且,这两个节点之间还不能互相交换文件,不隶属于同一个集群。

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。