18
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

nemAdvent Calendar 2021

Day 4

NIS1に委任している状態でノードを再起動してみる検証

Posted at

概要

非テック勢にとっても参考になるかと思い、NIS1に委任している状態でノードを落とすとどのような挙動になるのかを検証してみました。

環境

OS : CentOS8.3
アドレス : nis1.harvesting-sweet-potatoes.club
source : https://github.com/NemProject/nem-docker

事前準備

  • NIS1ノードを構築する
  • 最新まで同期しておく
  • NEM Walletを用意する
  • 既得バランスを10000XEM以上にしておく

作業内容

ノードに委任する

ウォレットから委任する。

image.png

委任状況の確認。50枠のうち1枠委任されている状態。

$ curl -s -X POST http://nis1.harvesting-sweet-potatoes.club:7890/account/unlocked/info | jq
================================================
{
  "max-unlocked": 50,
  "num-unlocked": 1
}
================================================

サービス停止

$ ./stop.sh
================================================
mynem_container
================================================

$ docker ps -a
================================================
CONTAINER ID IMAGE       COMMAND                 CREATED     STATUS              PORTS   NAMES
775283820f47 mynem_image "/usr/bin/supervisord"  11 days ago Exited (137) 27 seconds ago mynem_container
================================================

ハーベスティングが無効になる

image.png

サービス起動

$ ./boot.sh
================================================
Sending build context to Docker daemon  131.6kB
Step 1/18 : FROM fedora:25
 ---> 9cffd21a45e3
...
chown: changing ownership of 'nem/nis-stderr.log.3': Operation not permitted
chown: changing ownership of 'nem/nis-stdout.log': Operation not permitted
chown: changing ownership of 'nem/nis-stderr.log.9': Operation not permitted
================================================

権限エラー対応

$ sudo chown ftakao2007:ftakao2007 nem/nis-std*log*
$ ./boot.sh
================================================
Sending build context to Docker daemon  131.6kB
Step 1/18 : FROM fedora:25
 ---> 9cffd21a45e3
...
+ set +x
Starting NIS
unix:///etc/supervisor.sock no such file
All done, here are the services running:

ncc                              STOPPED   Not started
nis                              STOPPED   Not started
perms                            STARTING
servant                          STOPPED   Not started


--------------------------------------------------------------------------------
You can control both services named 'ncc' and 'nis' with the script ./service.sh
run ./service.sh without argument to get help

You can access the supervisord control shell with ./supervisorctl.sh
--------------------------------------------------------------------------------
================================================

nisが立ち上がっていないので別途起動

$ ./service.sh start nis
================================================
nis: started
================================================

$ ./service.sh status
================================================
ncc                              STOPPED   Not started
nis                              RUNNING   pid 30, uptime 0:00:37
perms                            RUNNING   pid 21, uptime 0:01:39
servant                          STOPPED   Not started
================================================

ノードの状況確認

height以外は同期が最新に追いつくまでは確認できない。

$ curl -s http://nis1.harvesting-sweet-potatoes.club:7890/chain/height | jq
================================================
{
  "height": 777490
}
================================================

$ curl -s http://nis1.harvesting-sweet-potatoes.club:7890/node/info | jq
================================================
{
  "timeStamp": 211075996,
  "error": "Service Unavailable",
  "message": "NIS_ILLEGAL_STATE_LOADING_CHAIN",
  "status": 503
}
================================================

$ curl -s -X POST http://nis1.harvesting-sweet-potatoes.club:7890/account/unlocked/info | jq
================================================
{
  "timeStamp": 211075973,
  "error": "Service Unavailable",
  "message": "NIS_ILLEGAL_STATE_LOADING_CHAIN",
  "status": 503
}
================================================

2021/12/05現在およそ8時間で最新に追いつく。

$ curl -s http://nis1.harvesting-sweet-potatoes.club:7890/chain/height | jq
================================================
{
  "height": 3487807
}
================================================

$ curl -s http://nis1.harvesting-sweet-potatoes.club:7890/node/info | jq
================================================
{
  "metaData": {
    "features": 1,
    "application": null,
    "networkId": 104,
    "version": "0.6.100",
    "platform": "Oracle Corporation (1.8.0_151) on Linux"
  },
  "endpoint": {
    "protocol": "http",
    "port": 7890,
    "host": "nis1.harvesting-sweet-potatoes.club"
  },
  "identity": {
    "name": "Fukui",
    "public-key": "c72c3b5bcdd5d9e2d3bd43bd5ef5ac0d42d03bf924713948e6ebbd80c3f8beb8"
  }
}
================================================

$ curl -s -X POST http://nis1.harvesting-sweet-potatoes.club:7890/account/unlocked/info | jq
================================================
{
  "max-unlocked": 50,
  "num-unlocked": 0
}
================================================

ウォレットを確認。最新に追いついてもハーベスティングは無効のまま。
image.png

以上、NIS1は自動的に委任復旧しないというあたりまえ体操でした。

18
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?