-
Notifications
You must be signed in to change notification settings - Fork 881
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
Etcd can't be used a datastore on multihost #392
Comments
@dave-tucker I would also argue that this needs to be fixed for 0.4, or the docs updating to say it doesn't work. It's a bit disingenuous to advertise etcd support when it has never worked. I'm happy to provide a docs PR if that's the way you think this should go? |
@tomdee - a fix for 0.4 is unrealistic as afaik we are blocked by docker/libkv#20 I agree - it's odd to advertise support for something that doesn't work - but the whole idea of libkv is to abstract away the complexity of dealing with multiple kv implementations. Our docs are trusting that the upstream repo does as it claims. I'd only recommend removing etcd from the docs if libkv plans to drop support for it. |
Hi, there is an issue in docker/libkv#26 I started that thread because i had problems of working with etcd. The solution proposals there seems solve the problem, so you can use etcd for kv storage. (at least I can use etcd with overlay and remote ovn) One more additional issue is listed there related to network delete and cascade deleting of empty endpoints belonging to the network. I was also asked there to reaise the problem in libnetwork. Thanks, br, robert. |
@tomdee are your issues resolved with the above mentioned patch? |
@dave-tucker It's probably time to update So far, the 3 backends are working on our side with Swarm because we stay in the limits imposed by docker/libkv#20 (we should document it better and add a warning section until this is fixed). Unfortunately the core issues with |
Updates moby#392 Signed-off-by: Dave Tucker <dt@docker.com>
Hi, I started again the investigation with etcd as kv store. I have the following problems:
According to @abronan watch/watchtree should be called when entries are there. If entries are not there then create it. The following changes are needed (besides changes listed in docker/libkv#26 including the change in libnetwork related to DeleteTree):
The CreateTree is just creating directory in libkv, it could be replaced with an existing API which can create directory. These changes are affecting only watchtree part in libnetwork, maybe watch should be also checked. Can anybody from here can comment it? Thanks in advance! |
@springi99 yes, I've open #462 to fix it. For both etcd and zookeeper, it's not allowed to watch a not exist node. |
@chenchun Thanks for your update! I have my temporary solution which is working. it has a little fluctuation at the beginning (local nets endpoint watchtree, but disappeared after few seconds from etcd). Because i "introduced" CreateTree() in libkv, i think my solution is not so good, however there is DeleteTree() in libkv as well (there is createDirectory in libkv, my CreateTree just wraps that). I cannot test my solution with zookeeper and consul. I try to understand those pull 466 commits. |
@springi99 @chenchun yes, we are waiting on #466 to be merged. am looking at some issues related to #466 to be addressed before merging it and letting #462 to follow. pls watch these PRs for updates. |
@tomdee @springi99 we decided to unblock these PRs by isolating #466 away from libkv upgrade. |
Hi, sorry for the delay. The "fix for zookeeper..." contains ensureKeys, and it puts docker/libnetwork/network into the datastore as an entry and not as a directory in the case of etcd. After this it is not possible to add any network to docker because it requires directory. I think same applies to endpoint. Both are there because of watchtree. |
Yes, but that is a problem of etcd and in docker/libkv#61 as @abronan mentioned
I suggest you to use consul/zk instead or wait for APIv3 of etcd. |
Hi, i don't fully understand, maybe i am wrong, but i have some problems: if you create a key (docker/libnetwork/network) and run watchtree, then it will watch the parent (docker/libnetwork/) and not the directory which will be created later (docker/libnetwork/network/ if apiv3 allows it at all). In this case watchnetworks are also triggered when there is a change in endpoint tree as it is under docker/libnetwork/. |
I don't understand. Can you please explain? |
I made a mistake, sorry for that. The current situation on code level: libnetwork's store.go has watchNetworks(). it is creating key docker/libnetwork/network (ensureKeys()). it is not a directory. Then it calls WatchTree(). But WatchTree() requires directory and not a key (libkv's etcd.go has the WatchTree() expecting directory). If i can propose here something is that try to create something like ensureDirectory() instead of ensureKeys(). |
@springi99 You can give it a try and make a PR if that works. |
etcd v2.0+ with API v2 cannot watch on a regular key, we must ensure that the initial steps involve creating a 'key' under a directory at 'path'. This is a workaround to recursively create the path and make sure that 'path' is considered as a watchable directory. These steps are necessary unless 'libkv' includes and supports the new etcd API v3 which removes the directory/key distinction. Fixes: moby#392 See: docker/libkv#20 Signed-off-by: Alexandre Beslic <abronan@docker.com>
etcd v2.0+ with API v2 cannot watch on a regular key, we must ensure that the initial steps involve creating a 'key' under a directory at 'path'. This is a workaround to recursively create the path and make sure that 'path' is considered as a watchable directory. These steps are necessary unless 'libkv' includes and supports the new etcd API v3 which removes the directory/key distinction to allow for a better abstraction. Fixes: moby#392 See: docker/libkv#20 Signed-off-by: Alexandre Beslic <abronan@docker.com>
etcd v2.0+ with API v2 cannot watch on a regular key, we must enforce the 'IsDir' parameter while creating the key for it to be considered as a directory. This step is necessary unless 'libkv' includes and supports the new etcd API v3 which removes the directory/key distinction to allow for a better abstraction. Fixes: moby#392 See: docker/libkv#20 Signed-off-by: Alexandre Beslic <abronan@docker.com>
Closing as this is working and because we have tests checking the default behavior now. Please open another issue if you still have any more problems with etcd. This will help to focus on more specific errors if there are still issues. Thanks! |
I'm unable to use etcd as a backend datastore. This is a long standing issue - AFAIK, libnetwork/libkv has never worked with etcd.
Docker output
etcd was started with
The text was updated successfully, but these errors were encountered: