apache-curator

Apache Curator TestingServer creation throws java.lang.NoSuchMethodError

笑着哭i 提交于 2020-04-30 06:31:22
问题 I am trying to just run a TestingServer to be able to write unit tests for it. val zkServer = new TestingServer(2182) println(zkServer.getPort) My pom has the following dependencies related to Curator, I have tried version 4.2.0 and 4.3.0, both throw the same error: <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>${apache.curator.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.curator/curator-recipes --

Notifying an instance as down using a ServiceCache in Curator

梦想与她 提交于 2020-01-05 04:10:11
问题 The documentation for Curator (http://curator.apache.org/curator-x-discovery/index.html) says: If a particular instance has an I/O error, etc. you should call ServiceProvider.noteError() passing in the instance. I am using a ServiceCache to get my instances, rather than a ServiceProvider (see Using selection strategies with a cache in Curator). Where can I find the noteError() method here? I can't find it on the cache object 回答1: There is no noteError() on a ServiceCache, however as @Randgalt

When CuratorFramework's methods start and close shoud be called?

安稳与你 提交于 2019-12-24 17:09:59
问题 According to documentation CuratorFramework instances are fully thread-safe. You should share one CuratorFramework per ZooKeeper cluster in your application. It also states that the method start should be called before any other operations can be performed. Should this method be called before every operation or calling it once after initialization is enough? 回答1: Call start once after creating the CuratorFramework instance. So, the startup is: Create the CuratorFramework via one of the

Apache Zookeeper / Curator time-to-live on locks

断了今生、忘了曾经 提交于 2019-12-22 04:47:14
问题 Is there any facility in the Apache Curator lock recipes (or lower-level ZooKeeper) for auto-releasing locks that have exceeded some TTL? If not, is there a best practice for dealing with that? I see that Curator automatically releases locks in the case of the client connection being lost, which is nice...and the timeout on lock acquisition is also helpful. I'm wondering to what degree I need to protect my system by making a recurring job that looks for locks that have been around to long and

Zookeeper missed events on successive changes

筅森魡賤 提交于 2019-12-12 20:56:31
问题 I currently have a setup with a single zookeeper node and Curator to access the data. Reading data is done through a Curator TreeCache. I have the following test: public void test_callback_successive_changes_success_global_new_version() throws InterruptedException { ZookeeperTestsHelper.createNewNodeInZookeeperSingleCommand("/my/path/new_node", "some string4", curator); ZookeeperTestsHelper.createNewNodeInZookeeperSingleCommand("/my/path/new_node", "some string5", curator); Thread.sleep(1000)

Using selection strategies with a cache in Curator

你。 提交于 2019-12-11 15:54:13
问题 The page on Service Discovery using apache curator (https://github.com/Netflix/curator/wiki/Service-Discovery) introduces the following concepts: The main abstraction class is ServiceProvider. It encapsulates the discovery service for a particular named service along with a provider strategy. A provider strategy is a scheme for selecting one instance from a set of instances for a given service. There are three bundled strategies: Round Robin, Random and Sticky (always selects the same one).

How to detect when Apache Zookeeper sessions are lost or timed out?

时光毁灭记忆、已成空白 提交于 2019-12-11 04:47:38
问题 Assume we have an Apache Zookeeper quorum up and running and n client nodes connected (using Apache Curator). Is it possible to receive notifications on one of the nodes (the one we are observing) from zookeeper when any of the other nodes sessions are terminated or a timeout is reached? If so, how is this accomplished? 回答1: The answer is fairly simple and can be accomplished using Ephemeral nodes and PathChildrenCache. Zookeeper will detect when a node times out (in this example we set the

How to get Stats of a Zookeeper node using Curator framework

最后都变了- 提交于 2019-12-11 02:19:35
问题 I am using curator framework in java to interact with ZNodes. How do we get node stats like last_modified time and creation time etc. I could do same in python using kazoo framework. from kazoo.client import KazooClient zk_client = KazooClient(hosts='127.0.0.1:2181') zk_client.start() data, stat = zk_client.get("/my/favorite") Ref. Link: kazoo I tried searching similar support via curator and couldn't get result. Kindly help here. Thanks. 回答1: Curator (note I'm the main author of Curator)

Apache Curator NPE in JsonInstanceSerializer

…衆ロ難τιáo~ 提交于 2019-12-07 16:10:37
问题 I am facing a strange NPE when starting Apache Curator's ServiceProvider . This happens intermittently on the servers, but I was not able to reproduce the error locally, that's why it's so difficult to know what's the problem. Here's the code: CuratorFramework curatorFramework = CuratorFrameworkFactory.newClient(zookeeperConnectString, new RetryNTimes(5, 1000)); curatorFramework.start(); ServiceDiscovery<Void> serviceDiscovery = ServiceDiscoveryBuilder.builder(Void.class).basePath(ZK_BASE