-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
CentOS 下使用源码安装 Asch 节点
系统: CentOS 7.4
一、安装依赖
yum install curl sqlite3 ntp wget git libssl-dev openssl make gcc g++ autoconf automake python build-essential gcc-c++ -y
yum install libtool -y
安装 node.js 推荐使用V8.x.x 版本
# Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
# This loads nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Install node and npm for current user.
nvm install v8
# check node version and it should be v8.x.x
node --version
二、下载源码并安装
2.1 克隆源码到本地
git clone https://github.com/AschPlatform/asch
git checkout v1.4.6 // 切换到1.4.6版本,也可以根据需要切换到其他版本
2.2 安装依赖
npm install
备注: 此处依赖较多,可能需要较长时间
2.3 创建依赖目录
mkdir -p public/dist
mkdir chains
2.4 配置网页客户端
cd public/dist
wget http://china.aschcdn.com/frontend-mainnet-5f5b3cf5.zip
unzip frontend-mainnet-5f5b3cf5.zip
2.5 下载快照并解压
cd ~
wget http://china.aschcdn.com/blockchain-mainnet-snapshot.tar.gz
tar zvxf blockchain-mainnet-snapshot.tar.gz
2.6 启动节点
cd asch
NET_VERSION=mainnet node app.js -g genesisBlock.json -c config-mainnet.json --data /root/data -p 7001 -a 172.26.138.86 -d
三、常见错误处理
3.1 无法重启
报Asch server has already started,请删除 asch 目录下的asch.pid,再重新启动。
3.2 无法同步区块(卡块)
对比自己节点区块高度和最新区块高度。最新区块高度:https://wallet.asch.cn/api/blocks/getHeight。 如果发现自己节点的高度一直落后且不增长,可以断定为自己的节点没有同步区块。
解决方法:
- 升级到最新版本并重启
./aschd upgrade
./aschd start
- 重建
./aschd rebuild
四、节点升级
在安装完节点以后,后续节点的升级可以通过简单的./aschd upgrade来完成,不必重复安装。
进入 asch 目录执行命令:
./aschd upgrade
./aschd start
五、常用命令
# 启动节点
./aschd start
# 停止节点
./aschd stop
# 查看节点运行状态
./aschd status
# 重启节点
./aschd restart
# 升级节点
./aschd upgrade
# 重新同步区块
./aschd rebuild
# 查看节点版本
./aschd version
# 开启区块生产(仅供受托人使用)
./aschd enable "your sercret"
# 查看log
tail -f logs/debug.201xxxxx.log
Metadata
Metadata
Assignees
Labels
No labels