編譯btcpool源碼之后,運行其測試程序
cd /work/btcpool/build/run_simulator
./simulator -c simulator.cfg -l log_simulator
這個程序沒有hang住,直接“完”了,我拿不準(zhǔn)這個程序是否運行出錯了還是怎么樣。
請教各位大俠,是否知道btcpool的測試程序(run_simulator)如何正確運行,謝謝!
我查看log_simulator下面的日志發(fā)現(xiàn)日志最下面一行如下:
E0403 14:34:04.956310 698 StratumClient.cc:256] event error: Connection refused
判斷是sserver沒有啟動,我單獨用命令去啟動sserver,如下:
root@zc-x0:/work/btcpool/build/run_sserver# ./sserver -c sserver.cfg -l log_sserver/
F0403 14:35:37.795059 743 Kafka.cc:192] Failed to acquire metadata: Local: Timed out
*** Check failure stack trace: ***
@ 0x7ff03507c03d google::LogMessage::Fail()
@ 0x7ff03507dea3 google::LogMessage::SendToLog()
@ 0x7ff03507bbcb google::LogMessage::Flush()
@ 0x7ff03507e88e google::LogMessageFatal::~LogMessageFatal()
@ 0x462e3b KafkaConsumer::checkAlive()
@ 0x43ce48 JobRepository::setupThreadConsume()
@ 0x43efd9 Server::setup()
@ 0x43fb84 StratumServer::init()
@ 0x434973 main
@ 0x7ff0338d0830 __libc_start_main
@ 0x436af9 _start
Aborted (core dumped)
root@zc-x0:/work/btcpool/build/run_sserver#
查看日志:
3 Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
4 W0403 14:35:34.784273 743 StratumServerMain.cc:122] using bitcoin testnet3
5 I0403 14:35:34.794375 743 Kafka.cc:347] producer librdkafka version: 0.9.1
6 I0403 14:35:34.794396 743 Kafka.cc:347] producer librdkafka version: 0.9.1
7 I0403 14:35:34.794406 743 Kafka.cc:347] producer librdkafka version: 0.9.1
8 I0403 14:35:34.794416 743 Kafka.cc:347] producer librdkafka version: 0.9.1
9 I0403 14:35:34.794425 743 Kafka.cc:347] producer librdkafka version: 0.9.1
10 I0403 14:35:34.794432 743 Kafka.cc:82] consumer librdkafka version: 0.9.1
11 I0403 14:35:34.794566 743 Kafka.cc:160] add brokers: 127.0.0.1:9092
12 I0403 14:35:34.794602 743 Kafka.cc:167] create topic handle: StratumJob
13 F0403 14:35:37.795059 743 Kafka.cc:192] Failed to acquire metadata: Local: Timed out
鑒于日志判斷,可能是因為kafka的Topic:StratumJob 里面沒有數(shù)據(jù)引起的。(后面證實這個是不對的,這一步可以跳過)故通過命令,用生產(chǎn)者發(fā)送此topic的消息,然后再次運行sserver
root@zc-x0:/work/btcpool/build/run_sserver# ./sserver -c sserver.cfg -l log_sserver/
F0403 16:10:05.019886 3165 StratumServerMain.cc:171] init failure
*** Check failure stack trace: ***
@ 0x7f27bad8703d google::LogMessage::Fail()
@ 0x7f27bad88ea3 google::LogMessage::SendToLog()
@ 0x7f27bad86bcb google::LogMessage::Flush()
@ 0x7f27bad8988e google::LogMessageFatal::~LogMessageFatal()
@ 0x434ac5 main
@ 0x7f27b95db830 __libc_start_main
@ 0x436af9 _start
Aborted (core dumped)
root@zc-x0:/work/btcpool/build/run_sserver# vi log_sserver/
查看日志 vi log_sserver/sserver.INFO
3 Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
4 W0403 17:24:39.469852 4886 StratumServerMain.cc:122] using bitcoin testnet3
5 W0403 17:24:39.470086 4886 StratumServer.cc:862] Simulator is enabled, all share will be accepted
6 I0403 17:24:39.470122 4886 Kafka.cc:347] producer librdkafka version: 0.9.1
7 I0403 17:24:39.470132 4886 Kafka.cc:347] producer librdkafka version: 0.9.1
8 I0403 17:24:39.470140 4886 Kafka.cc:347] producer librdkafka version: 0.9.1
9 I0403 17:24:39.470146 4886 Kafka.cc:347] producer librdkafka version: 0.9.1
10 I0403 17:24:39.470152 4886 Kafka.cc:347] producer librdkafka version: 0.9.1
11 I0403 17:24:39.470158 4886 Kafka.cc:82] consumer librdkafka version: 0.9.1
12 I0403 17:24:39.470310 4886 Kafka.cc:160] add brokers: 127.0.0.1:9092
13 I0403 17:24:39.470350 4886 Kafka.cc:167] create topic handle: StratumJob
14 I0403 17:24:39.577185 4891 StratumServer.cc:162] start job repository consume thread
15 E0403 17:24:39.589262 4886 Utils.cc:221] unable to request data from: https://127.0.0.1/get_user_id_list?last_id=0, error: Couldn't connect to server
16 E0403 17:24:39.589727 4886 StratumServer.cc:480] http get request user list fail, url: https://127.0.0.1/get_user_id_list?last_id=0
17 E0403 17:24:39.589777 4886 StratumServer.cc:547] update user list failure
18 E0403 17:24:39.589867 4886 StratumServer.cc:776] fail to setup server
19 F0403 17:24:39.589912 4886 StratumServerMain.cc:171] init failure
sserver的配置文件如下:
1 #
2 # stratum server cfg
3 #
4 # @since 2016-06
5 # @copyright btc.com
6 #
7
8 # is using testnet3
9 testnet = true;
10
11 kafka = {
12 brokers = "127.0.0.1:9092"; # "10.0.0.1:9092,10.0.0.2:9092,..."
13 };
14
15 sserver = {
16 ip = "0.0.0.0";
17 port = 3333;
18
19 # should be global unique, range: [1, 255]
20 id = 1;
21
22 # write last mining notify job send time to file, for monitor
23 file_last_notify_time = "/work/btcpool/build/run_sserver/sserver_lastnotifytime.txt";
24
25 # how many seconds between two share submit
26 share_avg_seconds = 10;
27
28 ########################## dev options #########################
29
30 # if enable simulator, all share will be accepted. for testing
31 enable_simulator = true;
32
33 # if enable it, all share will make block and submit. for testing
34 enable_submit_invalid_block = false;
35
36 # if enable, difficulty sent to miners is always miner_difficulty. for development
37 enable_dev_mode = false;
38
39 # difficulty to send to miners. for development
40 miner_difficulty = 0.005;
41
42 ###################### end of dev options ######################
43 };
44
45 users = {
46 #
47 # https://example.com/get_user_id_list?last_id=0
48 # {"err_no":0,"err_msg":null,"data":{"jack":1,"terry":2}}
49 #
50 # There is a demo: https://github.com/btccom/btcpool/issues/16#issuecomment-278245381
51 #
52 list_id_api_url = "https://127.0.0.1/get_user_id_list";
53 };
如 sserver 日志所示
15 E0403 17:24:39.589262 4886 Utils.cc:221] unable to request data from: https://127.0.0.1/get_user_id_list?last_id=0, error: Couldn't connect to server
16 E0403 17:24:39.589727 4886 StratumServer.cc:480] http get request user list fail, url: https://127.0.0.1/get_user_id_list?last_id=0
17 E0403 17:24:39.589777 4886 StratumServer.cc:547] update user list failure
18 E0403 17:24:39.589867 4886 StratumServer.cc:776] fail to setup server
19 F0403 17:24:39.589912 4886 StratumServerMain.cc:171] init failure
參考 sserver.cfg 的注釋,你需要自己搭建一個網(wǎng)站服務(wù)器(xx.yy),并提供一個網(wǎng)站接口(/get_user_id_list),然后把網(wǎng)址寫入 sserver.cfg 文件的 list_id_api_url 項,如下
users = {
list_id_api_url = "http://xx.yy/get_user_id_list";
};
你可以在本機搭建一個 apache 或者 nginx 服務(wù)器,然后按照
https://github.com/btccom/btc...
上的說明操作便可。
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
北大青鳥中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團,成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達內(nèi)教育集團成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負責(zé)iOS教學(xué)及管理工作。
浪潮集團項目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。