-1

clickhouse version is 23 run in docker

CREATE TABLE queue (
    name String,
    type String
) 
ENGINE = Kafka()
SETTINGS kafka_broker_list = '172.21.0.4:9092', 
         kafka_topic_list = 'test',
         kafka_group_name = 'group1',
         kafka_format = 'JSONEachRow'
         
         
         CREATE TABLE target (
    name String,
    type String
) 
ENGINE = MergeTree ORDER BY type

CREATE MATERIALIZED VIEW consumet TO target
AS 
SELECT * FROM queue 

kafka run in docker enter image description here

when I created the view .The clickhouse has error enter image description here

so if i want to use clickhouse to consumer kafka message how can I do ?

I want to consumer kafka message

Mr.c
  • 23
  • 5
  • And than I check the network by containers . clickhouse ip is 172.21.0.5, kafka ip is 172.21.0.5 . And 172.21.0.5 can telnet 172.21.0.4 9092. I update kafka_broker_list = '172.21.0.5:9092',but it always can't work – Mr.c Aug 23 '23 at 02:07
  • 1
    1. Never use IP addresses between two containers. 2. 127.0.0.1 refers to the clickhouse container (if it's running in one, not Kafka – OneCricketeer Aug 23 '23 at 03:27
  • yes so I update the addess ,but it didn't work. – Mr.c Aug 23 '23 at 03:32
  • It's actually not that simple. There's an environment variable that needs set on the Kafka container first. There's a blog linked in the duplicate post that explains in more detail. Then you should use the container name, not an IP address – OneCricketeer Aug 23 '23 at 03:54
  • Basically, you should use the same bootstrap connection string that your CMAK Ui is using (assuming that's not connecting with Zookeeper) – OneCricketeer Aug 23 '23 at 03:56

0 Answers0