Author Topic: 请教两个witness_node同步问题  (Read 369 times)

0 Members and 1 Guest are viewing this topic.

Offline matthan

  • Newbie
  • *
  • Posts: 4
    • View Profile
请教两个witness_node同步问题
« on: May 08, 2018, 11:39:13 am »
在同一个局域网中的两个不同linux主机上分别启动witness_node。配置文件如下:

witness_node_data_dir/config.ini in Linux A:

Code: [Select]
# Endpoint for P2P node to listen on
p2p-endpoint = 0.0.0.0:9001

# P2P nodes to connect to on startup (may specify multiple times)
seed-node = 192.168.8.130:9000

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =

# Endpoint for websocket RPC to listen on
rpc-endpoint = 192.168.8.131:8090

# Endpoint for TLS websocket RPC to listen on
# rpc-tls-endpoint =

# Enable support for per-message deflate compression in the websocket servers (--rpc-endpoint and --rpc-tls-endpoint), disabled by default
# enable-permessage-deflate =

# The TLS certificate file for this server
# server-pem =

# Password for this certificate
# server-pem-password =

# File to read Genesis State from
genesis-json = my-genesis.json

# Block signing key to use for init witnesses, overrides genesis file
# dbg-init-key =

# JSON file specifying API permissions
# api-access =

# Enable block production, even if the chain is stale.
enable-stale-production = true

# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = false

# ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times)
# witness-id =
witness-id = "1.6.1"
witness-id = "1.6.2"
witness-id = "1.6.3"
witness-id = "1.6.4"

# Tuple of [PublicKey, WIF private key] (may specify multiple times)
private-key = ["GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]

# Account ID to track history for (may specify multiple times)
# track-account =

# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers
bucket-size = [15,60,300,3600,86400]

# How far back in time to track history for each bucket size, measured in the number of buckets (default: 1000)
history-per-size = 1000

# declare an appender named "stderr" that writes messages to the console
[log.console_appender.stderr]
stream=std_error

# declare an appender named "p2p" that writes messages to p2p.log
[log.file_appender.p2p]
filename=logs/p2p/p2p.log
# filename can be absolute or relative to this config file

# route any messages logged to the default logger to the "stderr" logger we
# declared above, if they are info level are higher
[logger.default]
level=info
appenders=stderr

# route messages sent to the "p2p" logger to the p2p appender declared above
[logger.p2p]
level=debug
appenders=p2p

witness_node_data_dir/config.ini in Linux B:

Code: [Select]
# Endpoint for P2P node to listen on
p2p-endpoint = 0.0.0.0:9001

# P2P nodes to connect to on startup (may specify multiple times)
seed-node = 192.168.8.130:9000

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =

# Endpoint for websocket RPC to listen on
rpc-endpoint = 192.168.8.131:8090

# Endpoint for TLS websocket RPC to listen on
# rpc-tls-endpoint =

# Enable support for per-message deflate compression in the websocket servers (--rpc-endpoint and --rpc-tls-endpoint), disabled by default
# enable-permessage-deflate =

# The TLS certificate file for this server
# server-pem =

# Password for this certificate
# server-pem-password =

# File to read Genesis State from
genesis-json = my-genesis.json

# Block signing key to use for init witnesses, overrides genesis file
# dbg-init-key =

# JSON file specifying API permissions
# api-access =

# Enable block production, even if the chain is stale.
enable-stale-production = true

# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = false

# ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times)
# witness-id =
witness-id = "1.6.1"
witness-id = "1.6.2"
witness-id = "1.6.3"
witness-id = "1.6.4"

# Tuple of [PublicKey, WIF private key] (may specify multiple times)
private-key = ["GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]

# Account ID to track history for (may specify multiple times)
# track-account =

# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers
bucket-size = [15,60,300,3600,86400]

# How far back in time to track history for each bucket size, measured in the number of buckets (default: 1000)
history-per-size = 1000

# declare an appender named "stderr" that writes messages to the console
[log.console_appender.stderr]
stream=std_error

# declare an appender named "p2p" that writes messages to p2p.log
[log.file_appender.p2p]
filename=logs/p2p/p2p.log
# filename can be absolute or relative to this config file

# route any messages logged to the default logger to the "stderr" logger we
# declared above, if they are info level are higher
[logger.default]
level=info
appenders=stderr

# route messages sent to the "p2p" logger to the p2p appender declared above
[logger.p2p]
level=debug
appenders=p2p

然后在终端先后启动两个witness_node。如何实现这两个witness_node的同步问题?


下面的两个chain id不一致。同步需要一致吗?下面是运行的结果,我使用cli_wallet分别链接到对应witness_node,并创建账户及转账等操作,但是在另外一台主机的钱包终端不能查询到相关数据,即未同步。

Linux A

Code: [Select]
[email protected]:~/publicnet$ ./witness_node
556644ms th_a       witness.cpp:89                plugin_initialize    ] witness plugin:  plugin_initialize() begin
556644ms th_a       witness.cpp:99                plugin_initialize    ] key_id_to_wif_pair: ["GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
556644ms th_a       witness.cpp:117               plugin_initialize    ] witness plugin:  plugin_initialize() end
556645ms th_a       object_database.cpp:94        open                 ] Opening object database from /home/misayozi/publicnet/witness_node_data_dir/blockchain ...
556680ms th_a       object_database.cpp:100       open                 ] Done opening object database.
556681ms th_a       thread.cpp:95                 thread               ] name:ntp tid:140550565234432
556681ms th_a       thread.cpp:95                 thread               ] name:p2p tid:140550546351872
556692ms th_a       application.cpp:131           reset_p2p_node       ] Adding seed node 192.168.8.130:9000
556700ms th_a       application.cpp:143           reset_p2p_node       ] Configured p2p node to listen on 0.0.0.0:9001
556700ms th_a       application.cpp:195           reset_websocket_serv ] Configured websocket rpc to listen on 192.168.8.131:8090
556701ms th_a       witness.cpp:122               plugin_startup       ] witness plugin:  plugin_startup() begin
556701ms th_a       witness.cpp:129               plugin_startup       ] Launching block production for 4 witnesses.

********************************
*                              *
*   ------- NEW CHAIN ------   *
*   - Welcome to Graphene! -   *
*   ------------------------   *
*                              *
********************************

Your genesis seems to have an old timestamp
Please consider using the --genesis-timestamp option to give your genesis a recent timestamp

556701ms th_a       witness.cpp:140               plugin_startup       ] witness plugin:  plugin_startup() end
556701ms th_a       main.cpp:179                  main                 ] Started witness node on a chain with 0 blocks.
556701ms th_a       main.cpp:180                  main                 ] Chain ID is db08674327077201065b47fbf0d8ed5b360720f0ca08dc1a89d5c314ccfe50d0
557001ms th_a       witness.cpp:206               block_production_loo ] Not producing block because node didn't wake up within 500ms of the slot time.
558000ms th_a       witness.cpp:206               block_production_loo ] Not producing block because node didn't wake up within 500ms of the slot time.
559000ms th_a       witness.cpp:206               block_production_loo ] Not producing block because node didn't wake up within 500ms of the slot time.
560067ms th_a       witness.cpp:188               block_production_loo ] Generated block #1 with timestamp 2018-05-08T11:09:20 at time 2018-05-08T11:09:20
580002ms th_a       witness.cpp:188               block_production_loo ] Generated block #2 with timestamp 2018-05-08T11:09:40 at time 2018-05-08T11:09:40
635002ms th_a       witness.cpp:188               block_production_loo ] Generated block #3 with timestamp 2018-05-08T11:10:35 at time 2018-05-08T11:10:35

Linux B
 
Code: [Select]
[email protected]:~/publicnet$ ./witness_node
514577ms th_a       witness.cpp:89                plugin_initialize    ] witness plugin:  plugin_initialize() begin
514577ms th_a       witness.cpp:99                plugin_initialize    ] key_id_to_wif_pair: ["GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
514577ms th_a       witness.cpp:117               plugin_initialize    ] witness plugin:  plugin_initialize() end
514578ms th_a       object_database.cpp:94        open                 ] Opening object database from /home/hzw/publicnet/witness_node_data_dir/blockchain ...
514609ms th_a       object_database.cpp:100       open                 ] Done opening object database.
514609ms th_a       thread.cpp:95                 thread               ] name:ntp tid:140279529002752
514610ms th_a       thread.cpp:95                 thread               ] name:p2p tid:140279510120192
514622ms th_a       application.cpp:131           reset_p2p_node       ] Adding seed node 192.168.8.131:9001
514623ms th_a       application.cpp:143           reset_p2p_node       ] Configured p2p node to listen on 0.0.0.0:9000
514623ms th_a       application.cpp:195           reset_websocket_serv ] Configured websocket rpc to listen on 192.168.8.130:8090
514624ms th_a       witness.cpp:122               plugin_startup       ] witness plugin:  plugin_startup() begin
514624ms th_a       witness.cpp:139               plugin_startup       ] No witnesses configured! Please add witness IDs and private keys to configuration.
514624ms th_a       witness.cpp:140               plugin_startup       ] witness plugin:  plugin_startup() end
514624ms th_a       main.cpp:179                  main                 ] Started witness node on a chain with 0 blocks.
514624ms th_a       main.cpp:180                  main                 ] Chain ID is 3f2f36b333c5007d324b86717ee8fbced55edc6d94beb2018f8d2319d0bddb47
514897ms ntp        ntp.cpp:177                   read_loop            ] ntp_delta_time updated to 122453 us
574179ms asio       main.cpp:170                  operator()           ] Caught SIGINT attempting to exit cleanly
574180ms th_a       main.cpp:183                  main                 ] Exiting from signal 2
[email protected]:~/publicnet$ ./witness_node
575121ms th_a       witness.cpp:89                plugin_initialize    ] witness plugin:  plugin_initialize() begin
575121ms th_a       witness.cpp:99                plugin_initialize    ] key_id_to_wif_pair: ["GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
575121ms th_a       witness.cpp:117               plugin_initialize    ] witness plugin:  plugin_initialize() end
575122ms th_a       object_database.cpp:94        open                 ] Opening object database from /home/hzw/publicnet/witness_node_data_dir/blockchain ...
575159ms th_a       object_database.cpp:100       open                 ] Done opening object database.
575159ms th_a       thread.cpp:95                 thread               ] name:ntp tid:139649361553152
575160ms th_a       thread.cpp:95                 thread               ] name:p2p tid:139649342670592
575172ms th_a       application.cpp:131           reset_p2p_node       ] Adding seed node 192.168.8.131:9001
575176ms th_a       application.cpp:143           reset_p2p_node       ] Configured p2p node to listen on 0.0.0.0:9000
575179ms th_a       application.cpp:195           reset_websocket_serv ] Configured websocket rpc to listen on 192.168.8.130:8090
575182ms th_a       witness.cpp:122               plugin_startup       ] witness plugin:  plugin_startup() begin
575182ms th_a       witness.cpp:139               plugin_startup       ] No witnesses configured! Please add witness IDs and private keys to configuration.
575182ms th_a       witness.cpp:140               plugin_startup       ] witness plugin:  plugin_startup() end
575182ms th_a       main.cpp:179                  main                 ] Started witness node on a chain with 0 blocks.
575182ms th_a       main.cpp:180                  main                 ] Chain ID is 3f2f36b333c5007d324b86717ee8fbced55edc6d94beb2018f8d2319d0bddb47

感谢!
« Last Edit: May 08, 2018, 11:58:22 am by matthan »

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3482
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: 请教两个witness_node同步问题
« Reply #1 on: May 09, 2018, 05:51:34 pm »
chain id 需要相同。也就是说两个节点启动用的 genesis.json 文件要完全相同。
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline matthan

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: 请教两个witness_node同步问题
« Reply #2 on: May 10, 2018, 07:22:17 am »
按照你说的解决了,THX