GitHub user tianshimoyi edited a comment on the discussion: Does the
Cluster-level failover of pulsar have any requirements on the version of
pulsar? Is version 2.10 or higher required? 2.9.4 Can it be used?
@merlimat I tried to test with pulsar version 2.9.4, client library version
2.10.3, but it didn't work!
producer code
```java
public class PulsarTest {
public static void main(String[] args) {
String primaryUrl = "pulsar://10.0.87.203:6650";
String secondaryUrl = "pulsar://10.0.88.116:6650";
Map<String, Authentication> m = new HashMap<>();
m.put(secondaryUrl, AuthenticationFactory.token("xxxxx"));
ServiceUrlProvider failover = AutoClusterFailover.builder()
.primary(primaryUrl)
.secondary(List.of(secondaryUrl))
.failoverDelay(10, TimeUnit.SECONDS)
.switchBackDelay(30, TimeUnit.SECONDS)
.checkInterval(1000, TimeUnit.MILLISECONDS)
.secondaryAuthentication(m)
.build();
try {
PulsarClient client = PulsarClient.builder()
.serviceUrlProvider(failover)
.authentication(AuthenticationFactory.token("xxxxx"))
.build();
Producer<String> producer = client.newProducer(Schema.STRING)
.topic("public/default/t1")
.create();
long index = 0;
while (true) {
String msg = new String("hello-" + index);
producer.send(msg);
Thread.sleep(1000);
index = index + 1;
System.out.println(msg + " send ok");
}
} catch (Exception e) {
System.out.println("exit");
e.printStackTrace();
}
}
}
```
Then I shut down all the Broker nodes of the main cluster, and no switchover
occurred. Is there something wrong with the code? Or Broker requires special
configuration ?
GitHub link:
https://github.com/apache/pulsar/discussions/19818#discussioncomment-5328314
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]