1
I have followed the steps to install a C-lightning node on my Ubuntu machine. I wanted to know if I could install configure and make a second node on the same machine where both could run in tandem?
1
I have followed the steps to install a C-lightning node on my Ubuntu machine. I wanted to know if I could install configure and make a second node on the same machine where both could run in tandem?
1
Unless you want to test multiple versions of the lightningd binary, there is no need to check the source code out multiple times, since the binaries can be shared among multiple instances.
Assuming you are in the root directory of the source code, and you've executed ./configure and make, you can start multiple instances like this:
$ lightningd/lightningd --log-level=debug \
--lightning-dir=/path/to/lightning-dir1 \
--addr=0.0.0.0:1111 &
$ lightningd/lightningd --log-level=debug \
--lightning-dir=/path/to/lightning-dir2 \
--addr=0.0.0.0:2222 &
$ lightningd/lightningd --log-level=debug \
--lightning-dir=/path/to/lightning-dir3
--addr=0.0.0.0:3333 &
Each of these commands will start a new node with its own directory and with its own port.
Notice that you'll also need to tell lightning-cli where to find the various instances you're trying to talk to. For example the following will run the help command on the second instance:
$ lightning-cli --lightning-dir=/path/to/lightning-dir2 help
I usually will set up a couple of aliases for each instance that I run:
alias lcli1="lightning-cli --lightning-dir=/path/to/lightning-dir1"
alias lcli2="lightning-cli --lightning-dir=/path/to/lightning-dir2"
alias lcli3="lightning-cli --lightning-dir=/path/to/lightning-dir3"
Then you can just use lcli1 help to talk to the first instance.
If you'd like to run multiple versions, the procedure is identical, with the key difference that you need to compile and run these in the source code directory of the corresponding version that you are trying to run.
I am well aware that I would need to use a seperate lightning directory and port for the second node, but when I try to clone the github, it just clones the 2nd instance inside the folder of the first instance and only one lightningd can be active at a time. When I try to activate the second node, it just says "We seem to be missing some gossip messages" in the second terminal. – Chris Franko Jennings – 2019-08-20T23:29:19.117
Are you trying to run two separate versions of
lightningd? If not you will not need to check the source out again, and you can run all instances with the same binary (but with different ports and different--lightning-dirparameters as you correctly pointed out). – cdecker – 2019-08-22T09:28:28.903