confluentinc / ksql

The database purpose-built for stream processing applications.
https://ksqldb.io
Other
127 stars 1.04k forks source link

Java client issue with DNS host of multiple KsqlDb servers. #8468

Open kiyeoneee opened 2 years ago

kiyeoneee commented 2 years ago

Describe the bug A clear and concise description of what the bug is. When using the ksqldb java client, it responds normally when request to each ksqldb server, but when request with Dns, it gets hang. When I requested a full query of the code to DNS host with KSqlDb Cli and rest API, I responded normally.

To Reproduce Steps to reproduce the behavior, include: Three ksqlDb servers with 7.0.0 version. I add io.confluent.ksql:ksqldb-api-client:7.0.0 dependency on java project. Java source:

    @Test
    public void getTableInfos() throws ExecutionException, InterruptedException {
        ClientOptions clientOptions = ClientOptions.create()
                                                   .setHost("ONE_OF_KSQLDB_SERVERS_HOST")  // it works
                                                   .setPort(8089);  // I set ksqlDb server port like this
//                                                   .setHost("KSQLDB_DNS_HOST")  // it not works
//                                                   .setPort(80);
        final Client client = Client.create(clientOptions);

        // topic print
        final List<TopicInfo> topicInfos = client.listTopics().get();
        topicInfos.forEach(System.out::println);

        // pull query
//        final String query = "select * from SAMPLE_TABLE;";
//        Map<String, Object> properties = Collections.singletonMap("auto.offset.reset", "earliest");
//
//        BatchedQueryResult batchedQueryResult = client.executeQuery(query, properties);
//        List<Row> rows = client.executeQuery(query, properties).get();
//        rows.forEach(row -> System.out.println(row.toString()));

        client.close();
    }

Expected behavior A clear and concise description of what you expected to happen. Like when using KsqlDb cli or restapi, I think java clients should receive a response when they request dns of load balancer of three servers.

Actual behaviour A clear and concise description of what actually happens, including: Java client print any log.

Additional context Add any other context about the problem here. I request

cprasad1 commented 2 years ago

@kiyeoneee can you describe the setup + configuration of the load-balancer and the DNS host you are using? It will also be helpful to get the ksql-server.properties files of all the ksqlDB servers you have spun up