GitHub user tianshimoyi added a comment to 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, 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("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiJ9.KbWpsmPprtHtMyOXk-AK2QFErQaGgjVSzCZDHAcT3YzeHfAtNI5iIAR2buCjnjVa1p3GlYz8keA1ScA5FiRPEZtzbauXj1fhaOKTBZypFs5_Nfojp-gx33qnD6PXgv30JYMm7hCkbKO60ZRIDZbSEMnuCs0tR9_ZIbEylGvsG88pfJABHzILPjvoM0xfJ5goJztEWPWTLN2bxZ5i3uKlfW_ZtCPj94q7GiV1m5Jvhjs-g5kz-4y2ODQarJ7Kk06Nq8Hkb-8KVATFtNxM8oX4yVd9aIwRJ4CihKcO-jmzPx7_SAQlU6v6uITrShOV0qCuk6kaf8e1Ema5wzmIfw5sQA"));
        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("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiJ9.OFwzpQX0S-KUyKC1b-6S0CuXG9hJbu79jYSMoecHadojJtz9JTJTAALHNG2KTxrb_tzKSvUK5ytRaQ9f66LyPORSbxqJHSo1x3n8A0MlFVaSzVOmge0HSzYm53oHC2NtG7Ng-c5M_r1ZJmZ17oOfmFU_5cU3kOWaIidh4f6h3nyL9l9bDmqhE0pZv_Kv0poUyGSnaYwoi1vR--OxrpGzBdr7KgQs7MCjpFF8UiGnGlgwaFvGb16LixPBXKHrHYPwfDuoSQTFmCY3FM_fp5DUMygDP2-Q1NN9ykESArubydT6Abh0Ebp0PraRhzLm8ad7W4Vo837V4RsJuIimGs6Mow"))
                    .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 commits@pulsar.apache.org.
To unsubscribe, please send an email to: commits-unsubscr...@pulsar.apache.org

Reply via email to