[{"data":1,"prerenderedAt":212},["ShallowReactive",2],{"seo-verification":3,"blog-hosting-clickhouse-on-a-vps-ma-en":6,"promo-bar-likely":211},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"key":7,"data":8},"blog-hosting-clickhouse-on-a-vps-ma-en",{"id":9,"slug":10,"slugs":11,"title":15,"excerpt":16,"readTime":17,"views":18,"isPinned":19,"noindex":19,"publishedAt":20,"updatedAt":21,"category":22,"categories":28,"featuredImage":30,"bgImage":31,"posterImage":32,"relatedSolution":33,"intro":36,"sections":37,"ctaTitle":130,"ctaBody":131,"ctaButton":132,"ctaUrl":133,"relatedPosts":134},64,"hosting-clickhouse-on-a-vps",{"fr":12,"en":10,"ar":13,"es":14},"heberger-clickhouse-vps","استضافة-clickhouse-على-خادم-vps","alojar-clickhouse-en-un-vps","Hosting ClickHouse on a VPS","Host ClickHouse on your VPS: a columnar analytical database for your logs, metrics, and dashboards. Docker, memory tuning, and SSL guide.",9,0,false,"2026-04-17T00:00:00+00:00","2026-11-04T16:30:25+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},6,"Databases","bases-de-donnees","bg-teal-500\u002F10 text-teal-400","database",[29],{"id":23,"name":24,"slug":25,"color":26,"icon":27},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fheberger-clickhouse-vps-poster.svg",{"categorySlug":34,"appSlug":35},"databases","clickhouse","ClickHouse is a column-oriented analytical database capable of aggregating billions of rows in a few milliseconds. It's the reference tool for reporting, log analysis, and real-time dashboards, and it self-hosts very well on a properly sized VPS. Here's how to deploy it with Docker, secure it, and configure it for optimal performance.",[38,42,52,55,77,80,83,86,89,92,127],{"type":39,"title":40,"body":41},"h2","Why self-host ClickHouse on a VPS","ClickHouse excels at analytical queries (OLAP): thanks to its column storage and aggressive compression, it can scan terabytes on modest hardware where a classic relational database would collapse. Self-hosting on a VPS saves you the per-query costs of managed offerings (ClickHouse Cloud, BigQuery) and gives you full control over schema, table engines, and retention. It is especially relevant for ingesting your own application logs, product metrics, or analytics events without sending your data to a third party. Since ClickHouse often compresses data by a factor of 5 to 10, a VPS with a reasonable SSD can store hundreds of millions of events. You also keep control over latency: your dashboards query an instance close to your users rather than a remote service.",{"type":43,"title":44,"items":45},"ul","Concrete benefits of self-hosting ClickHouse",[46,47,48,49,50,51],"Extremely fast analytical queries: aggregations over hundreds of millions of rows in under a second.","Column compression of 5x to 10x that drastically reduces the storage cost of your logs and events.","Massive ingestion: hundreds of thousands of rows per second on a single well-tuned node.","Compatible with SQL and many connectors (Grafana, Metabase, HTTP and native clients).","Analytical sovereignty: your logs and product metrics stay on your infrastructure.","No per-query billing: a fixed VPS cost for high analytical volume.",{"type":39,"title":53,"body":54},"Hardware and software requirements","ClickHouse loves RAM and fast storage. The absolute minimum is 2 GB of RAM for a test or development environment, but 4 GB is the recommended floor for light production workloads, and 8 GB provides a much healthier margin for large aggregations and mark cache. Below that threshold, you will encounter OOM errors as soon as you query several million rows. On the CPU side, 2 vCPU allow ClickHouse to exploit parallelism on simple queries; 4 vCPU become necessary for aggregations or joins on dense tables. Disk is the most critical factor: an NVMe SSD is mandatory — ClickHouse generates intense I\u002FO during partition merges and scan queries; a spinning HDD immediately caps performance even on small volumes. Plan for at least 50 GB to start, and scale according to your retention knowing that compression reduces the actual footprint by a factor of 5 to 10. Two ports matter: port 8123 for the HTTP interface (used by Grafana, Metabase, curl) and port 9000 for the native TCP protocol (used by Go, Python, or `clickhouse-client`). Never expose port 9000 directly to the internet without network filtering.",{"type":56,"title":57,"steps":58},"steps","Deploy ClickHouse step by step",[59,62,65,68,71,74],{"title":60,"body":61},"Prepare the VPS","Install Docker and raise system limits (`ulimit -n` to 262144) because ClickHouse opens many file descriptors. Disable excessive swap and verify the disk is NVMe SSD.",{"title":63,"body":64},"Launch ClickHouse with Docker","Use the official `clickhouse\u002Fclickhouse-server` image. Mount three persistent volumes: `\u002Fvar\u002Flib\u002Fclickhouse` (data), `\u002Fvar\u002Flog\u002Fclickhouse-server` (logs), and a config folder `\u002Fetc\u002Fclickhouse-server\u002Fconfig.d`. Add `ulimits: nofile: 262144` to the compose file.",{"title":66,"body":67},"Create a user and password","Never leave the `default` user without a password. Create a `users.d\u002Fcustom.xml` file with a dedicated user, a hashed password (`echo -n password | sha256sum`) and quotas. Restrict `\u003Cnetworks>` to authorized IPs.",{"title":69,"body":70},"Tune memory and profile","In `config.d`, set `max_server_memory_usage_to_ram_ratio` to 0.8 and define a per-query `max_memory_usage` suited to your VPS to avoid OOM. Enable partition retention with a TTL on your tables (`TTL date + INTERVAL 90 DAY`).",{"title":72,"body":73},"Expose the HTTP interface behind a reverse proxy","ClickHouse exposes an HTTP API on port `8123`. Place Nginx or Caddy in front for TLS and additional authentication, and do not open the native port `9000` to the public. Reserve native access to the internal network or via SSH tunnel.",{"title":75,"body":76},"Connect a visualization tool","Connect Grafana or Metabase to the HTTPS endpoint to build your dashboards. Create tables with the `MergeTree` engine, choose a relevant `ORDER BY`, and partition by month for efficient queries and purging.",{"type":39,"title":78,"body":79},"Post-installation configuration: users, database, and compression","Once ClickHouse is running, three configuration steps consolidate security and performance. First, create a dedicated database via `CREATE DATABASE analytics;` in the SQL console or via the HTTP API. Avoid writing directly to the `default` database — a clean namespace simplifies backups, quotas, and permission management. Next, define your users in a `users.d\u002Fproduction.xml` file rather than in the main `users.xml`: this split allows you to reload users without restarting the server (`SYSTEM RELOAD USERS`). For each user, specify a profile, a quota, and a network list. Finally, enable LZ4 compression in `config.d\u002Fcompression.xml`: it is ClickHouse's default codec for columns, but defining it explicitly ensures it applies to all tables including those created before the change. LZ4 offers a good balance between compression ratio and decompression speed at read time — for even more compact storage at the cost of slightly higher CPU usage, ZSTD (levels 1 to 3) is a viable alternative for rarely queried columns.",{"type":39,"title":81,"body":82},"Concrete use cases: application logs and time-series metrics","ClickHouse is a natural alternative to Elasticsearch for analytical log pipelines. Where Elasticsearch indexes every field of every JSON document and requires significant JVM memory, ClickHouse stores each column separately and compresses repetitive values (log level, hostname, service) extremely efficiently. For a log pipeline, create a `logs` table with a `MergeTree` engine partitioned by day (`PARTITION BY toDate(timestamp)`) and sorted by `(service, timestamp)`. Ingest via the HTTP API in batch INSERT (see the performance section below) or via Vector.dev, Fluent Bit, or Filebeat, all of which have a native ClickHouse output. For time-series metrics, the `MergeTree` engine with an `ORDER BY (metric_name, timestamp)` is suitable for moderate volumes. At larger scale, the `AggregatingMergeTree` engine pre-aggregates data during merges, further reducing the footprint and accelerating trend queries. A typical query over 500 million rows filtered by a time range and grouped by service runs in 2 to 8 seconds on a 4 vCPU \u002F 8 GB VPS depending on the index — often 10 to significantly faster than OLTP databases for analytics than a standard relational database.",{"type":39,"title":84,"body":85},"Performance: batch inserts and parts monitoring","ClickHouse's write behavior is fundamentally different from OLTP databases. Each INSERT creates a new part on disk, and ClickHouse merges these parts in the background. If you insert row by row or in small batches (fewer than 1,000 rows), you flood the system with small parts — merges can't keep up, performance degrades, and you get the `Too many parts` error (beyond 300 active parts per partition). The golden rule is to insert in batches of 10,000 to 100,000 rows minimum, and space insertions at least one second apart if inserting continuously from multiple sources. From a Python script, use `clickhouse-driver` or `clickhouse-connect` with `insert_block_size` to control block size. From Node.js, the official `@clickhouse\u002Fclient` exposes a streaming API that builds batches automatically. Monitor part health in real time with `SELECT table, count() as parts, sum(rows) FROM system.parts WHERE active GROUP BY table ORDER BY parts DESC` — if a table exceeds 100 active parts, that is a warning sign.",{"type":39,"title":87,"body":88},"Troubleshooting common errors","Three errors come up regularly when deploying ClickHouse on a VPS. **Too many parts**: you are inserting in batches that are too small; group your inserts, add an application-level buffer, or use the `Buffer` engine as an intermediate table that automatically flushes to the main table. **OOM error (Killed, Memory limit exceeded)**: the query consumed more RAM than `max_memory_usage` allows. Increase this parameter in the user profile, add a `LIMIT` clause to exploratory queries, or move to a VPS with more RAM. A query without a filter on a table with billions of rows can consume several GB in one second. **Permission denied on `\u002Fvar\u002Flib\u002Fclickhouse`**: the `clickhouse` system user (UID 101 in the official Docker image) does not have write rights on the mounted volume. Before the first start, run `chown -R 101:101 \u002Fyour\u002Fpath\u002Fclickhouse-data` on the host. If ClickHouse has started but is not responding on port 8123, check logs with `docker logs \u003Ccontainer-name>` — the permission error is explicitly shown there.",{"type":39,"title":90,"body":91},"Install it in one click from the ServOrbit Marketplace","Everything above can be done manually, and it is useful to know how. If you prefer not to, ClickHouse is listed on the ServOrbit Marketplace and installs on your VPS in one click. The template deploys the pinned 26.3 LTS version, mounts persistent volumes for data and logs, raises the file descriptor limit to 262144 as ClickHouse requires, and creates an `analytics` database on first boot. Most importantly, it closes the most common trap of manual deployment: the upstream image ships a `default` account with no password, and the installation removes it at startup and replaces it with an `admin` account whose password is generated for your server and shown in your client area. Only port 8123 is published, and only on the loopback interface: attach a domain and the built-in SQL console responds at `https:\u002F\u002F\u003Cyour-domain>\u002Fplay` with its TLS certificate; without a domain, use a tunnel `ssh -L 8123:127.0.0.1:8123 root@\u003Cvps-ip>` then `http:\u002F\u002Flocalhost:8123\u002Fplay`.",{"type":93,"title":94,"rows":95,"headers":122},"comparison","ClickHouse vs Elasticsearch for logs: which database to choose?",[96,101,105,109,113,117],[97,98,99,100],"Storage per GB of logs","ClickHouse","Elasticsearch","ClickHouse (5-10x compression vs 1-2x)",[102,103,104,98],"Analytical queries (aggregates, trends)","Seconds on 500M rows","Minutes or degradation",[106,107,108,99],"Full-text search in messages","Limited (LIKE, token BF)","Native and performant",[110,111,112,98],"RAM required to start","2 GB minimum","4-8 GB minimum (JVM)",[114,115,116,99],"Real-time ingestion (streaming)","Batch recommended","Native and optimized",[118,119,120,121],"Grafana \u002F BI connectors","Native ClickHouse plugin","Elasticsearch plugin","Equivalent",[123,124,125,126],"Backend","a","b","verdict",{"type":128,"body":129},"tip","The choice of the sort key (`ORDER BY`) for the MergeTree engine is the decisive performance factor: put the most filtered columns in your queries first (often a date and an identifier). Use `Buffer` tables or batch inserts of several thousand rows rather than row-by-row insertions, which create a multitude of small partitions and trigger costly merges. Monitor `system.merges` and `system.parts` to detect excessive fragmentation.","Deploy ClickHouse in one click on a ServOrbit VPS","Pinned 26.3 LTS release, persistent volumes, generated administrator account: an analytics warehouse ready to take your events.","See the ClickHouse listing","\u002Fapplications\u002Fdatabases\u002Fclickhouse",[135,153,170,188],{"id":136,"slug":137,"slugs":138,"title":142,"excerpt":143,"readTime":17,"views":144,"isPinned":19,"noindex":19,"publishedAt":145,"updatedAt":146,"category":147,"categories":148,"featuredImage":30,"bgImage":31,"posterImage":150,"relatedSolution":151},56,"postgresql-on-a-vps-a-reliable-and-controlled-database",{"fr":139,"en":137,"ar":140,"es":141},"heberger-postgresql-vps","postgresql-على-خادم-vps-قاعدة-بيانات-موثوقة-ومتحكم-بها","alojar-postgresql-en-un-vps","PostgreSQL on a VPS: reliable, controlled database","Host PostgreSQL on a VPS: production config, pgBackRest backups, streaming HA, RDS\u002FSupabase\u002FNeon comparison and OOM troubleshooting.",1,"2026-04-25T00:00:00+00:00","2026-10-21T15:21:37+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},[149],{"id":23,"name":24,"slug":25,"color":26,"icon":27},"\u002Fblog\u002Fcovers\u002Fheberger-postgresql-vps-poster.svg",{"categorySlug":34,"appSlug":152},"postgresql-stack",{"id":154,"slug":155,"slugs":156,"title":160,"excerpt":161,"readTime":17,"views":18,"isPinned":19,"noindex":19,"publishedAt":162,"updatedAt":163,"category":164,"categories":165,"featuredImage":30,"bgImage":31,"posterImage":167,"relatedSolution":168},57,"hosting-mysql-on-a-vps",{"fr":157,"en":155,"ar":158,"es":159},"heberger-mysql-vps","استضافة-mysql-على-خادم-vps","alojar-mysql-en-un-vps","Hosting MySQL on a VPS: complete guide","Install MySQL 8.4 LTS on a VPS: prerequisites, security hardening, InnoDB performance, secure remote access, automated backups, and troubleshooting.","2026-04-24T00:00:00+00:00","2026-11-09T20:55:18+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},[166],{"id":23,"name":24,"slug":25,"color":26,"icon":27},"\u002Fblog\u002Fcovers\u002Fheberger-mysql-vps-poster.svg",{"categorySlug":34,"appSlug":169},"mysql-stack",{"id":171,"slug":172,"slugs":173,"title":177,"excerpt":178,"readTime":179,"views":18,"isPinned":19,"noindex":19,"publishedAt":180,"updatedAt":181,"category":182,"categories":183,"featuredImage":30,"bgImage":31,"posterImage":185,"relatedSolution":186},58,"hosting-redis-on-a-vps",{"fr":174,"en":172,"ar":175,"es":176},"heberger-redis-vps","استضافة-redis-على-خادم-vps","alojar-redis-en-un-vps","Hosting Redis on a VPS: the complete guide","Deploy Redis on your Cloud VPS: RAM\u002FCPU requirements, security (ACL, TLS), RDB\u002FAOF persistence, troubleshooting, and high availability.",10,"2026-04-23T00:00:00+00:00","2026-09-08T21:59:59+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},[184],{"id":23,"name":24,"slug":25,"color":26,"icon":27},"\u002Fblog\u002Fcovers\u002Fheberger-redis-vps-poster.svg",{"categorySlug":34,"appSlug":187},"redis-stack",{"id":189,"slug":190,"slugs":191,"title":195,"excerpt":196,"readTime":17,"views":197,"isPinned":19,"noindex":19,"publishedAt":198,"updatedAt":199,"category":200,"categories":206,"featuredImage":30,"bgImage":31,"posterImage":208,"relatedSolution":209},168,"how-to-self-host-metabase-on-a-vps-open-source-bi-dashboards",{"fr":192,"en":190,"ar":193,"es":194},"self-host-metabase-vps","استضافة-metabase-على-vps-لوحات-ذكاء-أعمال-مفتوحة-المصدر","alojar-metabase-en-un-vps","How to Self-Host Metabase on a VPS: Open-Source BI Dashboards","Deploy Metabase on your VPS: connect any SQL database and build dashboards and charts in the browser, with a companion Postgres, on infrastructure you control.",4,"2026-07-06T00:00:00+00:00","2026-10-20T23:18:08+00:00",{"id":201,"name":202,"slug":203,"color":204,"icon":205},7,"Self-hosting","self-hosting","bg-indigo-500\u002F10 text-indigo-400","cloud",[207],{"id":201,"name":202,"slug":203,"color":204,"icon":205},"\u002Fblog\u002Fcovers\u002Fself-host-metabase-vps-poster.svg",{"categorySlug":34,"appSlug":210},"metabase",true,1794270416313]