S3Queue table engine keeps its state in ClickHouse Keeper (or ZooKeeper), also when there is only one server. The default configuration of a self-managed server has no connection to ClickHouse Keeper, so creating an S3Queue table fails with NO_ELEMENTS_IN_CONFIG. On a single server, enable the ClickHouse Keeper that is built into clickhouse-server and restart.
The error
Why S3Queue needs ClickHouse Keeper
An S3Queue table registers itself in ClickHouse Keeper and records there which files it has already processed, so that every file is loaded once, also after a restart or when several replicas read the same bucket. The location is the keeper_path table setting, by default a path under /clickhouse/s3queue/.
The server takes the address of ClickHouse Keeper from its configuration. When there is none, the statement fails with the error above.
This is true for every value of the mandatory mode setting. A table with mode = 'exclusive' does not track processed files, but creating it on a server without ClickHouse Keeper fails with the same error.
Enable the embedded ClickHouse Keeper
Create a file such as/etc/clickhouse-server/config.d/keeper.xml:
- The
keeper_serversection starts a one-node ClickHouse Keeper inside the server process. It listens for clients ontcp_port. - The
zookeepersection tells the server where to connect. If you leave it out, the server connects to the hosts ofraft_configurationontcp_port, which gives the same result here.
CREATE TABLE statement again. It now succeeds:
A one-node ClickHouse Keeper inside the server is enough for a single server or a test setup. For a cluster, set it up as described in the ClickHouse Keeper guide.
Notes
- The table starts reading files only after you attach a materialized view to it, as described in the
S3Queuereference. - Processed and failed files are logged to
system.s3queue_logif thes3queue_logsection is present in the server configuration and the table settingenable_logging_to_queue_logis on, which is its default. The log table is created by the first flush: see Why is a system log table missing after I enabled it?. - The same missing configuration makes
CREATE TABLE ... ENGINE = ReplicatedMergeTreefail with a different message:Can't create replicated table without ZooKeeper. (NO_ZOOKEEPER).