IPFS搭建&集群
下载go-ipfs
wget https://github.com/ipfs/go-ipfs/releases/download/v0.4.17/go-ipfs_v0.4.17_linux-amd64.tar.gz
解压
[root@blockchain42 ipfs]# tar -zxvf go-ipfs_v0.4.17_linux-amd64.tar.gz
go-ipfs/build-loggo-ipfs/install.shgo-ipfs/ipfs
go-ipfs/LICENSE
go-ipfs/README.md
执行insatll.sh
[root@blockchain42ipfs]# cd go-ipfs [root@blockchain42go-ipfs]# ./install.sh
Moved ./ipfs to/usr/local/bin
执行ipfs命令验证ipfs
root@blockchain42 go-ipfs]# ipfs
SUBCOMMANDS
BASIC COMMANDS
init Initialize ipfs localconfiguration
add <path> Add a filetoIPFS
cat <ref> Show IPFS object data
get<ref> Download IPFS objects
ls <ref> List links froman object
refs <ref> List hashes oflinks froman object DATA STRUCTURE COMMANDS
block Interact withraw blocks inthedatastore
object Interact withraw dag nodes
files Interact withobjects asifthey were a unix filesystem
dag Interact withIPLD documents (experimental) ADVANCED COMMANDS
daemon Start a long-runningdaemon process
mount Mount an IPFS read-only mountpoint
resolve Resolve any type ofnamenamePublish andresolve IPNS names
key Create andlistIPNS namekeypairs
dns Resolve DNS links
pin Pin objects tolocalstorage
repo Manipulate theIPFS repository
stats Various operational stats
p2p Libp2p stream mounting
filestore Manage thefilestore (experimental) NETWORK COMMANDS
idShow info aboutIPFS peers
bootstrap Add orremove bootstrap peers
swarm Manage connections tothep2p network
dht Query theDHT forvalues orpeers
ping Measure thelatency ofa connection
diag Print diagnostics TOOL COMMANDS
config Manage configuration
versionShow ipfs versioninformation
update Download andapply go-ipfs updates
commands List all available commands Use 'ipfs <command> --help' to learn more about each command.ipfs uses a repository inthelocalfilesystem. By default, therepo islocated at~/.ipfs. To change therepo location, setthe$IPFS_PATH
environment variable: export IPFS_PATH=/path/to/ipfsrepo EXIT STATUS The CLI will exitwithone ofthefollowing values: 0Successful execution. 1Failed executions.
创建data, export目录
[root@blockchain42ipfs]# mkdir data [root@blockchain42ipfs]# mkdir export
设置ipfs_path
[root@blockchain42 ipfs]# export IPFS_PATH=/data/ipfs/data
初始化ipfs
root@blockchain42 ipfs]# ipfs init initializing IPFS node at /data/ipfs/data
generating -bit RSA keypair...donepeer identity: Qmcu1qxojgYV84hfRvvUBBLQzDLKka7kaAu8PUZi4DJziE
togetstarted, enter: ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
修改配置文件
[root@blockchain42 data]# cd data [root@blockchain42 data]# vimconfig
删除Bootstrap中的内容防止链接外部节点"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//ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.236.179.241/tcp//ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
"/ip4/128.199.219.111/tcp//ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
"/ip4/104.236.76.40/tcp//ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
"/ip4/178.62.158.247/tcp//ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
"/ip6/:a880:::::d001/tcp//ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
"/ip6/:::d0:::/tcp//ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
"/ip6/:a880::::4a:/tcp//ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
"/ip6/2a03:b0c0:::::/tcp//ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"],
设置ipfs_staging 和 ipfs_data
[root@blockchain42 data1]# export ipfs_staging=/data/ipfs/export [root@blockchain42 data1]# export ipfs_data=/data/ipfs/data
docker 启动
[root@blockchain42 data1]# docker run -d --name ipfs_host --restart="always"--privileged=true -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs -p4001:-p127.0.0.::-p5001:5001ipfs/go-ipfs:latest
Unable tofindimage 'ipfs/go-ipfs:latest'locally
latest:Pulling from ipfs/go-ipfs
5497949500d2: Pull complete9cfd2e6d2b64: Pull complete8167893b973a:Pull complete0f61f69d653d: Pull complete8a98c133507f: Pull completee9bc9df9b0ba:Pull completeb5b58acfc7ee: Pull complete385a82e0ccbb:Pull completeDigest:sha256:31cc5713ef3e3e81bf868cbb56c19de2d15d661743d8b6077804dee26e929ac5
Status:Downloaded newer image foripfs/go-ipfs:latestWARNING: IPv4 forwarding isdisabled. Networking will not work.
e48224ac7e15ed3aab532b6a79d6077ab376a5a84c6a66b1f2444b0779271322
查看是否启动成功
[root@blockchain42 data1]# docker logs -f ipfs_host1
Changinguser toipfs
ipfs version 0.4.
Found IPFS fs-repo at /data/ipfs
Initializing daemon...
Swarm listening on /ip4/127.0.0.1/tcp/
Swarm listening on /ip4/172.17.0.6/tcp/
Swarm listening on /p2p-circuit/ipfs/QmdafoEj6roToSiACimBxUhgdTa46gNfsfsNEKcqY8A6oP
Swarm announcing /ip4/127.0.0.1/tcp/
Swarm announcing /ip4/172.17.0.6/tcp/
APIserver listening on /ip4/127.0.0.1/tcp/
Gateway (readonly)server listening on /ip4/127.0.0.1/tcp/
Daemon is ready
到这单节点ipfs安装启动完成、 以相同的步骤在另一台机器上在部署一套
查看节点信息
[root@blockchain40 ~]# docker exec ipfs_host
ipfs swarm peers/ip4/172.17.0.3/tcp//ipfs/QmUjD1DQwxfSVkac12mK74ozhe34eoxX7DoJTFev2NemFd
或者查看ipfs id
[root@blockchain40~]# docker exec ipfs_host
ipfs id{
"ID": "QmUdmCCbmt5cQzPZST7U5ceaVdoCiHe2ZpxHopce5gFoXp",
"PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC1u+LC40JsmMVMemNiRu7n9OEaiJDSh78WWgqzER3KuuUrBJDyO7FW/UG4jtT2hoPLpsfZtw0LsPO+LNQY6Je78AMYB6It0bQ9yLLI8crpYhIrPXdL9MxYi6E+ITiyz+64SVLlDbW/7q5xvMLr2jfQHTxrmBhkkULfqX0unBR3tm9AnhfN1Gwi+xrAYw1aZmN53cj2h12oWFZzLgd9XmWQtx5+32U+qECCfqQ9JnQVSy8LGKis3ZlgHSIg0m7upc3h7p/RQU1QWW4NHdW3KvSMB6QSIufUSc+rQ4rIz5QdWAv+iuXp89l2mialJbJ5sCHqyL6vCo/OHgkDPPOYlyx5AgMBAAE=",
"Addresses": [
"/ip4/127.0.0.1/tcp/4001/ipfs/QmUdmCCbmt5cQzPZST7U5ceaVdoCiHe2ZpxHopce5gFoXp",
"/ip4/172.17.0.2/tcp/4001/ipfs/QmUdmCCbmt5cQzPZST7U5ceaVdoCiHe2ZpxHopce5gFoXp"],
"AgentVersion": "go-ipfs/0.4.15/",
"ProtocolVersion": "ipfs/0.1.0"}
修改链接ip
/ip4/10.19.0.40/tcp/4001/ipfs/QmUdmCCbmt5cQzPZST7U5ceaVdoCiHe2ZpxHopce5gFoXp
添加peer
[root@blockchain42 ~]# docker exec ipfs_host ipfs swarm connect /ip4/10.19.0.40/tcp//ipfs/QmUdmCCbmt5cQzPZST7U5ceaVdoCiHe2ZpxHopce5gFoXp
connect QmUdmCCbmt5cQzPZST7U5ceaVdoCiHe2ZpxHopce5gFoXp success
测试
在一台上添加数据、另一台上去, 测试集群是否添加上
[root@blockchain40 export]# docker exec ipfs_host ipfs add /export/yangxingadded QmaKK2vxX4bGzXrnxdCuGBCBx6RAmez6TGtVXxE4c5QDst yangxing [root@blockchain42 ~]# docker exec ipfs_host ipfs cat QmaKK2vxX4bGzXrnxdCuGBCBx6RAmez6TGtVXxE4c5QDstasydfklsajdflkjsaldfjks
IPFS搭建&集群的更多相关文章
- ELK——Elasticsearch 搭建集群经验
本文内容 背景 ES集群中第一个master节点 ES slave节点 本文总结 Elasticsearch(以下简称ES)搭建集群的经验.以 Elasticsearch-rtf-2.2.1 版本为例 ...
- redis 一二事 - 搭建集群缓存服务器
在如今并发的环境下,对大数据量的查询采用缓存是最好不过的了,本文使用redis搭建集群 (个人喜欢redis,对memcache不感冒) redis是3.0后增加的集群功能,非常强大 集群中应该至少有 ...
- Hadoop化繁为简-从安装Linux到搭建集群环境
简介与环境准备 hadoop的核心是分布式文件系统HDFS以及批处理计算MapReduce.近年,随着大数据.云计算.物联网的兴起,也极大的吸引了我的兴趣,看了网上很多文章,感觉还是云里雾里,很多不必 ...
- Linux+.NetCore+Nginx搭建集群
本篇和大家分享的是Linux+NetCore+Nginx搭建负载集群,对于netcore2.0发布后,我一直在看官网的文档并学习,关注有哪些新增的东西,我,一个从1.0到2.0的跟随者这里只总结一句话 ...
- Redis 实战篇之搭建集群
Redis 集群简介# Redis Cluster 即 Redis 集群,是 Redis 官方在 3.0 版本推出的一套分布式存储方案.完全去中心化,由多个节点组成,所有节点彼此互联.Redis 客户 ...
- Nginx+Tomcat搭建集群,Spring Session+Redis实现Session共享
小伙伴们好久不见!最近略忙,博客写的有点少,嗯,要加把劲.OK,今天给大家带来一个JavaWeb中常用的架构搭建,即Nginx+Tomcat搭建服务集群,然后通过Spring Session+Redi ...
- 复制虚拟机vmware centos搭建集群节点过程中网络配置eth0和eth1遇到的问题以及NAT模式下虚拟机静态IP配置方法
在centos中安装完第一个虚拟机后,一般习惯通过克隆的方式创建其它虚拟机,开后vmware无法发现网卡信息,系统认为这是重新安装,所以重新创建了一个新的网卡叫eth1. 并且用IFCONFIG-a查 ...
- 用apache和tomcat搭建集群,实现负载均衡
型的企业应用每天都需要承受巨大的访问量,在着巨大访问量的背后有数台服务器支撑着,如果一台服务器崩溃了,那么其他服务器可以使企业应用继续运行,用户对服务器的运作是透明化的,如何实现这种透明化呢?由如下问 ...
- 使用Nginx在windows和linux上搭建集群
Nginx Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器 特点:反向代理 负载均衡 动静分离… 反向代理(Reverse Pro ...
随机推荐
- 编译内核出现"mkimage" command not found - U-Boot images will not be built
参考链接: http://spyker729.blogspot.com/2010/07/mkimage-command-not-found-u-boot-images.html 制作uImage的工具 ...
- HDU1717--小数化分数2
这道题是将输入的小数(有可能是无限循环小数)来化为分数.刚開始看到以为枚举(千万不要嘲笑我),可是感觉不正确. 所以百度了小数化为分数的方法,然后看到了各种方法,原来是这这样,在这我採用的是小数化为分 ...
- hdu 4928 Series 2 (优化+模拟)
题意: 一个含n个数的序列a,每两个相邻的数相减得到一个新数,这些数组成一个新的序列. 假设全部得到的序列都满足非严格的单调性.则原序列为nice series.假设给出的序列 本来不满足单调性.它是 ...
- SQL在oracle和SQLserver将查询结果创建为新表的不同之处
------在SQL中,将查询的结果创建为新表是如下这样的 select distinct t1.column1,.t2.column2 into table3 from table1.t1 join ...
- hrbustoj 1104:Leyni, LOLI and Line(解析几何,斜截式的应用)
Leyni, LOLI and Line Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 181(54 users) Tota ...
- Linux Kernel 4.7版本发布
导读 在经历了长达一周的惬意假日时光,大神Linus Torvalds宣布面向所有GNU/Linux操作系统发布Linux Kernel 4.7.Linux 4.7内核的研发历经2个多月,自今年5月2 ...
- [分享] 关于App Store下载到一半发生错误的问题 [复制链接]
问题:昨天发现Pages无法更新,结果卸载在App Store里重新下载.下载到快结束的时候,提示“发生错误”,同时提示“在‘已购’中再试一次”.结果在已购中,Pages显示的是安装按钮,点击安装,显 ...
- iOS消息推送证书创建过程
iOS消息推送证书创建过程 一.创建证书请求 1.在mac上进行钥匙串访问(keychain) 2. 选择钥匙串访问>证书助理> 从证书颁发机构中请求一个证书,如图1所示 图1 3.输入你 ...
- Android 全局异常处理(一)
from:http://onewayonelife.iteye.com/blog/1147533 from:http://blog.csdn.net/liuhe688/article/details/ ...
- mysql用sql创建表完整实例
create table user_login_latest( id int(11) unsigned NOT NULL AUTO_INCREMENT, user_id int(11) not nul ...