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?
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 port30303
. So if I want to start another instance of geth in bash so I can run other bash commands likegeth --dev
,geth console
,geth --exec
, I have to open a 2nd instance by usinggeth --port 30304 --datadir ~/.ethereum-04
? Can I just usegeth --port 30304
and geth will auto increment the directory? Also I don't have a~/.ethereum
directory. Only a$HOME/Library/Ethereum
directory. – Edison Apr 15 '18 at 4:07
I have successfully used this docker-compose system, where you can even define the number of nodes as a parameter:
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.
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. – Afr Jan 5 '17 at 14:38