How to deploy two server nodes on single machine?

+2 votes

I was getting started with MultiChain. The very first line was This tutorial requires two server nodes.

How to deploy two server nodes on single machine? This may be a very basic question, but maybe quite helpful to newbie like me. I have single machine to work with, how can I proceed with multiChain? TIA

asked Sep 5, 2016 by prashant.singh

1 Answer

+1 vote

You can use the -datadir command line parameter to run different nodes in different directories on a single server. This works with both multichaind and multichain-cli (and multichain-util but you probably won't need it for that since you only need to specify a different directory for the second node which won't be creating the chain).

answered Sep 5, 2016 by MultiChain
Thanks for response. I am trying to download MultiChain in a different directory. But when trying to connect to first server, I am getting  ERROR: Couldn't initialize permission database for blockchain chain1. Probably multichaind for this blockchain is already running. Exiting...

Probably I am missing some commands. DO I need to follow instructions exactly as given on http://www.multichain.com/download-install/
Where should I exactly use datadir command in given steps?
I am now able to connect to blockchain for first time. but after granting second node permission to connect, when I reconnect again, I get  
Chain chain1 already exists, adding 192.168.0.34:4423 to list of peers

Error: An error occurred while setting up the RPC address 127.0.0.1 port 4422 for listening: bind: Address already in use
Error: Unable to bind to 0.0.0.0:4423 on this computer. MultiChain Core is probably already running.
Error: Failed to listen on any port. Use -listen=0 if you want this.
It seems while trying to conncet from second node, is using the same first node's port.
 any help?
Sorry, I should have mentioned this earlier. There are two ports you need to configure - the peer-to-peer port for nodes to talk to each other, and the API port for nodes to be accessed from outside. If you're running multiple nodes on one server, these need to be different. Take a look at the -port and -rpcport settings, as explained in the runtime parameters page: http://www.multichain.com/developers/runtime-parameters/
I tried using -port to specify the port on which my Node should run, but still getting the same issue. Even when I specify the second node a different port by using -port and -rpcport , it is unable to connect to first node blockchain. I am getting node's wallet address but when I try to reconnect after granting permission I get above mentioned error.
Also if I try to specify port twhile initialising the blockchain , I get a message like:
   New user can connect to this node using 10.10.23.39:0 .
You need to use -port, -rpcport AND -datadir to do this. Does that help?
You had to open the port related to node server on router's firewall !!! ->192.168.1.1/192.168.1.254
https://www.multichain.com/qa/2817/how-to-run-datadir-in-multichain

refer this if not able to set up the second node.
...