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

**URL:** <https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435>\
**Category:** Setup a Stake Pool\
**Created:** [5 February 2024 23:49 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435 "2024-02-05T23:49:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremyisme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/jeremyisme/32/54872_2.png) [@jeremyisme](https://forum.cardano.org/u/jeremyisme)\
**Post date:** [5 February 2024 23:49 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/1 "2024-02-05T23:49:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [6 February 2024 06:02 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/2 "2024-02-06T06:02:18Z")

</div>

Why would you need separate executables?

> [@Setting up cardano-node with mithril-client on preview, preprod, and mainnet](https://forum.cardano.org/t/setting-up-cardano-node-with-mithril-client-on-preview-preprod-and-mainnet/120798):
>
> My goal with this post is to have cardano-nodes on both testnets – preview and preprod – and on mainnet running as a user, so I can later use them for minting, contract experiments etc. I’m not going to run a pool and this is not about setting up one. To setup as fast and simple as possible, I’m going to use the pre-compiled binaries. Moreover, since we now have Mithril to get snapshots of the chains and do not have to synchronise from the beginning anymore, I’m going to use that. Installing t…

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

In that setup, I get different ports by

> [@Setting up cardano-node with mithril-client on preview, preprod, and mainnet](https://forum.cardano.org/t/setting-up-cardano-node-with-mithril-client-on-preview-preprod-and-mainnet/120798/1):
>
> Since I want to be able to run the nodes on the different chains/networks in parallel and the port the node itself listens on will be given on the command line and is not set in `config.json`, I create environment files that can be read by the `systemd` unit in the next section:
> 
> ```auto
> $ cat ~/.local/cardano/chains/mainnet/env
> CARDANO_NODE_PORT=3001
> $ cat ~/.local/cardano/chains/preprod/env
> CARDANO_NODE_PORT=3002
> $ cat ~/.local/cardano/chains/preview/env
> CARDANO_NODE_PORT=3003
> 
> ```

and:

> [@Setting up cardano-node with mithril-client on preview, preprod, and mainnet](https://forum.cardano.org/t/setting-up-cardano-node-with-mithril-client-on-preview-preprod-and-mainnet/120798/1):
>
> ```auto
> EnvironmentFile=%h/.local/cardano/chains/%i/env
> ExecStart=%h/.local/bin/cardano-node run […] --port ${CARDANO_NODE_PORT}
> 
> ```

And I get different sockets by:

> [@Setting up cardano-node with mithril-client on preview, preprod, and mainnet](https://forum.cardano.org/t/setting-up-cardano-node-with-mithril-client-on-preview-preprod-and-mainnet/120798/1):
>
> ```auto
> WorkingDirectory=%h/.local/cardano/chains/%i/
> […]
> ExecStart=%h/.local/bin/cardano-node run […] --socket-path socket […]
> 
> ```

---

<div class="post-metadata">

**Author:** ![jeremyisme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/jeremyisme/32/54872_2.png) [@jeremyisme](https://forum.cardano.org/u/jeremyisme)\
**Post date:** [6 February 2024 06:33 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/3 "2024-02-06T06:33:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [6 February 2024 06:51 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/4 "2024-02-06T06:51:41Z")

</div>

> [@jeremyisme](#):
>
> but I thought I had to run two separate executables.

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.

> [@jeremyisme](#):
>
> but maybe I’ve missed one of the variables in the env file.

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.

---

<div class="post-metadata">

**Author:** ![jeremyisme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/jeremyisme/32/54872_2.png) [@jeremyisme](https://forum.cardano.org/u/jeremyisme)\
**Post date:** [6 February 2024 07:05 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/5 "2024-02-06T07:05:26Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Markus\_Lall](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/markus_lall/32/50613_2.png) [@Markus\_Lall](https://forum.cardano.org/u/Markus_Lall)\
**Post date:** [6 February 2024 19:23 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/6 "2024-02-06T19:23:16Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [6 February 2024 19:28 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/7 "2024-02-06T19:28:03Z")

</div>

> [@Markus\_Lall](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Markus\_Lall](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/markus_lall/32/50613_2.png) [@Markus\_Lall](https://forum.cardano.org/u/Markus_Lall)\
**Post date:** [6 February 2024 19:46 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/8 "2024-02-06T19:46:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [6 February 2024 20:09 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/9 "2024-02-06T20:09:45Z")

</div>

> [@Markus\_Lall](#):
>
> They are periodically reset as well, right, so they wont grow indefinitely?

No, [https://book.world.dev.cardano.org/env-preview.html](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.

> [@Markus\_Lall](#):
>
> But how much do Preview and Preprod take these days?

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:

 ![screenshot-2024-02-06-21:04:25](https://us1.discourse-cdn.com/flex023/uploads/cardano/original/3X/8/1/81de6067ae9842b2dc74cd97d3d70fcac056d869.jpeg)

- 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.)

---

<div class="post-metadata">

**Author:** ![jeremyisme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/jeremyisme/32/54872_2.png) [@jeremyisme](https://forum.cardano.org/u/jeremyisme)\
**Post date:** [7 February 2024 08:02 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/10 "2024-02-07T08:02:27Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [7 February 2024 08:58 UTC](https://forum.cardano.org/t/running-two-instances-on-a-single-machine-pre-prod-and-preview/127435/12 "2024-02-07T08:58:19Z")

</div>

> [@jeremyisme](#):
>
> Not sure why mine is working different to what you have set up @HeptaSean

Because I have just disabled Prometheus and EKG:

> [@Setting up cardano-node with mithril-client on preview, preprod, and mainnet](https://forum.cardano.org/t/setting-up-cardano-node-with-mithril-client-on-preview-preprod-and-mainnet/120798/1):
>
> I decided that I need neither EKG nor Prometheus for my use case (local node just to submit transactions and experiment around with). The logs in `journalctl` are more than enough. So, I removed superfluous configuration in all three configs:

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