Just a hobbyist in this space, hopefully this will help someone.
When I want to shutdown GETH to reboot windows or take a backup (the DB is easily corrupted), this seems to help get the node back up and running with a large number of peers quickly...
(I'm using a mix of Windows & Linux here, though the concept is OS agnostic).
1) Export the existing connected peers into a file:
"\Program Files\Geth\geth.exe" --exec "admin.peers" attach http://127.0.0.1:8545 > geth-nodes.txt
2) Now you can shutdown GETH, re-boot the host, take backups & generally do whatever you need to do.
3) In Windows Subsystem for Linux (WSL2) we re-format the output into a batch file:
cat /mnt/c/Users/{username}/geth-nodes.txt | grep enode | awk -F '"' '{ print $2 }' | awk '{ print "\"\\Program Files\\Geth\\geth.exe\" -exec \"admin.addPeer(\047"$1"\047)\" attach http://127.0.0.1:8545" }' | sort -u > /mnt/c/Users/{username}/add-geth-nodes.bat
This command creates a windows batch file:
"\Program Files\Geth\geth.exe" -exec "admin.addPeer('enode://00ed0018cdef491b7733f4dd398593e5cc912565dd1d96fc8a6e84b89c1ba198a4e149c8870215c263cb7f118232755278725a5817aaec968a350e13ff0f9716@148.251.183.197:30303')" attach http://127.0.0.1:8545
"\Program Files\Geth\geth.exe" -exec "admin.addPeer('enode://016078ee996adf9f7595fdd55d8762f540561887210a02c3cdeb55313322aca4998ec6f2aba01324e4679660048271d518aeb8ac7e126b472b61c05183eb7ef4@54.221.158.111:38562')" attach http://127.0.0.1:8545
"\Program Files\Geth\geth.exe" -exec "admin.addPeer('enode://016078ee996adf9f7595fdd55d8762f540561887210a02c3cdeb55313322aca4998ec6f2aba01324e4679660048271d518aeb8ac7e126b472b61c05183eb7ef4@54.221.158.111:49114')" attach http://127.0.0.1:8545
etc.
4) Restart GETH and run the above created batch file, the output will look like this:
"\Program Files\Geth\geth.exe" -exec "admin.addPeer('enode://00ed0018cdef491b7733f4dd398593e5cc912565dd1d96fc8a6e84b89c1ba198a4e149c8870215c263cb7f118232755278725a5817aaec968a350e13ff0f9716@148.251.183.197:30303')" attach http://127.0.0.1:8545
true
C:\Users\justi>"\Program Files\Geth\geth.exe" -exec "admin.addPeer('enode://016078ee996adf9f7595fdd55d8762f540561887210a02c3cdeb55313322aca4998ec6f2aba01324e4679660048271d518aeb8ac7e126b472b61c05183eb7ef4@54.221.158.111:38562')" attach http://127.0.0.1:8545
true
C:\Users\justi>"\Program Files\Geth\geth.exe" -exec "admin.addPeer('enode://016078ee996adf9f7595fdd55d8762f540561887210a02c3cdeb55313322aca4998ec6f2aba01324e4679660048271d518aeb8ac7e126b472b61c05183eb7ef4@54.221.158.111:49114')" attach http://127.0.0.1:8545
true
In my experience, this gets the node back up and running with a large number of peers within minutes.
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments