clickhouse-operator icon indicating copy to clipboard operation
clickhouse-operator copied to clipboard

pod configured with ClusterScopeIndex, the operator cannot access correct port

Open enumz opened this issue 3 years ago • 3 comments

When configure different ports for different pods, it seems operator try access clickhouse instance only through chPort which in the operator configuration.

For example: chi-examples/15-hostNetwork-02-simple-port-distribution.yaml

and chPort is 13000

E0414 16:56:04.655493 6 connection.go:83] connect():FAILED Ping(http://:@***:13000/). Err: dial tcp ****:13000 : connect: connection refused

E0414 16:56:04.655530 6 connection.go:170] Exec():FAILED connect(http://:@***:13000/) for SQL: CREATE DATABASE IF NOT EXISTS "default" Engine = Ordinary

enumz avatar Apr 14 '22 17:04 enumz

Hi @enumz, .spec.chPort considered as deprecated right now. Just to confirm can you see your change in the clickhouse-operator configuration file, because all these parameters are comming from this file: https://github.com/Altinity/clickhouse-operator/blob/7ec06b79eb70430d546f9a085c92a5339c8f3e4a/config/config.yaml#L85

roshanths avatar Apr 25 '22 06:04 roshanths

Hi @roshanths , I think the http port should be acquired at runtime, not in the config file. Because CHI support different shards or different replicas use different ports:

apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
  name: "demo"
spec:
  configuration:
    clusters:
      - name: "demo"
        layout:
          replicasCount: 3
          shards:
            - templates:
                hostTemplate: shard-00-template
            - templates:
                hostTemplate: shard-01-template

  templates:
    hostTemplates:
      - name: shard-00-template
        spec:
          tcpPort: 9000
          httpPort: 10000
          interserverHTTPPort: 11000
      - name: shard-01-template
        spec:
          tcpPort: 9001
          httpPort: 10001
          interserverHTTPPort: 11001
  templates:
    hostTemplates:
      - name: port-distribution
        portDistribution:
          - type: ClusterScopeIndex
        spec:
          tcpPort: 10000
          httpPort: 11000
          interserverHTTPPort: 12000

enumz avatar Apr 26 '22 05:04 enumz

Cluster has to have the same port (as specified in operator configuration) on all nodes in order schema management functions to be executed by the operator

sunsingerus avatar Apr 27 '22 11:04 sunsingerus