[Manual] Alaya Network 0.16.3 (Opportunity) Version Upgrade Operation Manual |【手册】Alaya网络0.16.3(机遇Opportunity)版本升级操作手册

中文

版本信息

ChainID: 201018

Version: 0.16.3

Git Commit: 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3

二进制下载:https://download.alaya.network/alaya/platon/0.16.3/alaya

1. 升级步骤说明

​ 若Alaya节点是0.16.1或0.16.2版本,请跳到第3点直接进行更新操作。

  • 0.16.1的版本信息

    $ alaya version
    Version: 0.16.1-unstable
    Git Commit: 76b3b19b70d6c9a7f0dcc3119471613e3c84dc24
    
  • 0.16.2的版本信息

    $ alaya version
    Version: 0.16.2-unstable
    Git Commit: 430aecb60a61a10613835f4f014f0ecb5a72af5c
    

2. 升级注意事项

​ 这是节点从0.16.0直接升级到0.16.3的注意事项。

2.1 CPU、内存和磁盘问题

​ 升级过程中部分历史数据会做迁移至Freezer数据库,cpu会有所增加,数据迁移完成恢复正常;升级重启后,少数会有内存增加的情况,数据迁移完成后恢复正常;升级后存储也会有部分提升(大约增加11G)。详细查看Github releases

  • 升级内存

    8G内存的节点在升级重启的过程中小概率会出现内存增加,导致OOM,为了避免这种情况,建议使用swap分区,若有条件也可以选择将机器物理内存升级到16GB。

    增加swap分区

    wget https://download.alaya.network/alaya/scripts/alaya_swap.sh
    chmod +x alaya_swap.sh
    ./alaya_swap.sh 
    

    注意

    1. 文档提供的alaya_swap.sh 脚本做以下处理:当swap分区不存在,则创建8G的swap分区;当swap分区小于7G,会增加swap分区到8G;当swap分区大于7G,则不创建swap分区。

    2. 若不升级主机内存进行节点升级,出现OOM的情况,导致机器无法连接上;重启主机机器后,可恢复启动进程

  • 扩容磁盘

    升级过程中,磁盘容量有所增加约11G,若磁盘可用容量不足,建议扩容磁盘容量。

2.2 不兼容性问题

​ 本次节点升级后,不能使用0.16.0的版本和升级后的数据进行启动,建议升级前,先下载官方提供的最新版本(0.16.3)节点数据,存放在节点主机上,若节点升级后不能启动,直接使用0.16.3的版本和最新版本节点数据来启动。

  • fast模式备份数据,数据大小是24G的,块高是38983009,当节点启动失败,使用该数据替换data/platon目录

    wget https://download.alaya.network/alaya/nodedata/0.16.3-fast-data.tar.gz
    tar -xf 0.16.3-fast-data.tar.gz
    

3. 更新指南(先更新,暂不重启)

​ 以下步骤以 Ubuntu18.04 系统为例,更新操作分为两种方式:直接使用二进制源码编译,选其中一种方式更新即可;请严格按照以下步骤操作升级,如有需要帮助请联系客服。

  • 直接用二进制

    # 备份二进制
    $ [[ -x /usr/bin/alaya ]] && sudo mv /usr/bin/alaya /usr/bin/alaya_`alaya version | grep '^Version:' | awk -F "[ ,:,-]" '{print $3}'`
    # 下载最新的二进制文件
    $ wget https://download.alaya.network/alaya/platon/0.16.3/alaya
    # 使用新的alaya版本
    $ chmod +x alaya
    $ sudo mv alaya /usr/bin/alaya
    # 查看版本
    $ alaya version
    Version: 0.16.3-unstable
    Git Commit: 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3
    
  • 源码编译(针对之前已成功编译过的环境,全新编译请参考官网

    # 备份二进制
    $ [[ -x /usr/bin/alaya ]] && sudo mv /usr/bin/alaya /usr/bin/alaya_`alaya version | grep '^Version:' | awk -F "[ ,:,-]" '{print $3}'`
    # 编译二进制
    $ git clone https://github.com/AlayaNetwork/Alaya-Go.git --recursive
    $ cd Alaya-Go 
    $ git fetch --all
    $ git checkout -b alaya-0.16.3 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3
    # 安装依赖和编译,如果出现missing go.sum entry for module,使用go mod tidy移除未使用和添加缺失的依赖
    $ go mod download && make all
    # 使用新的alaya版本
    $ chmod +x build/bin/alaya
    $ sudo mv build/bin/alaya /usr/bin/alaya
    # 查看版本
    $ alaya version
    Version: 0.16.3-unstable
    Git Commit: 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3
    

4. 择机重启进程

​ 如果当前节点质押过,首先通过区块链浏览器查看节点是否已经被选为验证人(共识中)
如果已经当选,请等待节点退出验证人(共识中转为活跃中)后再进行重启进程操作。

可根据各自管理方式停止和启动节点;以下命令仅做参考,先查看进程号,停止alaya节点,再使用以下命令启动alaya进程

# 查看进程号
$ ps aux |grep alaya
root   3476 39.1 49.7 9174616 3925796 ?     Sl   Feb07 1140:19 /usr/bin/alaya  --identity ....

# 停止alaya节点,如kill 3476,上述示例中进程号为3476,实际操作时根据实际情况取值;执行kill命令后,可再使用上述ps命令查看进程是否正确退出,若正常退出再执行后续启动命令
$ kill <进程号>

# 启动alaya节点
$ nohup alaya --identity alaya-node --datadir ./data --port 16789  --rpcport 6789 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodekey ./data/nodekey --cbft.blskey ./data/blskey --verbosity 1 --rpcaddr 127.0.0.1 --syncmode "fast" > ./data/platon.log 2>&1 &

# 重启后进入控制台检查节点版本是否生效:v0.16.3-unstable-3cc9c754-20220126
$ alaya attach http://localhost:6789
Welcome to the Alaya JavaScript console!
instance: AlayaNetwork/alaya/v0.16.3-unstable-3cc9c754-20220126/linux-amd64/go1.16.8

5. 版本声明

​ 当版本声明后,可在浏览器查看节点版本

alaya_mtool declare_version --keystore $ALAYA_MTOOLDIR/keystore/staking.json --config $ALAYA_MTOOLDIR/validator/validator_config.json
  • 未质押过的节点,跳过本步骤。
  • 没定义$ALAYA_MTOOLDIR的,需要根据实际部署情况补全绝对路径。

6. 反馈

​ alaya升级失败的,可通过以下渠道反馈。

  1. 微信 Colinan
  2. 微信 验证节点群
  3. 邮箱 validator@platon.network

English

Version Info

ChainID: 201018

Version: 0.16.3

Git Commit: 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3

Binary Document: https://download.alaya.network/alaya/platon/0.16.3/alaya

1. Upgrade Instruction

​ ​ If you are using the 0.16.1 or 0.16.2 version, please jump to Step 3 for the upgrade.

  • Version 0.16.1 Info

    $ alaya version
    Version: 0.16.1-unstable
    Git Commit: 76b3b19b70d6c9a7f0dcc3119471613e3c84dc24
    
  • Version 0.16.2 Info

    $ alaya version
    Version: 0.16.2-unstable
    Git Commit: 430aecb60a61a10613835f4f014f0ecb5a72af5c
    

2. ** Upgrade Notice**

​ The following notices are for the upgrade from 0.16.0 to 0.16.3.

2.1 About CPU, RAM, and Disk


​ During the upgrade, part of the historical data will be migrated to the Freezer database. This will take up more CPU utility, which will return to normal upon completed data migration. When your device is rebooted after the upgrade, in rare cases, you may experience increased RAM use, which will also normalize once the data is migrated. The upgrade will also occupy more storage by about 11GB. For more details, please refer to Github releases.

  • RAM upgrade
    During the upgrade and rebooting process, there is a small chance that validators using 8GB RAMs will suffer OOM due to the increased RAM use. To avoid the potential OOM, we recommend creating a swap partition or upgrading to 16GB RAM (if possible).

    Add a swap partition

    wget https://download.alaya.network/alaya/scripts/alaya_swap.sh
    chmod +x alaya_swap.sh
    ./alaya_swap.sh 
    

    Notice:

    1. The ‘alaya_swap.sh’ script provided in the document will carry out the following process: Where there is no swap partition, the script will create an 8GB swap partition; where the swap partition is smaller than 7GB, the script will expand it to 8GB; where the swap partition is larger than 7GB, the script will remain inactive.
    2. Validators who carried out the upgrade without expanding their RAM could experience OOM, which will result in connection failures. For such users, the activation process will resume once their device is rebooted.
  • Disk expansion
    The upgrade will take up 11GB additional disk space; where the storage is insufficient, we recommend expanding the disk capacity.

2.2 Incompatibility

​ After the present validator upgrade, you can no longer use the 0.16.0 version and the upgraded data for activation. Validators are advised to download the node data of the latest version (0.16.3) we provided and have the data stored on their validator PC before the upgrade. In case of failed activation after the upgrade, you will need to use the 0.16.3 version and the data of the latest version for activation.

  • The fast model backup data is 24GB big, at the block height of 38983009. In case of failed activation, the backup data should be used to replace the data/platon directory.

    wget https://download.alaya.network/alaya/nodedata/0.16.3-fast-data.tar.gz
    tar -xf 0.16.3-fast-data.tar.gz
    

3. Upgrade Instructions (upgrade without rebooting)

​ The following instructions are based on the Ubuntu18.04 system. You could complete the upgrade directly through the binary document or source code compiling. Please carry out the upgrade in strict accordance with the following procedures. If you need any help, feel free to reach out to us through our customer service.

  • Directly activate the binary document

    # Make a binary backup
    $ [[ -x /usr/bin/alaya ]] && sudo mv /usr/bin/alaya /usr/bin/alaya_`alaya version | grep '^Version:' | awk -F "[ ,:,-]" '{print $3}'`
    

Download the latest binary document

$ wget https://download.alaya.network/alaya/platon/0.16.3/alaya

Use the latest version of alaya

chmod +x alaya sudo mv alaya /usr/bin/alaya

Check the version

$ alaya version
Version: 0.16.3-unstable
Git Commit: 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3


- **Source code compiling** The following is for previously complied environments. For new compiling, please refer to our [official website] (https://devdocs.alaya.network/alaya-devdocs/zh-CN/Install_Alaya/)
```bash
# Make a binary backup
$ [[ -x /usr/bin/alaya ]] && sudo mv /usr/bin/alaya /usr/bin/alaya_`alaya version | grep '^Version:' | awk -F "[ ,:,-]" '{print $3}'`
# Compile the binary document
$ git clone https://github.com/AlayaNetwork/Alaya-Go.git --recursive
$ cd Alaya-Go 
$ git fetch --all
$ git checkout -b alaya-0.16.3 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3
# Install the dependency library and compiler. In case of missing go.sum entry for module, please use go mod tidy to remove unused dependencies and add the missing ones.
$ go mod download && make all
# Use the latest version of alaya
$ chmod +x build/bin/alaya
$ sudo mv build/bin/alaya /usr/bin/alaya
# Check the version
$ alaya version
Version: 0.16.3-unstable
Git Commit: 3cc9c754fb9d56afd5200edb7d6e8d4a0e8a7dc3

4. When to Reboot the Alaya Process

​ If the present node has staked before, please check whether it has been selected as a validator (Verifying) on the [Alaya Blockchain Explorer] (https://scan.alaya.network/node).
If so, please reboot the alaya process after the node exits from the validator model (switch from Verifying to Active)

You can deactivate/activate the node following your own management process, and the command below is for reference only. Validators should first check the process ID and then deactivate the alaya node. Next, the alaya process should be rebooted using the following command.

# Check the process ID
$ ps aux |grep alaya
root   3476 39.1 49.7 9174616 3925796 ?     Sl   Feb07 1140:19 /usr/bin/alaya  --identity ....

# Deactivate the alaya node. For instance, in the example above (kill 3476), the process ID is 3476, and the ID will differ in real operation. Upon execution of the kill command, you can then check whether the process is properly ended using the ps command above. The subsequent activation command should be executed only in the event of a normal exit.

$ kill <process ID>
# Activate the alaya node
$ nohup alaya --identity alaya-node --datadir ./data --port 16789  --rpcport 6789 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodekey ./data/nodekey --cbft.blskey ./data/blskey --verbosity 1 --rpcaddr 127.0.0.1 --syncmode "fast" > ./data/platon.log 2>&1 &

# Enter the Alaya JavaScript console to check whether the node is using the latest version: v0.16.3-unstable-3cc9c754-20220126
$ alaya attach http://localhost:6789
Welcome to the Alaya JavaScript console!
instance: AlayaNetwork/alaya/v0.16.3-unstable-3cc9c754-20220126/linux-amd64/go1.16.8

5. Version Statement

​ You could check the validator version on the Alaya Blockchain Explorer after the version statement is released.

alaya_mtool declare_version --keystore $ALAYA_MTOOLDIR/keystore/staking.json --config $ALAYA_MTOOLDIR/validator/validator_config.json
  • Validators who never staked before should skip this procedure.
  • Where $ALAYA_MTOOLDIR is not defined, the absolute path should be completed according to the actual deployment.

6. Feedback

​ If your alaya upgrade failed, please provide us feedback in the following channels.

  1. WeChat: Colinan
  2. WeChat validator group
  3. Email: validator@platon.network
1 个赞