housepower / clickhouse_sinker

Easily load data from kafka to ClickHouse
https://housepower.github.io/clickhouse_sinker
Apache License 2.0
516 stars 118 forks source link

Config memagement with Nacos #80

Closed yuzhichang closed 3 years ago

yuzhichang commented 3 years ago

Nacos golang client: https://github.com/nacos-group/nacos-sdk-go

ArtemChekunov commented 3 years ago

Maybe consul ?

yuzhichang commented 3 years ago

@ArtemChekunov Unfortunately consul is unavailable in our product.

sundy-li commented 3 years ago

We can abstract the interface of configs, like IConfig, HttpConfig, LocalConfig, NacosConfig

yuzhichang commented 3 years ago

This issue can be combined with #84 .

I suggest following Config structure which all clickhouse_sinker instances share(fetched from Nacos, Consul, ZK etc.):

type Config struct {
    Kafka      map[string]*KafkaConfig
    Clickhouse map[string]*ClickHouseConfig
    Tasks []*TaskConfig
    Common struct {
        FlushInterval     int
        BufferSize        int
        MinBufferSize     int
        MsgSizeHint       int
        ConcurrentParsers int
        LayoutDate        string
        LayoutDateTime    string
        LayoutDateTime64  string
        LogLevel          string
    }
    Assigns map[string][]string  //map instance_name to a list of task_name
}

Each instance can run multiple tasks. Each task can be assigned to multiple instances. Each task declares how many instances it needs.

The coordinator

The schedule platform

The schedule platform(or maybe manually, outside my concern) start some clickhouse_sinker instances and start another one if a instance fail.

clickhouse_sinker

yuzhichang commented 3 years ago

Implemented with #86.