> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# S3Queue fails with "There is no Zookeeper configuration in server config" on a single-node server

> An S3Queue table needs ClickHouse Keeper even on a single self-managed server. Resolve the NO_ELEMENTS_IN_CONFIG error by enabling the embedded ClickHouse Keeper in clickhouse-server.

The [`S3Queue`](https://clickhouse.com/docs/reference/engines/table-engines/integrations/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

```sql theme={null}
CREATE TABLE s3_queue
(
    id UInt64,
    message String
)
ENGINE = S3Queue('https://my-bucket.s3.amazonaws.com/incoming/*.csv', NOSIGN, 'CSV')
SETTINGS mode = 'ordered';
```

```text theme={null}
Code: 139. DB::Exception: There is no Zookeeper configuration in server config. (NO_ELEMENTS_IN_CONFIG)
```

## 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`](https://clickhouse.com/docs/reference/engines/table-engines/integrations/s3queue#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`:

```xml theme={null}
<clickhouse>
    <keeper_server>
        <tcp_port>9181</tcp_port>
        <server_id>1</server_id>
        <log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
        <snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>
        <raft_configuration>
            <server>
                <id>1</id>
                <hostname>localhost</hostname>
                <port>9234</port>
            </server>
        </raft_configuration>
    </keeper_server>

    <zookeeper>
        <node>
            <host>localhost</host>
            <port>9181</port>
        </node>
    </zookeeper>
</clickhouse>
```

* The `keeper_server` section starts a one-node ClickHouse Keeper inside the server process. It listens for clients on `tcp_port`.
* The `zookeeper` section tells the server where to connect. If you leave it out, the server connects to the hosts of `raft_configuration` on `tcp_port`, which gives the same result here.

Restart the server and run the `CREATE TABLE` statement again. It now succeeds:

```sql theme={null}
SELECT name, engine
FROM system.tables
WHERE name = 's3_queue';
```

```text theme={null}
   ┌─name─────┬─engine──┐
1. │ s3_queue │ S3Queue │
   └──────────┴─────────┘
```

> [!NOTE]
>
> 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](https://clickhouse.com/docs/guides/oss/deployment-and-scaling/keeper.md).

## Notes

* The table starts reading files only after you attach a materialized view to it, as described in the [`S3Queue` reference](https://clickhouse.com/docs/reference/engines/table-engines/integrations/s3queue#description).
* Processed and failed files are logged to `system.s3queue_log` if the `s3queue_log` section is present in the server configuration and the table setting `enable_logging_to_queue_log` is 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?](https://clickhouse.com/docs/resources/support-center/knowledge-base/troubleshooting/system-log-table-missing-after-enabling.md).
* The same missing configuration makes `CREATE TABLE ... ENGINE = ReplicatedMergeTree` fail with a different message: `Can't create replicated table without ZooKeeper. (NO_ZOOKEEPER)`.

## Related pages

* [`S3Queue` table engine](https://clickhouse.com/docs/reference/engines/table-engines/integrations/s3queue)
* [ClickHouse Keeper](https://clickhouse.com/docs/guides/oss/deployment-and-scaling/keeper.md)
* [`zookeeper` server setting](https://clickhouse.com/docs/reference/settings/server-settings/settings/zookeeper#zookeeper)
