目录
环境
想法
- 由于挖矿很费性能,对于手上的垃圾服务器来说,要挂nginx和tomcat还要挖矿实在是难为它了。
- 因此想把挖矿的任务分给另一台服务器。
- 目标效果即为:
- 副节点连上主节点,两者的数据同步。
- 主节点关闭挖矿,节省性能,由副节点挖矿。
开搞
让副节点连上主节点
- 注意:
- 不要在副节点上直接打开geth执行
- $ geth attach http://your_ip:8545
- 这样相当于远程连接控制主节点了,就像我们在windows上用ssh远程连接linux去控制geth挖矿的开启和关闭一样,链上仍然只有主节点一个,只不过有主节点本机和另一台机可以去控制主节点。
- 不要在副节点上直接打开geth执行
- 副节点需要和主节点用一样的创世块文件
- 这里就用和之前的文章(以太坊私链搭建)所用的创世块一致
- genesis.json
{
"config":{
"chainId":7,
"homesteadBlock":0,
"eip150Block":0,
"eip155Block":0,
"eip158Block":0,
"byzantiumBlock":0,
"constantinopleBlock":0,
"petersburgBlock":0,
"istanbulBlock":0,
"ethhash":{}
},
"alloc":{},
"coinbase":"0x0000000000000000000000000000000000000000",
"difficulty":"0x2",
"extraData":"",
"gasLimit":"0xffffffff",
"nonce":"0x0000000000000042",
"mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp":"0x00"
}
- 还要准备启动脚本,这里也保持和主节点一致
- rungeth.sh
geth --datadir ./data --networkid 7 --http --http.addr 0.0.0.0 --http.vhosts "*" --http.api "admin,debug,web3,eth,txpool,personal,ethash,miner,net" --http.corsdomain "*" --snapshot --mine --miner.threads 1 --allow-insecure-unlock console 2> 1.log
- 在副节点所在机新建一个用户
- $ geth --datadir ./data account new
- 然后在副节点所在机初始化创世块
- $ sudo geth --datadir ./data init ./genesis.json
- 启动geth
- $ sudo ./rungeth.sh
- 如果是在一台机子上搞两个节点,则要修改他们的运行端口,使之不要重复,不然其中一个会启动不起来。
- 至此,副节点就部署完成了,接下来要在主节点中添加副节点。
- 首先查看一下副节点的enode
- > admin.nodeInfo.enode
- 首先查看一下副节点的enode
- -
- 在主节点添加副节点的enode
- >admin.addPeer("encode")
- 在主节点添加副节点的enode
- 查看是否添加成功
- 方法1:
- 直接对比两者的块高度看看是否相等,如果块比较多,可能需要等待一下同步。
- > eth.blockNumber
- 方法2:
- net.peerCount
- admin.peers
- 方法1:
- 让副节点代替主节点挖矿
- 把主节点挖矿停掉,在主节点所在机执行:
- > miner.stop()
- 让副节点挖矿,在副节点所在机执行:
- > miner.start()
- 把主节点挖矿停掉,在主节点所在机执行:
修改java程序连接副节点
- 上一篇的文章:java使用web3j调用以太坊私链上的智能合约
- 上文中讲到,java程序连接单节点(主节点)的私链去调用智能合约。
- 注意:
- 如果不修改的话,此时主节点虽然开着geth,但关闭了挖矿,只能和副节点进行数据同步,而连接主节点发送的请求都是不能执行的。
- 而且主节点的geth不能关闭,否则副节点也会出问题。
- 不要在开着geth的时候直接关闭ssh窗口,否则会导致链的数据丢失,要在geth里执行> exit 退出。
- 复制副节点的用户私钥文件到java程序执行的机子上,
- 修改java程序使用这个私钥文件,并把用户地址也改成这个私钥文件的用户。
- 修改java程序连接副节点所在的服务器ip地址。
- 到这里就可以了,如此就实现了让副节点代替主节点挖矿的任务了。
存在的问题
- 主节点的账号是不能在连接副节点后使用的,也就是说,两个节点实际上只有链上的数据是互通的,账号是不互通的。因此java程序连接副节点时需要修改。
- 此时主节点只能同步数据,不能挖矿,连接到主节点后发送的交易并不会由副节点代替挖矿完成。
Very good article. I’m dealing with a few of these issues as well..
Having read this I thought it was really enlightening. I appreciate you taking the time and effort to put this short article together. I once again find myself personally spending a lot of time both reading and commenting. But so what, it was still worthwhile.
Everyone loves it when people get together and share opinions. Great website, keep it up!
farmacia online: kamagra oral jelly – comprare farmaci online all’estero
This is a topic which is near to my heart… Many thanks! Exactly where are your contact details though?
Farmacie on line spedizione gratuita: kamagra – farmacia online
You are so cool! I don’t suppose I have read through a single thing like that before. So nice to find somebody with genuine thoughts on this topic. Really.. thanks for starting this up. This website is something that is required on the internet, someone with some originality.
I love it when people get together and share ideas. Great website, keep it up.
migliori farmacie online 2024: Cialis generico controindicazioni – acquistare farmaci senza ricetta
http://viagragenerico.site/# viagra originale in 24 ore contrassegno
viagra 50 mg prezzo in farmacia: viagra senza prescrizione – viagra generico sandoz
Hello, I do believe your web site may be having browser compatibility problems. When I take a look at your web site in Safari, it looks fine however, when opening in I.E., it has some overlapping issues. I just wanted to provide you with a quick heads up! Aside from that, excellent website!
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 connections with placement contained in articles on article portals
Secondary – 3000 domain Redirected hyperlinks
Tertiary – 20000 hyperlinks assortment, comments, entries
Using a link pyramid is beneficial for web crawlers.
Demand:
One link to the domain.
Key Phrases.
Accurate when 1 key phrase from the website subject.
Note the complementary feature!
Essential! Tier 1 connections do not intersect with Secondary and 3rd-level links
A link pyramid is a tool for enhancing the flow and link profile of a website or social network
viagra generico in farmacia costo: viagra senza prescrizione – cialis farmacia senza ricetta
farmacie online autorizzate elenco: sildenafil oral jelly 100mg kamagra – farmacie online sicure
I love reading an article that can make men and women think. Also, thank you for allowing me to comment.
I could not refrain from commenting. Perfectly written!
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 references with inclusion inside compositions on writing platforms
Middle – 3000 URL Forwarded references
Tier 3 – 20000 references mix, feedback, entries
Using a link pyramid is beneficial for indexing systems.
Need:
One reference to the platform.
Key Phrases.
Correct when 1 keyword from the content subject.
Highlight the complementary service!
Essential! Primary hyperlinks do not overlap with Secondary and 3rd-order references
A link hierarchy is a mechanism for enhancing the flow and referral sources of a internet domain or social network
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 hyperlinks with positioning within compositions on publishing platforms
Middle – 3000 link Redirected hyperlinks
Lower – 20000 hyperlinks combination, comments, articles
Employing a link structure is useful for online directories.
Demand:
One link to the domain.
Query Terms.
Correct when 1 query term from the website title.
Note the additional functionality!
Crucial! Top links do not intersect with Secondary and Tertiary-rank connections
A link hierarchy is a tool for increasing the flow and inbound links of a digital property or social media platform
https://viagragenerico.site/# dove acquistare viagra in modo sicuro
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 links with positioning within pieces on writing portals
Level 2 – 3000 web address Redirected hyperlinks
Tier 3 – 20000 links mix, comments, articles
Using a link pyramid is advantageous for web crawlers.
Need:
One link to the platform.
Search Terms.
True when 1 search term from the page title.
Remark the additional offering!
Crucial! Top hyperlinks do not intersect with Secondary and Tier 3-order links
A link structure is a instrument for elevating the movement and backlink portfolio of a internet domain or online community
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 references with positioning contained in pieces on writing portals
Tier 2 – 3000 domain Rerouted connections
Level 3 – 20000 hyperlinks combination, feedback, entries
Utilizing a link pyramid is advantageous for indexing systems.
Require:
One connection to the site.
Key Phrases.
Accurate when 1 query term from the website subject.
Note the extra feature!
Vital! Top hyperlinks do not overlap with 2nd and Tertiary-rank references
A link structure is a mechanism for increasing the circulation and backlink portfolio of a website or online community
farmacie online autorizzate elenco: Cialis generico farmacia – Farmacie online sicure
comprare farmaci online all’estero: Farmacie on line spedizione gratuita – п»їFarmacia online migliore
Link pyramid, tier 1, tier 2, tier 3
Top – 500 links with inclusion contained in compositions on publishing domains
Tier 2 – 3000 domain Forwarded links
Lower – 20000 hyperlinks assortment, remarks, posts
Implementing a link pyramid is useful for search engines.
Need:
One link to the platform.
Keywords.
Correct when 1 keyword from the resource topic.
Highlight the supplementary service!
Crucial! Top hyperlinks do not intersect with Secondary and Tier 3-tier links
A link pyramid is a mechanism for boosting the movement and inbound links of a digital property or virtual network
You have a unique perspective that I find incredibly valuable. Thank you for sharing.
Farmacie online sicure: kamagra gel – farmacia online senza ricetta
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 connections with placement within compositions on writing portals
Tier 2 – 3000 domain +Redirect hyperlinks
Tier 3 – 20000 links mix, remarks, entries
Utilizing a link network is helpful for web crawlers.
Demand:
One reference to the platform.
Search Terms.
Correct when 1 query term from the resource topic.
Observe the complementary service!
Important! Top references do not coincide with Tier 2 and 3rd-tier links
A link pyramid is a tool for boosting the movement and inbound links of a internet domain or social network
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 connections with integration contained in compositions on writing sites
Tier 2 – 3000 web address Rerouted references
Lower – 20000 references mix, comments, entries
Utilizing a link network is beneficial for online directories.
Need:
One link to the domain.
Search Terms.
True when 1 keyword from the website topic.
Remark the supplementary functionality!
Essential! First-level connections do not coincide with Tier 2 and 3rd-order connections
A link network is a instrument for enhancing the flow and referral sources of a digital property or social network
viagra online consegna rapida: viagra prezzo – alternativa al viagra senza ricetta in farmacia
Link pyramid, tier 1, tier 2, tier 3
Tier 1 – 500 connections with positioning contained in articles on publishing domains
Tier 2 – 3000 domain Rerouted references
Lower – 20000 references blend, feedback, writings
Using a link hierarchy is helpful for indexing systems.
Need:
One link to the domain.
Query Terms.
Correct when 1 query term from the content title.
Remark the supplementary functionality!
Important! Tier 1 connections do not intersect with Secondary and Tier 3-tier references
A link structure is a mechanism for enhancing the circulation and inbound links of a digital property or social media platform
Link pyramid, tier 1, tier 2, tier 3
Top – 500 references with integration embedded in pieces on article portals
Tier 2 – 3000 web address Forwarded links
Tier 3 – 20000 hyperlinks assortment, comments, entries
Implementing a link pyramid is beneficial for online directories.
Demand:
One connection to the platform.
Search Terms.
Correct when 1 query term from the resource title.
Observe the complementary feature!
Vital! Top links do not conflict with Tier 2 and Tier 3-order hyperlinks
A link network is a mechanism for increasing the movement and backlink portfolio of a internet domain or social media platform
farmacia online: Avanafil 50 mg – Farmacie on line spedizione gratuita
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 connections with placement contained in compositions on publishing domains
Secondary – 3000 URL Redirected hyperlinks
Tier 3 – 20000 links mix, comments, entries
Using a link structure is advantageous for search engines.
Require:
One hyperlink to the platform.
Search Terms.
True when 1 query term from the content heading.
Note the extra service!
Vital! Primary hyperlinks do not intersect with Secondary and 3rd-tier links
A link hierarchy is a device for elevating the circulation and backlink portfolio of a website or virtual network
Farmacia online piГ№ conveniente: kamagra oral jelly consegna 24 ore – farmacie online autorizzate elenco
Oh my goodness! Amazing article dude! Thank you, However I am encountering problems with your RSS. I don’t understand the reason why I cannot subscribe to it. Is there anybody getting similar RSS issues? Anybody who knows the answer will you kindly respond? Thanx!
https://farmait.store/# comprare farmaci online con ricetta
Link pyramid, tier 1, tier 2, tier 3
Top – 500 connections with placement embedded in writings on article sites
Secondary – 3000 link Redirected links
Tier 3 – 20000 links combination, feedback, posts
Using a link structure is helpful for web crawlers.
Need:
One link to the website.
Search Terms.
Correct when 1 key phrase from the website heading.
Note the complementary functionality!
Important! Top links do not conflict with Tier 2 and Tier 3-level references
A link structure is a tool for boosting the movement and referral sources of a internet domain or virtual network
You’ve made some decent points there. I looked on the internet for more info about the issue and found most individuals will go along with your views on this website.
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 hyperlinks with placement inside articles on article sites
Secondary – 3000 web address Forwarded hyperlinks
Lower – 20000 references mix, posts, posts
Utilizing a link pyramid is advantageous for search engines.
Demand:
One hyperlink to the site.
Keywords.
Accurate when 1 keyword from the website title.
Observe the supplementary feature!
Important! Tier 1 connections do not conflict with 2nd and 3rd-order hyperlinks
A link network is a tool for increasing the movement and inbound links of a online platform or social network
This is a very good tip especially to those fresh to the blogosphere. Short but very accurate information… Thanks for sharing this one. A must read post.
farmacia online piГ№ conveniente: kamagra gel – farmaci senza ricetta elenco
Link pyramid, tier 1, tier 2, tier 3
Tier 1 – 500 references with placement contained in compositions on writing domains
Level 2 – 3000 URL Forwarded hyperlinks
Level 3 – 20000 connections assortment, remarks, posts
Employing a link hierarchy is beneficial for search engines.
Need:
One reference to the platform.
Query Terms.
True when 1 keyword from the website heading.
Remark the extra feature!
Crucial! Tier 1 references do not overlap with 2nd and 3rd-rank links
A link hierarchy is a instrument for elevating the movement and backlink portfolio of a online platform or online community
Link pyramid, tier 1, tier 2, tier 3
Tier 1 – 500 references with placement inside pieces on publishing domains
Level 2 – 3000 web address Forwarded hyperlinks
Lower – 20000 links mix, comments, posts
Implementing a link network is beneficial for web crawlers.
Require:
One link to the website.
Search Terms.
True when 1 query term from the website subject.
Highlight the complementary feature!
Vital! First-level connections do not coincide with Secondary and 3rd-tier references
A link network is a mechanism for elevating the circulation and link profile of a digital property or online community
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 references with integration contained in articles on publishing domains
Secondary – 3000 URL Rerouted connections
Level 3 – 20000 references assortment, posts, entries
Implementing a link hierarchy is useful for web crawlers.
Necessitate:
One hyperlink to the website.
Keywords.
True when 1 key phrase from the website title.
Remark the complementary feature!
Crucial! Top references do not overlap with Tier 2 and Tertiary-level connections
A link structure is a device for elevating the liquidity and referral sources of a internet domain or social media platform
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 hyperlinks with integration inside compositions on article sites
Middle – 3000 link Rerouted references
Lower – 20000 references blend, comments, entries
Utilizing a link hierarchy is helpful for web crawlers.
Demand:
One link to the website.
Keywords.
Valid when 1 query term from the resource heading.
Note the complementary functionality!
Crucial! Primary references do not conflict with 2nd and 3rd-rank references
A link pyramid is a device for enhancing the circulation and inbound links of a online platform or social media platform
Way cool! Some very valid points! I appreciate you penning this post plus the rest of the website is really good.
viagra prezzo farmacia 2023: viagra farmacia – viagra naturale in farmacia senza ricetta
May I just say what a relief to find an individual who actually knows what they’re talking about online. You definitely understand how to bring a problem to light and make it important. A lot more people need to read this and understand this side of your story. I was surprised that you aren’t more popular since you most certainly possess the gift.
Link pyramid, tier 1, tier 2, tier 3
Top – 500 connections with inclusion within compositions on writing sites
Level 2 – 3000 URL +Redirect hyperlinks
Level 3 – 20000 hyperlinks assortment, comments, writings
Utilizing a link hierarchy is beneficial for online directories.
Require:
One connection to the website.
Key Phrases.
Valid when 1 query term from the website topic.
Observe the additional functionality!
Crucial! Tier 1 references do not intersect with Tier 2 and Tertiary-order connections
A link network is a instrument for elevating the movement and inbound links of a website or social media platform