Running A Witness Node v0.19.4

in #witness-category6 years ago (edited)

I'm finally running a witness test server with 0.19.4.

0.19.4 is an optional release that includes significant architectural changes to steemd. These architecture changes lay the framework for future improvements and as of 0.19.4 allows for fully parallel API execution.

There were a number of optimizations to improve reindex performance. Because of this you will need to reindex to run 0.19.4.

The build instructions are found at https://github.com/steemit/steem/blob/master/doc/building.md

Here's my summary for building on Ubuntu 16.04 based on those instructions, with a few modifications. This is the manual way of doing things, if you're a Docker fan, this is the time to learn something. Also I assume you're already familiar with running a witness so I won't go too deep into some of the details, like where to download the block_log file.

Required packages

sudo apt-get install -y autoconf automake cmake g++ git libssl-dev libtool make pkg-config python3 python3-jinja2

Boost packages

sudo apt-get install -y libboost-chrono-dev libboost-context-dev libboost-coroutine-dev libboost-date-time-dev libboost-filesystem-dev libboost-iostreams-dev libboost-locale-dev libboost-program-options-dev libboost-serialization-dev libboost-signals-dev libboost-system-dev libboost-test-dev libboost-thread-dev

Optional packages

sudo apt-get install -y doxygen libncurses5-dev libreadline-dev perl

Missing packages

Also, some packages were missing from the build instructions (@timcliff had opened a Github pull request for it https://github.com/steemit/steem/pull/2477)

sudo apt-get install -y libsnappy-dev libbz2-dev

Building the binaries

git clone https://github.com/steemit/steem
cd steem
git checkout master # for the latest 0.19.4, use `master`, not `stable`, the `stable` version is 0.19.3
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DLOW_MEMORY_NODE=ON -DCLEAR_VOTES=ON -DSKIP_BY_TX_ID=ON ..
make -j$(nproc) steemd
make -j$(nproc) cli_wallet

# copy the binaries to the local bin folder
mkdir ~/bin
cp programs/steemd/steemd ~/bin
cp programs/cli_wallet/cli_wallet ~/bin

Verify the version with steemd -v:

steem_blockchain_version: 0.19.4
steem_git_revision:       62b48877d9f731c3fe00ef818e3324a0a3de3e63
fc_git_revision:          62b48877d9f731c3fe00ef818e3324a0a3de3e63

------------------------------------------------------

            STARTING STEEM NETWORK

------------------------------------------------------
initminer public key: STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX
chain id: 0000000000000000000000000000000000000000000000000000000000000000
blockchain version: 0.19.4
------------------------------------------------------

Set up tmpfs

On my test server I have 24GB RAM with a NVME drive, so I created a swap partition on the NVME for the extra memory. No need to worry about a swap if you have 64GB RAM or more, otherwise google for guides how to do that.

sudo mount -o remount,size=64G /dev/shm
sudo sysctl vm.swappiness=1

I was running a backup server using the docker container, so I already have my config.ini and block_log file. I will use those. However, we need to do a few modifications

Edit the config.ini.

  • Comment the line required-participation = false. The new steemd didn't run with that parameter.
  • Replace all seed-node strings with p2p-seed-node. This is optional, if you don't do that, the daemon will spit a notification about it, but it will still run.
  • I left the public-api = database_api login_api as it is, and changed the plugin parameter to plugin = witness condenser_api

Removed login_api
The login_api was designed as a way to map the API names to numeric ids. Because the APIs are no longer called via id, there is now no need for the login_api, and so it has been removed.

Plugins are enabled via the plugin option. There is no more public-api option and all the APIs are now enabled via plugin as well.

So, reflecting the new changes, use the following plugin settings:
plugin = database_api condenser_api witness

  • Make sure shared-file-dir = /dev/shm/ and not shared-file-dir = /shm/ (as in the dockerized setup)

Run the daemon in a screen session with logging

A replay is required for v0.19.4. At this point I can replay the witness node straight up with the following (remember, I have a previous docker setup):
steemd -d ~/steem-docker/data/witness_node_data_dir/ --replay-blockchain

However, I need to run it in the background and have a logging mechanism to monitor the status and errors.

So, create two scripts in the ~/bin folder

echo -e '#!/usr/bin/env bash\nsteemd -d ~/steem-docker/data/witness_node_data_dir/' > ~/bin/steemd-start.sh
echo -e '#!/usr/bin/env bash\nsteemd -d ~/steem-docker/data/witness_node_data_dir/ --replay-blockchain' > ~/bin/steemd-replay.sh
chmod +x ~/bin/steemd*.sh

Add the following aliases to the ~/.bashrc file

alias startsteemd='screen -X -S steem quit ; rm ~/steemd.log ; cd ~ ; screen -c ~/bin/steemd.conf -dmSL steem ~/bin/steemd-start.sh'
alias replaysteemd='screen -X -S steem quit ; rm ~/steemd.log ; cd ~ ; screen -c ~/bin/steemd.conf -dmSL steem ~/bin/steemd-replay.sh'
alias entersteemd='screen -x steem'
alias logsteemd='tail ~/steemd.log -f -n30'

Log out and log in again (or type source ~/.bashrc).
Replay the node with replaysteemd.
Type logsteemd to monitor it in realtime.
If you want to start or restart it, type startsteemd, it will kill the current screen session and start it again.
If you entersteemd, exit the session with ctrl-a-d to leave the process running.
Keep an eye on the steemd.log size, delete if it grows too much.

Performance

The replay went fast and took a few hours. I noticed the replay was using 2 CPU cores out of 4, compared to the single core usage on 0.19.3. That's a good boost.

The memory usage is also lower, 37.8GB vs 42.2GB on my dockerized 0.19.3, that's a significant 4.4GB difference.

htop on the 0.19.4 server

htop master.png

htop on the 0.19.3 server

htop stable.png

And of course, successfully producing blocks with 0.19.4.

success.png


Available & Reliable. I am your Witness. I want to represent You.

🗳 If you like what I do, consider voting for me 🗳

Vote

Check my guide about Voting for Witnesses.
Go to https://steemit.com/~witnesses. My name is listed in the Top 50. Click once.
Alternatively you can use SteemConnect to vote for me or set me as proxy

Sort:  

Sorry I forgot to add this to the scripts section, it's needed, otherwise the aliases don't run.

echo -e 'logfile steemd.log\nlogfile flush 1\nlog on' > ~/bin/steemd.conf

Very important. Otherwise, you'll get an error saying that the log is missing and can't be removed.

Congratulations my sire, I will leave the programming to the mensa boffins like you, Pricasso only knows most magical art and can't even begin to fathom those hieroglyphics you programmers use ;)

Many thanks for all your continued love and support,
Be blessed

Yours Always
Pricasso

If he can do it. Of course. We can't. This is high level hieroglyphics. Even ancient Egyptians can't read this.

Hi @drakos!

Your post was just upvoted by @utopian-io. We invite you to join our developer community on the Steem blockchain for your next tutorial by simply using the tags utopian-io tutorials!

Contributing on Utopian

Learn how to contribute on our website.

Want to chat? Join us on Discord https://discord.gg/h52nFrV

Nice write up, Drakos. :) I've been thinking of trying out running a full API node soon.

If it's a 19.4 RPC node, you can talk to @timcliff about that, he's running one.

I love to do coding.it's great working like another working I think. always have to think of a new concept, creativity. if I fall into any problem to solve, time is passing hour to hour.ufff! it's a feeling like drinking to me.

Hello @drakos, you are really doing a great job of running witness node. I hope it will make steemit platform more stable. appreciated!

How can someone like me learn coding and skills like this ?

You spend years auto-learning.

What can be the first steps

You Google "how to xyz" changing "xyz" to stuff you want to learn and you learn.

Start with how linux works. Install it and play with it. Expect a lot of command line typing.

I’ll work on it , thanks !!

If you go the Ubuntu desktop route, try running it without the GUI(Graphical User Interface) after you get used to some of the syntax etc. Maybe Install and configure a few apps etc via in the CLI (Command Line Interface)

Holy wow.. I understood pretty much none of that and now I feel inadequate.. but hugs to you anyway for being so smart yourself! One day I'm going to learn that stuff, too! Little old me! Maybe.. okay probably I wont, but a girl can dream. Good luck with all that stuffs! ♥ I'm constantly impressed by what you do. ♥ - serena

I do not understand anything, but I support you! :-)

Honey those are a number of steps, to get that result!
I do not know anything about programming, I just know how to turn on the computer and miraculously,
It is a very extensive and complex topic, (I think) not everyone has the fortune to learn it but you have a lot of knowledge of that subject and you do a great job to keep things in place! @drakos 😉

Let us, the nerds, handle the tech stuff so you can enjoy your Steem experience.

@drakos I like what nerd😏 do and thank you for doing it darling, if they did not do it I think I would not be here! have an important job.
Ah! I have a question for you, about some programming language! I send it to you privately
Also what steps do I have to do to teach a child coding and programming, to him he likes to have a computer in his hand, if it were for him he would be stuck to it all day!
but here where we live does not teach that and I do not help much with that subject!

Well done @drakos! You successfully guessed the match result.

Group Phase - Uruguay vs Saudi Arabia
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard!


Do you like the SteemitBoard Corld Cup Contest?
Vote for @steemitboard as a witness and get one more award!

Thanks my man for doing what you do. I just do not have the tech smarts and patience but you seem totally compete in doing it.

Appreciate it @drakos

I think to understand this I must have a slight knowledge about programming xD that at this time I have

sneaky-ninja-sword-xs.jpg
Sneaky Ninja Attack! You have just been defended with a 44.44% upvote!
I was summoned by @drakos. I have done their bidding and now I will vanish...

woosh
A portion of the proceeds from your bid was used in support of youarehope and tarc.

Abuse Policy
Rules
How to use Sneaky Ninja
How it works
Victim of grumpycat?

Thanks for the write up.

Saving for later for when I build a back up and try this funky 19.4

Well done @drakos! You successfully guessed the match result.

Group Phase - France vs Peru
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard!


Do you like the SteemitBoard Corld Cup Contest?
Vote for @steemitboard as a witness and get one more award!

This post has received a 48.35 % upvote from @booster thanks to: @drakos.

This is so confusing! 😲😲😲 Thanks for doing what you do so we don't have to worry and can all have fun blogging! 😉

good programe but i am newbbie herecan u give me some guidence to join ??

It is amazing how the world of computer and programming developed and matured over last 3 decades, reading your programming terminology is like speaking a different language. But the new generation seems to grow up with that and it is easy for them. My son started programming classes a year ago in his school and for him it was like it is really simple and obvious.

I wish you all success, @drakos!

Well done @drakos! You successfully guessed the match result.

Group Phase - Brazil vs Costa Rica
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard!


Do you like the SteemitBoard Corld Cup Contest?
Vote for @steemitboard as a witness and get one more award!

You got a 49.33% upvote from @upme thanks to @drakos! Send at least 3 SBD or 3 STEEM to get upvote for next round. Delegate STEEM POWER and start earning 100% daily payouts ( no commission ).

@drakos Just out of curiosity what are you running in your prod environment?
Just curious what it takes hardware wise to run a witness node.

My witness servers are running on:

  • 64GB + NVME
  • 32GB + NVME
  • 24GB + HDD + NVME

Well done @drakos! You successfully guessed the match result.

Group Phase - Germany vs Sweden
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard!


Do you like the SteemitBoard World Cup Contest?
Vote for @steemitboard as a witness and get one more award!

19

I sometimes collect interesting quotes to make a post on their basis. I think that this will be one of them.