系统:Debian10
Algorand版本:2.3.0.stable
系统配置:4核 8G内存 320G硬盘
节点总块大小为180G
同步时间:3天
安装节点
https://developer.algorand.org/docs/run-a-node/setup/install/#start-node
sudo apt-get update sudo apt-get install -y gnupg2 curl software-properties-common curl -O https://releases.algorand.com/key.pub sudo apt-key add key.pub sudo add-apt-repository "deb https://releases.algorand.com/deb/ stable main" sudo apt-get update # To get both algorand and the devtools: sudo apt-get install -y algorand-devtools algod -v
安装后节点自动运行,goal node status -d /var/lib/algorand
查看同步进度
修改配置文件
https://developer.algorand.org/docs/reference/node/config/
cd /var/lib/algorand cp config.json.example config.json vim config.json ##### Archival:true # 存档模式,下载所有区块 CatchupFailurePeerRefreshRate:100 # 失败重试次数 CatchupParallelBlocks:256 # 多线程,加速下载,会增加系统负担 IncomingMessageFilterBucketCount:128 IncomingMessageFilterBucketSize:512 ##### #修改上述参数之后重启algorand服务 sudo systemctl restart algorand
安装indexer
indexer需要单独安装,可以加速查询区块信息的速度
indexer本质上就是枚举每个区块的信息,提取需要的内容存入单独的postgresql database,假如100G的区块大小,通过indexer提取出来的1G大小的内容,所以查询速度会显著提升(上述内容是官网提到的,可能文档久未更新,实际上最新版本的indexer压缩率大概在50%,即若块大小100G则indexer提取50G内容,合计需要150G磁盘空间)
https://github.com/algorand/indexer
#下载地址:https://github.com/algorand/indexer/releases wget https://github.com/algorand/indexer/releases/download/2.2.1/algorand-indexer_2.2.1_amd64.deb sudo dpkg -i algorand-indexer*.deb
创建用户和数据库
https://www.postgresql.org/download/linux/debian/
(貌似debian默认自带postgresql,我安装完才看到
sudo su - postgres #进入控制台 psql #创建用户 CREATE USER uindexer WITH PASSWORD 'upassword'; #创建数据库 CREATE DATABASE dbindexer OWNER uindexer; GRANT ALL PRIVILEGES ON DATABASE dbindexer to uindexer;
启动indexer
# 第一次运行需枚举区块,时间很长,后台运行 nohup algorand-indexer daemon --algod-net localhost:8080 -d /var/lib/algorand --genesis /var/lib/algorand/genesis.json --server 0.0.0.0:8980 --postgres "user=uindexer password=upassword dbname=dbindexer" --algod-token utoken & # upassword utoken 自行修改 # 查看进度 tail nohup.out #等同步完成可以使用以下命令测试 curl localhost:8980/transactions -H "X-Indexer-API-Token: your-token"
0 条评论