New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to replicate databases? #93
Comments
|
Thanks @Andlinks-Yourturn for opening the issue! I'm not sure what exactly you mean by "have nodes synced by default", perhaps you can elaborate what problems you're having? As for getting peers to connect and sync, I would recommend to try out the PR here: orbitdb/orbit-db-cli#8. It contains a fix that makes peers to automatically start syncing when they connect. We're working on getting that PR merged into master and released soon. As for how to replicate (sync) a database between peers, see https://github.com/orbitdb/orbit-db-cli#replicate. Let me know if this doesn't solve your problem. |
|
Thx, @haadcode I checked the other node It seems the dababase is not replicated. Can you point out where's wrong? Thanks so much ^^ |
|
Got it. So there's couple of things you need to do: First, we currently don't have a support for running a separate IPFS daemon to be used with OrbitDB, but we will in the future. What this means is that you don't need to start the go-ipfs daemon to run OrbitDB (and thus can't use private network, yet). In short: OrbitDB will start IPFS for you. Second, the reason why your second node say "database is empty" is that by default it'll only try to load the database locally and since it's not replicated yet, it's considered empty. To make it work, you can pass Third, note that all of the above will work smoothly only with the aforementioned PR, so make sure you're using that. And note that when using that PR, you need to run Fourth, if you don't want to use the PR above, you can still get the replication working but it won't start automatically, so the first peer needs to be connected to the second peer and then issue an update to the database (ie. And on the second peer: The first peer will then wait and connect to the second peer and in the dashboard output of the second peer you'll see "Peers: 1 / 1" when they are connected. Once you see that, the first peer will display a prompt where you can write text and upon hitting enter, the first peer will add the text to the database and it'll be replicated to the second peer. You can confirm this by looking at the dashboard and see that there's one entry in the database ("Replicating ... 1 / 1 | 100%"). When you see the entry on the second peer, you can close it with ctrl-c (twice) and then run: ...and it'll display the entry you just added. I understand this is a bit cumbersome with the version in master/npm and as such I highly recommend to use the PR as it fixes these problems and makes everything "automatic" and easy in terms of the replication. Let me know if this helps or if you have more questions. Feedback in generally is also highly appreciated! Edited the issue description to better describe what's been discussed here |
|
Hey, @haadcode I ran with PR branch And I'd love to know if it's possible for Orbitdb to run on a privae swarm. Look forward to contribute on this subject. |
|
@Andlinks-Yourturn - I am doing my research on this as well. But looking at the source, and @haadcode 's comment, I think this is still WIP. |
|
Where can I find the settings to resolve options.create=false? I tried to manually adjust the config.js either before compiling and after... always the same error. |
|
@iivooo I'm getting this error too. Not sure what the problem is. Edit: got it! When you create your db, it spits out a directory with a hash in it. Use that as the directory of your database. |
|
Error during replication. I've started the first peer with 'orbitdb replicate -p --dashboard' and then started second with 'orbitdb add -r --sync'. It starts replicating but on the last item the second peer throws an error: It replicates all but last item to the peer. The item is added on the second peer but not replicated. |
|
@dibu28 thanks for reporting the issue! This should now be fixed in master and release 0.0.15 on npm. Latest ipfs and orbit-db contains the fix. Re. the other error mentioned by @iivooo and @lpulley, indeed use the full address that orbit-db gives out as the result of a 'create' as noted by @lpulley. All commands except 'create' should require the full orbit-db address. |
|
Hello, I have questions regarding the similar topic. |
|
Moving to the Field Manual for deeper discussion |
Andlinks-Yourturn commentedNov 3, 2017
Hey, there
I am new to orbitdb, and I think it's amazing. But I didn't see how to add peers in orbitdb. Can we get the nodes synced by default ?
Thanks in advance
Cheers ^^
The text was updated successfully, but these errors were encountered: