Running two instances on a single machine (pre-prod and preview)

I remember someone who was running two of the testnets on a single machine, just using two sets of executables, separate folder, etc. Saves on hardware and both the testnets aren’t resource hungry.

I’ve got both preview and pre-prod setup and can run them separately, but I get an error when running both that the socket address is in use. Was there something special I need to do two run both in terms of the host address? Or something like that?

Why would you need separate executables?

Choosing different ports and different socket files when starting the node is important.

In that setup, I get different ports by

and:

And I get different sockets by:

Well, I was running 8.1.2 on preview, so yeah, I should just upgrade that too, but I thought I had to run two separate executables. I’ll read through your stuff a bit more and see where I’m going wrong.

I am running both instances using separate ports, but maybe I’ve missed one of the variables in the env file.

Well, you run them separately, but they need to be installed only once. To do an ls of one directory in one terminal and an ls of another directory in another terminal, you also do not need to have two separate installations of ls.

If you regularly want to upgrade earlier on one network than on the other – to first test it on Preview, for example – a setup with two separate cardano-node executables might make sense, though.

If you used the CNTools way of doing things that’s quite possible. There are a lot of things in those. Since you say in the original post that it complains about “socket”, not port, it’s probably that.

I’m not using CNTools, just the tried and true (for me at least) Coincashew based install.

But yeah, I meant two separate executables (whether or not they’re the same version), but if I can just run two instances via two separate run commands, that’s easier!

You only need separate executables if the executables themselves need to be different (e.g they are different versions).

But if they are the same, you just need two separate configurations, which pretty much boils down to two separate ports and two separate database folders.

(And you also need a bigger machine, I guess 32GB RAM and up would do for two node instances)

Only occasionally running my nodes on my normal desktop when I want to do or test something: The two testnets need much less resources than the mainnet. 32 GiB work with running Mainnet, Preprod, and Preview all at the same time and still normally working alongside that.

Thanks for the info! For Mainnet it used to take something along the lines of ~13GB of memory at one point (this could have changed though: to less with better memory management; or to more with a bigger utxo size). But how much do Preview and Preprod take these days? They are periodically reset as well, right, so they wont grow indefinitely?

No, https://book.world.dev.cardano.org/env-preview.html says for Preview:

Ideally stays long running. Only if an issue is found after it forks that’s breaking should it be respun.

And for Preprod:

Long running. Since this parallels mainnet, if a bug occurs here, it needs fixed properly and can not be respun.

They are both running since Autumn 2022.

But they have much less activity (and 2022 is not 2017), so they are still much smaller than Mainnet.

For what it’s worth, after starting all three and letting them fully sync, I have this:

  • Mainnet (PID 796167 in that run): 14.1 GiB
  • Preprod (PID 796189 in that run): 1.67 GiB
  • Preview (PID 796212 in that run): 2.06 GiB

(Preview has jumped to 2.10 GiB a few moments after taking that screenshot. After that all three have stayed at those numbers. So, I guess this should give a pretty accurate impression of the order of magnitude today.)

2 Likes

I got it working, I had to change the prometheus port on the second instance, along with the EKG port. Not sure why mine is working different to what you have set up @HeptaSean but at least it is working now with two instances (and two different versions, one for preview and one for preprod).

Because I have just disabled Prometheus and EKG:

Yeah, if they are there, they also need different ports.

1 Like