Hypothetical (having duplicate Block producers) 1 cloud 1 home

What should my valency be set to on my current block producer and relays?

Right now in my topology for my Block producer:

{
“Producers”: [
{
“addr”: “x.x.x.x”, Relay 1
“port”: 6000,
“valency”: 1
},
{
“addr”: “x.x.x.x”, Relay 2
“port”: 6000,
“valency”: 1
}
]
}

On my Relay 1 topology:

{ “addr”: “x.x.x.x”, “port”: 6000, “valency”: 2 } , (Block Producer)
{ “addr”: “x.x.x.x”, “port”: 6000, “valency”: 1 } , (Relay 2)

On my Relay 2 topology:

{ “addr”: “x.x.x.x”, “port”: 6000, “valency”: 2 } , (Block Producer)
{ “addr”: “x.x.x.x”, “port”: 6000, “valency”: 1 } , (Relay 1)

Hi,

your valency values look correct.
{
“Producers”: [
{
“addr”: “x.x.x.x”, Relay 1
“port”: 6000,
“valency”: 1
},
{
“addr”: “x.x.x.x”, Relay 2
“port”: 6000,
“valency”: 1
}
]
}
would fit to your passive node.
Your topology file is perfect. Now you have to pay attention to have two different starting scripts one for the bp and one for the passive node (which is the same as for the relay).

Best,
Johann

Yes I think I understand, I would also need a extra cardano-node.service for automating the secondary startBlockProducer1-2.sh

So block producer is valency “2” ?

Hi,
yes this is correct.
Best,
Johann

1 Like

Hi @Anti.biz !
Sometime we ask ourselves the same questions as it seems :wink:
This was the outcome for me

Similarly to what was explained already i also just run it as a relay but with the required config to run it as a Validator available. Still secured like a validator (not exposed to public, no typo updater)

2 Likes

Could you give some more details about how this script works. I have a monitoring/alerting running currently which verifies if the TIP is current. If it gets older then 5 minutes i trigger an Alert. This could be used as a trigger for the secondary node to come up, but there is a risk that the original producer was just temporarely blocked (e.g. not updated by the other relays in the typology). This sometimes happened in the last weeks mostly at ~10:40-10:50 CET.
Concrete Question:

  • How do you check if the original BP died?

  • If it died are you making sure that it is also stopped to make sure it not comes up again and you have 2 BPs running?

  • Is there a reference script around?

My current setup just sends me the alert. Switching is currently manual but I’d love to automate that as well.

Can you share your script that is monitoring the tip? And possible explain how it would trigger the passive to become the block.

Short explanation of the script. It is executed through crontab every minute.
It send OK pings to healthchecks.io. If the TIP diff is too high it does not send the ping.
Healtchecks.io will alert if no valid ping comes in for 5 Minutes.
This way I will recognize that something is wrong in any case (also when the machine is not running/crashed/not able to execute the check) without exposing anything to the outside world (like it would be the case if using a cloud monitoring agent)

Remarks:

  • The script is kind of hardcoded currently, so it will require customization for you
  • Also if Cardano Config / Parameters change the calculation may be invalid because I’m just substracting the constant 1591566291 from the current Time. So it could be improved to calculate this static value from the Cardano Config Parameters.
  • Please customize the following parts of the script:
  • Change USERNAME to your user
  • Change the “all good sending ping” area to your appropriate handler or define a non success area to trigger somethign in this case.

Script (pingTipCheck.sh):

#!/usr/bin/env bash
# shellcheck disable=SC2034,SC2086,SC2230,SC2009,SC2206,SC2062,SC2059

export CARDANO_NODE_SOCKET_PATH=/opt/cardano/cnode/sockets/node0.socket

customCurrentSlotNoString=$(/home/USERNAME/.cabal/bin/cardano-cli shelley query tip --mainnet | grep -Po '\"slotNo\": \K[0-9]+')
customCurrentSlotNo=$(expr $customCurrentSlotNoString + 0)

customRefSlotNo=$(expr $(printf '%(%s)T\n' -1) - 1591566291)
customDiff=$(expr $customRefSlotNo - $customCurrentSlotNo)

if [[ $customDiff -le 50 ]]
then
  echo "all good sending ping"
  curl -m 10 --retry 5 https://hc-ping.com/YOURPINGENDPOINT
exit
fi

Crontab Entry (crontab -e -u USER):

* * * * * /opt/cardano/cnode/custom/pingTipCheck.sh
1 Like

Hi,

I am happy to see development in this direction.

I think that if you decide to go to the data center anyway, which makes sense for the bp. The redundancy to run a second bp is in principle an overkill. I would suggest to monitor the bp on the data center as suggested by zwirny that’s it.

Best,
Johann

What does your appropriate handler or define a non success area mean?

Also a question… if the ICMP is filtered, the script is still valid?

          • /opt/cardano/cnode/custom/pingTipCheck.sh
            What time should I set this on?

I’m doing the Ping to healthchecks.io. You could want to do something different. In that case you would need to change this area.

Yes it is. It is just a call from the server to healthchecks to let healthchecks know everything is still good. This approach is often handled for monitoring of completely internal serves which are not allowed to accept any incoming connects from outside networks.

No ICMP involved. Just a URL request to the HTTP Url

My example with * * * * * → is the timer for running it every minute

Hey my first failed crontab for my relays was because of the health check:

please let me know if i messed something up:

22 * * * * /home/xxx/cardano-my-node/topologyUpdater.sh && curl -fsS --retry 5 -o /dev/null https://hc-ping.com/xxxxx

*** i changed the time on my server and the health checks, ill see if that fixes things.

  • its working now

./pingTipCheck.sh
WARNING: The “shelley” subcommand is now deprecated and will be removed in the f uture. Please use the top-level commands instead.

cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (Connection re

this doesnt seem to be working.

Check if the Node Socket Path is correct for you.
The warning can be ignored for now.

./pingTipCheck.sh
WARNING: The “shelley” subcommand is now deprecated and will be removed in the future. Please use the top-level commands instead.
all good sending ping