Clickhouse insert buffer queue using RabbitMQ STOMP protocol.
- PHP 8.1+
This package can be installed as a Composer dependency.
composer require pnixx/clickhouse-queue$worker = new ClickhouseWorker([
'clickhouse' => [
'database' => 'example',
'host' => 'localhost',
'port' => 8123,
],
'stomp' => [
'host' => 'localhost',
'port' => 61613,
'queue' => 'clickhouse',
],
], __DIR__ . '/../tmp');
Worker::runAll();This worker will listen the queue clickhouse and will inserting bulk data to ClickHouse database. For run worker:
php examples/run.php startBuild and run from source:
docker build --rm -t clickhouse-queue .
docker run --name clickhouse-queue clickhouse-queueRun container with shared tmp directory:
docker run -it -v /path/to/tmp:/var/www/clickhouse-queue/tmp --name clickhouse-queue pnixx/clickhouse-queueEnvironment variables:
CLICKHOUSE_HOST- ClickHouse host for inserts, defaultlocalhostCLICKHOUSE_PORT- ClickHouse port for inserts, default8123CLICKHOUSE_DB- ClickHouse database for inserts, defaultdefaultCLICKHOUSE_USER- ClickHouse user, optionalCLICKHOUSE_PASSWORD- ClickHouse password, optionalCLICKHOUSE_SSL- ClickHouse need use HTTPS connection instead HTTP, defaultfalseRABBIT_HOST- RabbitMQ host for subscribe, defaultlocalhostRABBIT_STOMP_PORT- RabbitMQ STOMP port, default61613RABBIT_USER- RabbitMQ STOMP login user, defaultguestRABBIT_PASSWORD- RabbitMQ STOMP login password, defaultguestRABBIT_QUEUE- RabbitMQ queue for buffer data, defaultclickhouseRABBIT_VHOST- RabbitMQ vhost, default/MAX_DELAY- time flush data to ClickHouse, default5MAX_FILE_SIZE- max buffer size before flush to ClickHouse, default5242880LOG_LEVEL- output log level, defaultwarning
Header table: to insert data into the specified table
Body: JSON as string row data
{"column1": "data1", "column2": "data2"}Testing GitHub actions:
actDonations to this project are going directly to PNixx, the original author of this project:
- BTC address:
1H3rhpf7WEF5JmMZ3PVFMQc7Hm29THgUfN - ETH address:
0x6F094365A70fe7836A633d2eE80A1FA9758234d5 - XMR address:
42gP71qLB5M43RuDnrQ3vSJFFxis9Kw9VMURhpx9NLQRRwNvaZRjm2TFojAMC8Fk1BQhZNKyWhoyJSn5Ak9kppgZPjE17Zh - TON address:
UQB5RntjBNMA6qXjuqTrl2TcqceNu3vMOj1AyyW3eeGGI-Qd
Bug reports and pull requests are welcome on GitHub at https://github.com/PNixx/clickhouse-queue. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The MIT License (MIT). Please see LICENSE for more information.