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?

@Shoothzj  @tisonkun  Hi, My steps are as follows:
1. Open the producer consumption message
2. Turn off all promary broker nodes
Then it was found that there was no master-slave switchover, and the failure 
time had exceeded failoverDelay=10s

![截屏2023-03-21 上午10 09 
48](https://user-images.githubusercontent.com/68532999/226503108-0ad74144-25d2-4a21-a92d-53de80470254.png)

producer code:

```java
public class PulsarTest {

    public static void main(String[] args) {
        String primaryUrl = "pulsar://10.0.68.235:6650";
        String secondaryUrl = "pulsar://10.0.64.134:6650";
        Map<String,Authentication> m = new HashMap<>();
        m.put(secondaryUrl,AuthenticationFactory.token("xxxx"));
        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("xxxx"))
                    .build();
            Producer<String> producer = client.newProducer(Schema.STRING)
                    .topic("public/tcloud-log/test")
                    .create();
            long index = 0;
            while (true) {
                String msg = "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();
        }
    }
}

```

client version: 2.10.3

GitHub link: 
https://github.com/apache/pulsar/discussions/19818#discussioncomment-5376325

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to