Author Topic: Delegate双机热备方案1(BitSuperLab 出品)  (Read 7744 times)

0 Members and 1 Guest are viewing this topic.

Offline xweng

  • Jr. Member
  • **
  • Posts: 38
    • View Profile
请教 alt,,你说的 run_wallet.exp  有地方下载吗?
比特币硬币 新浪微博

DNS 受托人ID:www-17755com、dns-17755com、kid-17755com

Offline 小菜xiaocai

  • Newbie
  • *
  • Posts: 7
  • weibo.com/cool007zqw
    • View Profile
    • 新浪微博:小菜ZENO

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
alt 是我们的华人骄傲! 你的bts钱包多少, 我请你喝beer
baozi 是alt的!
是的,谢谢小李:D

来自我的 HUAWEI P7-L00 上的 Tapatalk


Offline cike

  • Full Member
  • ***
  • Posts: 61
    • View Profile
alt 是我们的华人骄傲! 你的bts钱包多少, 我请你喝beer
baozi 是alt的!
BTS:cike

Offline willaim

  • Full Member
  • ***
  • Posts: 113
  • Never forget your dream!
    • View Profile
alt 是我们的华人骄傲! 你的bts钱包多少, 我请你喝beer
Please contribute PTS to this address if my info is useful for you: PjjYtWpwmwEMA1MK9mjpDpSYzkTMPgjm7X

Offline mmlmmlmml

  • Full Member
  • ***
  • Posts: 61
    • View Profile
建议用keepalive方案,两台服务器互相监控,其中一台运行,发现挂了,自动启动另一台(或者定时重启服务)。这样不用编译,用sh脚本就可以实现。没有两个同时运行的问题。
还要补充一点,昨天晚上我的 slave 由于长时间运行,又遇到老问题,连接数降到很低,导致收包出问题,出现了不少误判,生成了好几个 orphan block
所以 slave 上可以让程序定期自动重启,我刚增加了每12小时重启一次

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
还要补充一点,昨天晚上我的 slave 由于长时间运行,又遇到老问题,连接数降到很低,导致收包出问题,出现了不少误判,生成了好几个 orphan block
所以 slave 上可以让程序定期自动重启,我刚增加了每12小时重启一次
你的重启script好像要expert??支持。 具体要如何操作。
ALT你的documentation没有达到北美软件业的水平 :'( :'( :'( :'(。还是中国的方式
确实啊,工作基本没有写document的习惯,以后尽量写清楚一点,英文写的也不知道对不对
run_wallet.exp 是 expect 脚本,需要安装 expect,运行之前记住修改里面的 "wallet_name" 和 "command line" ,按自己的实际修改
Code: [Select]
sudo aptitude install expect
./run_wallet.exp
对 slave 来说,编译完后,把程序改个名字,比如 bitshares_client_slave,这样直接运行 killall -9 bitshares_client_slave 就可以重启 slave了

Offline sfinder

  • Hero Member
  • *****
  • Posts: 1205
  • 4 Cores CPU+100GB SSD+anti-DDoS Pro
    • View Profile
还要补充一点,昨天晚上我的 slave 由于长时间运行,又遇到老问题,连接数降到很低,导致收包出问题,出现了不少误判,生成了好几个 orphan block
所以 slave 上可以让程序定期自动重启,我刚增加了每12小时重启一次
你的重启script好像要expert??支持。 具体要如何操作。
ALT你的documentation没有达到北美软件业的水平 :'( :'( :'( :'(。还是中国的方式
微博:星在飘我在找|BTS X 受托人delegate ID:baidu
中国教育书店合作将20%收入捐献给贫困山区学生。
Cooperating with China Education Bookstore and will donate 20% of delegate income to the poor students

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
还要补充一点,昨天晚上我的 slave 由于长时间运行,又遇到老问题,连接数降到很低,导致收包出问题,出现了不少误判,生成了好几个 orphan block
所以 slave 上可以让程序定期自动重启,我刚增加了每12小时重启一次

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
alt老弟,这个slave客户端只要加“ next_slot_time += 5;”这行代码后编译,是吗?

slave可以和master同时开机而不会相互影响吗?一个代表运行在2个不同的结点是否是BM所允许的。

你做过多少测试?

对,加一行编译就可以了。
我昨天开始已经这样部署了,是在同一台VPS上运行了master和slave两个进程,因为现在丢包主要是程序BUG,用两台机器暂时没必要。
测试到现在只丢了一个包,这个丢包是因为我后面的代理时间不准,插队到我前面出块了,两个进程都无法出块
Code: [Select]
delegate (unlocked) >>> blockchain_list_blocks 94684 3
HEIGHT  TIMESTAMP           SIGNING DELEGATE                # TXS   SIZE    TOTAL FEES      LATENCY PROCESSING TIME
===================================================================================================================
94684   2014-07-30T14:05:20 clout-delegate2                 0       166     0.00000 BTSX    0       0.005236       
MISSED  2014-07-30T14:05:30 delegate-baozi                  N/A     N/A     N/A             N/A     N/A           
94685   2014-07-30T14:05:40 btsx.chinesecommunity           0       166     0.00000 BTSX    -10     0.000112       
94686   2014-07-30T14:05:50 init73                          0       166     0.00000 BTSX    0       0.007378     
block 91330 master错过了,是 slave 产生的,可以看到它的 latency 是  5s
Code: [Select]
[delegate (unlocked) >>> blockchain_list_blocks 91330 3
HEIGHT  TIMESTAMP           SIGNING DELEGATE                # TXS   SIZE    TOTAL FEES      LATENCY PROCESSING TIME
===================================================================================================================
91330   2014-07-30T04:44:20 init72                          0       166     0.00000 BTSX    0       0.004282       
91331   2014-07-30T04:44:30 delegate-alt                    0       166     0.00000 BTSX    5       0.004205       
91332   2014-07-30T04:44:40 init43                          0       166     0.00000 BTSX    0       0.006424       

Offline sfinder

  • Hero Member
  • *****
  • Posts: 1205
  • 4 Cores CPU+100GB SSD+anti-DDoS Pro
    • View Profile
alt老弟,这个slave客户端只要加“ next_slot_time += 5;”这行代码后编译,是吗?

slave可以和master同时开机而不会相互影响吗?一个代表运行在2个不同的结点是否是BM所允许的。

你做过多少测试?


hi, delegates. we have a solution for hot standby.

set up delegate wallet in 2 machines. one is master, and the other is slave.
master run  delegate_loop task at seconds 0,10,20 ....
slave run the task with 5 seconds delay, at 5, 15, 25 .....
Normally master will generate block in time, slave will receive the block less than 5 seconds, than slave will not generate block.
If for some reason, master missed generation, slave didn't receive block from master in 5 seconds, slave will generate.

here is the patch for slave program:
Code: [Select]
--- a/libraries/client/client.cpp
+++ b/libraries/client/client.cpp
@@ -729,6 +729,7 @@ config load_config( const fc::path& datadir )
 
           uint32_t slot_number = blockchain::get_slot_number( now );
           time_point_sec next_slot_time = blockchain::get_slot_start_time( slot_number + 1 );
+          next_slot_time += 5;
           ilog( "Rescheduling delegate loop for time: ${t}", ("t",next_slot_time) );
 
           time_point scheduled_time = next_slot_time;
微博:星在飘我在找|BTS X 受托人delegate ID:baidu
中国教育书店合作将20%收入捐献给贫困山区学生。
Cooperating with China Education Bookstore and will donate 20% of delegate income to the poor students

Offline Musewhale

  • Hero Member
  • *****
  • Posts: 2881
  • 丑,实在是太丑了 !
    • View Profile
编程的人是不是记忆力都比较好? :-X
MUSE witness:mygoodfriend     vote for me

Offline mtang

  • Sr. Member
  • ****
  • Posts: 366
  • BTSX id:mtang
    • View Profile
 +5% +5%

悟空你又来显摆了,二师兄快来接招 :D
BTSX:wallet_approve_delegate btsx.outofcontrol true
DNS :wallet_account_set_approval mtang true
感谢给我们的受托人团队“失控”btsx.outofcontro以及she.bitrose投票。请关注FUND数字资产运作计划//立足兢兢业业的standby delegate//weibo ID:汤O包

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
hi, delegates. we have a solution for hot standby.

set up delegate wallet in 2 machines. one is master, and the other is slave.
master run  delegate_loop task at seconds 0,10,20 ....
slave run the task with 5 seconds delay, at 5, 15, 25 .....
Normally master will generate block in time, slave will receive the block less than 5 seconds, than slave will not generate block.
If for some reason, master missed generation, slave didn't receive block from master in 5 seconds, slave will generate.

here is the patch for slave program:
Code: [Select]
--- a/libraries/client/client.cpp
+++ b/libraries/client/client.cpp
@@ -729,6 +729,7 @@ config load_config( const fc::path& datadir )
 
           uint32_t slot_number = blockchain::get_slot_number( now );
           time_point_sec next_slot_time = blockchain::get_slot_start_time( slot_number + 1 );
+          next_slot_time += 5;
           ilog( "Rescheduling delegate loop for time: ${t}", ("t",next_slot_time) );
 
           time_point scheduled_time = next_slot_time;