<p>you can run <code>lightningd --help</code> and get a list of arguments you can use to start <code>lightning</code> from the output there ist: </p>

<pre><code>--lightning-dir=&lt;dir&gt;                Set working directory. All other files are
                                     relative to this
                                      (default: "/home/user/.lightning")
</code></pre>

<p>this means that you can set your own lightning-dir by calling <code>lightningd --lightning-dir=/some/path/to/some/directory</code></p>

<p>now you can either put all the config values as additional arguments to your call or you put a config file into <code>/some/path/to/some/directory/</code> which sets everything. the default is to call it <code>config</code> but you can also use the command line argument <code>--conf=/path/to/some/conffile</code> from <code>lightningd</code> to set a different one in a different location.</p>

<p>One thing you need to remember that both lightning nodes need to run on different tcp/ip ports. you do this by setting the port in your accounce addr in the config  file <code>announce-addr=IP-ADDR:PORT</code> you need to replacei IP-ADDR with your address and the port with the port.</p>

<p>obviously when interacting with each of the nodes you need to tell <code>lightning-cli</code> which one. again the <code>--help</code> command helps (: </p>

<pre><code>lightning-cli --help
Usage: lightning-cli &lt;command&gt; [&lt;params&gt;...]
--lightning-dir=&lt;dir&gt;  Set working directory. All other files are relative to this (default: "/home/user/.lightning")
...
</code></pre>

<p>this means you can for example do <code>lightning-cli --lightning-dir=/some/path/to/somedir/ getinfo</code></p>

CC BY-SA 4.0
2019-08-20T18:14:27.323Z
I have setup both nodes in their respective config files with their own ports and directories:  i.e.... 

announce-addr=x.x.x.x:9900
bind-addr=0.0.0.0:9900
ligtning-dir=/home/array/.lightning

announce-addr=x.x.x.x:9902
bind-addr=0.0.0.0:9902
ligtning-dir=/home/array/.lightning2

but when I run…  lightningd --network=bitcoin --log-level=debug  on either folder…they both startup in the .lightning folder where only one can run at a time…
Next Layer
CC BY-SA 4.0
2019-08-20T18:22:09.767Z
perhaps i am installing and configuring c-lightning wrong....when I setup the second c-lightning....I just used git clone https://github.com/ElementsProject/lightning.git lightning2
cd lightning2
Next Layer
CC BY-SA 4.0
2019-08-20T23:09:47.940Z
Although helpful, this doesn't solve the problem of running both at the same time. As soon as I activate the first node, the second one cannot be initiated.
Next Layer
CC BY-SA 4.0
2019-08-20T23:14:20.567Z
It just says "We seem to be missing gossip messages"
Next Layer
CC BY-SA 4.0
2019-08-24T08:04:18.150Z
you don't need to clone the source code twice! it is sufficient to download, compile and install the software once and then you can run two nodes exactly in the way how I wrote it. The error message "we seem to be missing gossip messages" seems to be a different problem (for example each node needs to peer with at least one public node in order to retrieve information about the network)
Rene Pickhardt
CC BY-SA 4.0
2019-08-20T18:06:10.947Z
2019-08-20T18:06:10.947Z
Rene Pickhardt
<p>I have successfully setup a C-lightning node on ubuntu using the tutorial.  The problem I am having is trying to setup a second node that DOESN'T utilize the same .lightning hidden directory to run which means I can only run 1 node at a time.  How do I clone and setup a second c-lightning node on the same machine and run it in it's own hidden directory?  I am aware that both nodes need to direct to their own config files located in different paths.</p>

<bitcoind><core-lightning>
Setting up and running multiple C-lightning nodes on same machine
Next Layer
# Setting up and running multiple C-lightning nodes on same machine

(Asked by: username_0 on 2019-08-20)

I have successfully setup a C-lightning node on ubuntu using the tutorial. The problem I am having is trying to setup a second node that DOESN'T utilize the same .lightning hidden directory to run which means I can only run 1 node at a time. How do I clone and setup a second c-lightning node on the same machine and run it in it's own hidden directory? I am aware that both nodes need to direct to their own config files located in different paths.

**Tags:** bitcoind, core-lightning


---

## 1 answers

### Answer by username_1 on 2019-08-20. Score: 2

you can run `lightningd --help` and get a list of arguments you can use to start `lightning` from the output there ist:

```
--lightning-dir=<dir>                Set working directory. All other files are
                                     relative to this
                                      (default: "/home/user/.lightning")

```

this means that you can set your own lightning-dir by calling `lightningd --lightning-dir=/some/path/to/some/directory`

now you can either put all the config values as additional arguments to your call or you put a config file into `/some/path/to/some/directory/` which sets everything. the default is to call it `config` but you can also use the command line argument `--conf=/path/to/some/conffile` from `lightningd` to set a different one in a different location.

One thing you need to remember that both lightning nodes need to run on different tcp/ip ports. you do this by setting the port in your accounce addr in the config file `announce-addr=IP-ADDR:PORT` you need to replacei IP-ADDR with your address and the port with the port.

obviously when interacting with each of the nodes you need to tell `lightning-cli` which one. again the `--help` command helps (:

```
lightning-cli --help
Usage: lightning-cli <command> [<params>...]
--lightning-dir=<dir>  Set working directory. All other files are relative to this (default: "/home/user/.lightning")
...

```

this means you can for example do `lightning-cli --lightning-dir=/some/path/to/somedir/ getinfo`

> **Comments:**
> **username_0**: I have setup both nodes in their respective config files with their own ports and directories:  i.e....   announce-addr=x.x.x.x:9900 bind-addr=0.0.0.0:9900 ligtning-dir=/home/array/.lightning  announce-addr=x.x.x.x:9902 bind-addr=0.0.0.0:9902 ligtning-dir=/home/array/.lightning2  but when I run…  lightningd --network=bitcoin --log-level=debug  on either folder…they both startup in the .lightning folder where only one can run at a time…  
> **username_0**: perhaps i am installing and configuring c-lightning wrong....when I setup the second c-lightning....I just used git clone https://github.com/ElementsProject/lightning.git lightning2 cd lightning2  
> **username_0**: Although helpful, this doesn't solve the problem of running both at the same time. As soon as I activate the first node, the second one cannot be initiated.  
> **username_0**: It just says "We seem to be missing gossip messages"  
> **username_1**: you don't need to clone the source code twice! it is sufficient to download, compile and install the software once and then you can run two nodes exactly in the way how I wrote it. The error message "we seem to be missing gossip messages" seems to be a different problem (for example each node needs to peer with at least one public node in order to retrieve information about the network)  

---

