10

For testing, I want to be able to run several IPFS nodes on a single machine.

This is the scenario: I am building small services on top of IPFS core library, following the Making your own IPFS service guide. When I try to put client and server on the same machine (note that each of them will create their own IPFS node), I will get the following:

panic: cannot acquire lock: Lock FcntlFlock of /Users/long/.ipfs/repo.lock failed: resource temporarily unavailable

3 Answers 3

20

Usually, when you start with IPFS, you will use ipfs init, which will create a new node. The default data and config stored for that particular node are located at ~/.ipfs. Here is how you can create a new node and config it so it can run besides your default node.

1. Create a new node

For a new node you have to use ipfs init again. Use for instance the following:

IPFS_PATH=~/.ipfs2 ipfs init

This will create a new node at ~/.ipfs2 (not using the default path).

2. Change Address Configs

As both of your nodes now bind to the same ports, you need to change the port configuration, so both nodes can run side by side. For this, open ~/.ipfs2/configand findAddresses`:

"Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "Swarm": [
        "/ip4/0.0.0.0/tcp/4001",
        "/ip6/::/tcp/4001"
    ]
}

To for example the following:

"Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5002",
    "Gateway": "/ip4/127.0.0.1/tcp/8081",
    "Swarm": [
        "/ip4/0.0.0.0/tcp/4002",
        "/ip6/::/tcp/4002"
    ]
}

With this, you should be able to run both node .ipfs and .ipfs2 on a single machine.


Notes:

  1. Whenever you use .ipfs2, you need to set the env variable IPFS_PATH=~/.ipfs2
  2. In your example you need to change either your client or server node from ~/.ipfs to ~/.ipfs2
  3. you can also start the daemon on the second node using IPFS_PATH=~/.ipfs2 ipfs daemon &
6
  • How do you run the both nodes at the same time ?. Setting IPFS_PATH=~/ipfs2, it uses 2nd node right ? Jul 3, 2017 at 5:10
  • 2
    You can, for example, run IPFS_PATH=~/ipfs ipfs daemon in one terminal and IPFS_PATH=~/ipfs2 ipfs daemon in another one. Not sure if this answers your question.
    – Long Hoang
    Jul 5, 2017 at 20:27
  • Yes this was my query and thank you clarifying it, but since its possible to run 2 nodes at the same time. How can I link them?. Is it possible ?. Jul 7, 2017 at 8:11
  • I am guessing you have to start the 2nd daemon as well. is the command for starting the daemon.. IPFS_PATH=~/.ipfs2 ipfs daemon &? Is there a way to verify that the correct port is being used?
    – alpha_989
    Jul 12, 2017 at 16:38
  • In following the above instructions, my first node at localhost:5001/webui loads localhost:5001/ipfs/… and opens UI as expected. However, localhost:5002/webui outputs this in the browser: ipfs resolve -r /ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/: merkledag: not found. Any clues as to what i did wrong? Thanks
    – iamtoc
    Dec 21, 2017 at 5:46
0

enter image description here

Hello, I use ipfs2, after running two daemons at the same time, can indeed open localhost:5001 / webui, run the second localhost:5002 / webui has an error, as shown in the attachment

2
  • Please insert image into your answer, so I will be available even when outside website is down. Jun 30, 2018 at 12:47
  • Ok, you can't see my uploaded picture? My situation is similar to that of alpha_989 mentioned above. Thank you! Jul 1, 2018 at 6:39
-1

Here are some ways I've used to create multiple nodes/peers ids.

I use windows 10.

  • 1st node go-ipfs (latest version)
  • 2nd node Siderus Orion ifps (connect to Orion node , not local) -- https://orion.siderus.io/

Use VirtualBox to run a minimal ubuntu installation. (You can set up as many as you want) Repeat the process and you have 4 nodes or as many as you want.

https://discuss.ipfs.io/t/ipfs-manager-download-install-manage-debug-your-ipfs-node/3534 is another gui that installs and lets you manage all ipfs commands without CMD. He just released it a few days ago and it looks well worth lots of reviews.

Disclaimer I am not a coder or computer professional. Just a huge fan of IPFS! I hope we can raise awareness and change the world.

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.