gpt4 book ai didi

docker-compose - Clickhouse 客户端 - 代码:62。DB::Exception:空查询

转载 作者:行者123 更新时间:2023-12-02 18:55:36 27 4
gpt4 key购买 nike

我正在尝试使用 DockerDocker Compose 运行 clickhouse-serverclickhouse-client 服务。基于clickhouse docker-compose fileanother compose sample ,我在 docker-compose.yml 文件中创建了服务,如下所示:

docker-compose.yml:

    ch_server:
container_name: myapp_ch_server
image: yandex/clickhouse-server
ports:
- "8181:8123"
- "9000:9000"
- "9009:9009"
ulimits:
nproc: 65535
nofile:
soft: 262144
hard: 262144
volumes:
- ./ch_db_data:/var/lib/clickhouse/
- ./ch_db_logs:/val/log/clickhouse-server/
networks:
- myapp-network

ch_client:
container_name: myapp_ch_client
image: yandex/clickhouse-client
command: ['--host', 'ch_server']
networks:
- myapp-network

当我运行 docker-compose up 命令时,clickhouse-client 服务出现以下异常:

myapp_ch_client | Code: 62. DB::Exception: Empty query
myapp_ch_client exited with code 62

您知道如何修复此错误吗?

最佳答案

它只需要在命令中传递SQL查询-params:

version: "2.4"

services:
ch_server:
container_name: myapp_ch_server
image: yandex/clickhouse-server
ports:
- "8123:8123"
- "9000:9000"
- "9009:9009"
ulimits:
nproc: 65535
nofile:
soft: 262144
hard: 262144
volumes:
- ./ch_db_data:/var/lib/clickhouse/
- ./ch_db_logs:/var/log/clickhouse-server/
networks:
- myapp-network
healthcheck:
test: wget --no-verbose --tries=1 --spider localhost:8123/ping || exit 1
interval: 2s
timeout: 2s
retries: 16

ch_client:
container_name: myapp_ch_client
image: yandex/clickhouse-client
command: ['--host', 'ch_server', '--query', 'select * from system.functions order by name limit 4']
networks:
- myapp-network
depends_on:
ch_server:
condition: service_healthy

networks:
myapp-network:

docker-compose中定义clickhouse-client没有意义。 clickhouse-client 通常在 docker-compose 文件之外运行:

  1. 定义docker-compose,定义服务器(例如ClickHouse(集群节点)、Zookeeper、Apache Kafka 等)。例如,我们考虑一下 ClickHouse 的一个节点的配置:
version: "2.4"

services:
ch_server:
container_name: myapp_ch_server
image: yandex/clickhouse-server
ports:
- "8123:8123"
- "9000:9000"
- "9009:9009"
ulimits:
nproc: 65535
nofile:
soft: 262144
hard: 262144
volumes:
- ./ch_db_data:/var/lib/clickhouse/
- ./ch_db_logs:/var/log/clickhouse-server/
networks:
- myapp-network
healthcheck:
test: wget --no-verbose --tries=1 --spider localhost:8123/ping || exit 1
interval: 2s
timeout: 2s
retries: 16

networks:
myapp-network:

  • 在单独的终端中运行clickhouse-client
  • cd _folder_where_docker-compose_located

    docker-compose exec ch_server clickhouse-client

    关于docker-compose - Clickhouse 客户端 - 代码:62。DB::Exception:空查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66200505/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com