6

I want to run two separate nodes on my computer but it seems that the two nodes will collide with other. I know some considerations should be taken such as the ports, but anything else should I take care of?

4

Different clients

For different clients all you need to do is changing the listening port, like that:

pyethapp # defaults to 30303
eth --listen 30304 --no-ipc
geth --port 30305 # default ipc
parity --port 30306

In ethereumj you can configure the port in the config file, e.g., 30307. Never was able to change the port in pyethapp though. Running parity in --geth mode here would conflict with geth, depending on your needs you should disable ipc on all clients except one, the example above defaults to geth ipc.

Same client

For multiple instances of the same client, you would also have to adjust the data directory.

geth # defaults to port 30303 and ~/.ethereum
geth --port 30304 --datadir ~/.ethereum-04
geth --port 30305 --datadir ~/.ethereum-05
geth --port 30306 --datadir ~/.ethereum-06

Or for parity:

parity # defaults to port 30303 and ~/.parity
parity --port 30304 --db-path ~/.parity-04
parity --port 30305 --db-path ~/.parity-05
parity --port 30306 --db-path ~/.parity-06

On top you can add fine tuning such as rpc ports or pruning methods, but that's up to you.

  • So if I started $geth and it's syncing i.e. "Imported new chain segment" etc that is already 1 instance being used for syncing on port 30303. So if I want to start another instance of geth in bash so I can run other bash commands like geth --dev, geth console, geth --exec, I have to open a 2nd instance by using geth --port 30304 --datadir ~/.ethereum-04? Can I just use geth --port 30304 and geth will auto increment the directory? Also I don't have a ~/.ethereum directory. Only a $HOME/Library/Ethereum directory. – tem Apr 15 '18 at 4:07
3

I have successfully used this docker-compose system, where you can even define the number of nodes as a parameter:

https://github.com/stevebakh/docker-ethereum

  • It enables the user develop a private network on one device? – Wang Jul 11 '16 at 14:23
  • you know docker... creates many virtual devices on one computer – Roland Kofler Jul 11 '16 at 14:24
3

If you're running 2 nodes on the same user profile, you need to use different datadirs for each node. Although not efficient, you can also run a node on a virtual Guest OS through hypervisors like VirtualBox.

0

Yes you will have to use different ports and directories for the data of each node. I shared a docker-compose (Geth+Parity) setup, on the same host. You can use that example to start. Cheers! https://github.com/gregbkr/ethereum-nodes-docker

  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Waqar Lim Jan 5 '17 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.