clickhouse/clickhouse
Apps
ClickHouse ships as a single multi-call binary: clickhouse. Symlinks like clickhouse-server, clickhouse-client, clickhouse-local are dispatched via argv[0]. The dispatch table is in programs/main.cpp.
The directories under programs/ hold the per-app code; the heavy lifting happens in src/ (see Systems).
Catalog
| Subcommand | Source | Purpose |
|---|---|---|
server |
programs/server/ |
The long-running database server. See Server. |
client |
programs/client/ |
Interactive native-protocol terminal. See Client. |
local |
programs/local/ |
Embedded engine running queries against local files. See Local. |
keeper |
programs/keeper/ |
Native Raft-based coordination service. See Keeper. |
keeper-client |
programs/keeper-client/ |
Interactive client for clickhouse-keeper. |
keeper-converter |
programs/keeper-converter/ |
Migrates ZooKeeper snapshots into Keeper format. |
keeper-bench |
programs/keeper-bench/ |
Coordination throughput benchmark. |
keeper-data-dumper |
programs/keeper-data-dumper/ |
Dumps Keeper Raft logs/snapshots for forensics. |
keeper-utils |
programs/keeper-utils/ |
Misc Keeper-side utilities. |
benchmark |
programs/benchmark/ |
Concurrency benchmark issuing parallel queries. |
compressor |
programs/compressor/ |
Compress/decompress files using ClickHouse codecs. |
format |
programs/format/ |
Pretty-prints/normalizes a SQL query through the parser. |
obfuscator |
programs/obfuscator/ |
Anonymises a dataset while preserving statistical properties (used for sharing reproducers). |
disks |
programs/disks/ |
A REPL/CLI for inspecting and manipulating any configured IDisk. |
git-import |
programs/git-import/ |
Imports a git repo's commits/files into ClickHouse for analysis. |
static-files-disk-uploader |
programs/static-files-disk-uploader/ |
Bulk-uploads files into an object-storage disk. |
extract-from-config |
programs/extract-from-config/ |
Reads a single value out of config.xml (used by init scripts). |
su |
programs/su/ |
A small su clone used by the official Docker entry point. |
docker-init |
programs/docker-init/ |
The official Docker entry point. |
install / start / stop / status / restart |
programs/install/ |
Self-installation onto a host (legacy, single-binary deploys). |
check-marks |
programs/check-marks/ |
Verifies *.mrk* mark file consistency. |
checksum-for-compressed-block |
programs/checksum-for-compressed-block/ |
Recomputes a checksum for a compressed block (forensics). |
zookeeper-dump-tree / zookeeper-remove-by-list |
programs/zookeeper-*/ |
One-off ZooKeeper maintenance tools. |
hash-binary |
inline in main.cpp |
Prints getHashOfLoadedBinaryHex() for tamper detection. |
self-extracting |
programs/self-extracting/ |
Build helper for the self-extracting installer. |
bash-completion |
programs/bash-completion/ |
Bash/zsh completion script. |
Dispatch
clickhouse foo runs the foo entry point. So does:
- A symlink named
clickhouse-foo. - A flag
--fooas the first argument (clickhouse --client ...). - For convenience, when you run a bare
clickhousebinary on a script-like argument, it routes tolocal(soclickhouse my_query.sqlisclickhouse-local my_query.sql). - If the argument list contains
--hostor--port, it routes toclient.
The relevant logic is isClickhouseApp() in programs/main.cpp.
Hardening done in main.cpp
dlopen/dlclose/dlerrorare overridden to do nothing — the binary refuses to load arbitrary shared libraries (see the comment "We absolutely discourage the ancient technique of loading 3rd-party uncontrolled dangerous libraries...").- Sanitizer defaults are baked in (e.g.
halt_on_error=1for ASan/TSan,print_stacktrace=1for UBSan, ignored OpenSSL leak suppressions). updatePHDRCache()is called early so signal handlers can produce reliable stack traces.OpenSSLInitializer::instance()is invoked from a constructor with priority202to guarantee correct ordering.- Jemalloc default messages are silenced in release.
Where to read next
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.