Add environment configuration and documentation for various services
- Created .env.example files for Kafka, Kibana, KodBox, Kong, Langfuse, Logstash, n8n, Nginx, OceanBase, OpenCoze, RocketMQ, TiDB, and TiKV. - Added README.md and README.zh.md files for OceanBase, RocketMQ, TiDB, and TiKV, detailing usage, configuration, and access instructions. - Implemented docker-compose.yaml files for OceanBase, RocketMQ, TiDB, and TiKV, defining service configurations, health checks, and resource limits. - Included broker.conf for RocketMQ to specify broker settings. - Established a consistent timezone (UTC) across all services. - Provided optional port overrides in .env.example files for flexibility in deployment.
This commit is contained in:
17
src/clickhouse/.env.example
Normal file
17
src/clickhouse/.env.example
Normal file
@@ -0,0 +1,17 @@
|
||||
# ClickHouse version
|
||||
CLICKHOUSE_VERSION=24.11.1.2557
|
||||
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
|
||||
# Database configuration
|
||||
CLICKHOUSE_DB=default
|
||||
CLICKHOUSE_USER=default
|
||||
CLICKHOUSE_PASSWORD=clickhouse
|
||||
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1
|
||||
|
||||
# Port overrides (optional)
|
||||
# CLICKHOUSE_HTTP_PORT_OVERRIDE=8123
|
||||
# CLICKHOUSE_NATIVE_PORT_OVERRIDE=9000
|
||||
# CLICKHOUSE_MYSQL_PORT_OVERRIDE=9004
|
||||
# CLICKHOUSE_POSTGRES_PORT_OVERRIDE=9005
|
||||
81
src/clickhouse/README.md
Normal file
81
src/clickhouse/README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# ClickHouse
|
||||
|
||||
ClickHouse is a fast open-source column-oriented database management system that allows generating analytical data reports in real-time.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Key environment variables:
|
||||
|
||||
- `CLICKHOUSE_DB`: Default database name (default: `default`)
|
||||
- `CLICKHOUSE_USER`: Default user name (default: `default`)
|
||||
- `CLICKHOUSE_PASSWORD`: Default user password (default: `clickhouse`)
|
||||
- `CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT`: Enable SQL-driven access control (default: `1`)
|
||||
|
||||
## Ports
|
||||
|
||||
- `8123`: HTTP interface
|
||||
- `9000`: Native TCP protocol
|
||||
- `9004`: MySQL protocol emulation
|
||||
- `9005`: PostgreSQL protocol emulation
|
||||
|
||||
## Access
|
||||
|
||||
### HTTP Interface
|
||||
|
||||
```bash
|
||||
curl 'http://localhost:8123/?user=default&password=clickhouse' -d 'SELECT 1'
|
||||
```
|
||||
|
||||
### ClickHouse Client
|
||||
|
||||
```bash
|
||||
docker compose exec clickhouse clickhouse-client --user default --password clickhouse
|
||||
```
|
||||
|
||||
### MySQL Protocol
|
||||
|
||||
```bash
|
||||
mysql -h127.0.0.1 -P9004 -udefault -pclickhouse
|
||||
```
|
||||
|
||||
### PostgreSQL Protocol
|
||||
|
||||
```bash
|
||||
psql -h127.0.0.1 -p9005 -Udefault
|
||||
```
|
||||
|
||||
## Example Queries
|
||||
|
||||
```sql
|
||||
-- Create a table
|
||||
CREATE TABLE events (
|
||||
event_date Date,
|
||||
event_type String,
|
||||
user_id UInt32
|
||||
) ENGINE = MergeTree()
|
||||
ORDER BY (event_date, event_type);
|
||||
|
||||
-- Insert data
|
||||
INSERT INTO events VALUES ('2024-01-01', 'click', 1), ('2024-01-01', 'view', 2);
|
||||
|
||||
-- Query data
|
||||
SELECT * FROM events;
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- ClickHouse is optimized for OLAP (Online Analytical Processing) workloads
|
||||
- It excels at aggregating large amounts of data quickly
|
||||
- For production, consider using a cluster setup with replication
|
||||
- Custom configurations can be mounted in `/etc/clickhouse-server/config.d/` and `/etc/clickhouse-server/users.d/`
|
||||
|
||||
## References
|
||||
|
||||
- [ClickHouse Official Documentation](https://clickhouse.com/docs)
|
||||
- [ClickHouse Docker Hub](https://hub.docker.com/r/clickhouse/clickhouse-server)
|
||||
81
src/clickhouse/README.zh.md
Normal file
81
src/clickhouse/README.zh.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# ClickHouse
|
||||
|
||||
ClickHouse 是一个快速的开源列式数据库管理系统,支持实时生成分析数据报告。
|
||||
|
||||
## 使用方法
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## 配置说明
|
||||
|
||||
主要环境变量:
|
||||
|
||||
- `CLICKHOUSE_DB`:默认数据库名称(默认:`default`)
|
||||
- `CLICKHOUSE_USER`:默认用户名(默认:`default`)
|
||||
- `CLICKHOUSE_PASSWORD`:默认用户密码(默认:`clickhouse`)
|
||||
- `CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT`:启用 SQL 驱动的访问控制(默认:`1`)
|
||||
|
||||
## 端口说明
|
||||
|
||||
- `8123`:HTTP 接口
|
||||
- `9000`:Native TCP 协议
|
||||
- `9004`:MySQL 协议模拟
|
||||
- `9005`:PostgreSQL 协议模拟
|
||||
|
||||
## 访问方式
|
||||
|
||||
### HTTP 接口
|
||||
|
||||
```bash
|
||||
curl 'http://localhost:8123/?user=default&password=clickhouse' -d 'SELECT 1'
|
||||
```
|
||||
|
||||
### ClickHouse 客户端
|
||||
|
||||
```bash
|
||||
docker compose exec clickhouse clickhouse-client --user default --password clickhouse
|
||||
```
|
||||
|
||||
### MySQL 协议
|
||||
|
||||
```bash
|
||||
mysql -h127.0.0.1 -P9004 -udefault -pclickhouse
|
||||
```
|
||||
|
||||
### PostgreSQL 协议
|
||||
|
||||
```bash
|
||||
psql -h127.0.0.1 -p9005 -Udefault
|
||||
```
|
||||
|
||||
## 示例查询
|
||||
|
||||
```sql
|
||||
-- 创建表
|
||||
CREATE TABLE events (
|
||||
event_date Date,
|
||||
event_type String,
|
||||
user_id UInt32
|
||||
) ENGINE = MergeTree()
|
||||
ORDER BY (event_date, event_type);
|
||||
|
||||
-- 插入数据
|
||||
INSERT INTO events VALUES ('2024-01-01', 'click', 1), ('2024-01-01', 'view', 2);
|
||||
|
||||
-- 查询数据
|
||||
SELECT * FROM events;
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- ClickHouse 专为 OLAP(在线分析处理)工作负载优化
|
||||
- 擅长快速聚合大量数据
|
||||
- 生产环境建议使用集群配置和复制功能
|
||||
- 自定义配置可以挂载到 `/etc/clickhouse-server/config.d/` 和 `/etc/clickhouse-server/users.d/`
|
||||
|
||||
## 参考资料
|
||||
|
||||
- [ClickHouse 官方文档](https://clickhouse.com/docs)
|
||||
- [ClickHouse Docker Hub](https://hub.docker.com/r/clickhouse/clickhouse-server)
|
||||
52
src/clickhouse/docker-compose.yaml
Normal file
52
src/clickhouse/docker-compose.yaml
Normal file
@@ -0,0 +1,52 @@
|
||||
x-default: &default
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
max-file: "3"
|
||||
|
||||
services:
|
||||
clickhouse:
|
||||
<<: *default
|
||||
image: clickhouse/clickhouse-server:${CLICKHOUSE_VERSION:-24.11.1.2557}
|
||||
hostname: clickhouse
|
||||
environment:
|
||||
TZ: ${TZ:-UTC}
|
||||
CLICKHOUSE_DB: ${CLICKHOUSE_DB:-default}
|
||||
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
|
||||
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-clickhouse}
|
||||
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: ${CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT:-1}
|
||||
volumes:
|
||||
- clickhouse_data:/var/lib/clickhouse
|
||||
- clickhouse_logs:/var/log/clickhouse-server
|
||||
# Custom configuration
|
||||
# - ./config.xml:/etc/clickhouse-server/config.d/config.xml
|
||||
# - ./users.xml:/etc/clickhouse-server/users.d/users.xml
|
||||
ports:
|
||||
- "${CLICKHOUSE_HTTP_PORT_OVERRIDE:-8123}:8123"
|
||||
- "${CLICKHOUSE_NATIVE_PORT_OVERRIDE:-9000}:9000"
|
||||
- "${CLICKHOUSE_MYSQL_PORT_OVERRIDE:-9004}:9004"
|
||||
- "${CLICKHOUSE_POSTGRES_PORT_OVERRIDE:-9005}:9005"
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 262144
|
||||
hard: 262144
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.0'
|
||||
memory: 4G
|
||||
reservations:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
volumes:
|
||||
clickhouse_data:
|
||||
clickhouse_logs:
|
||||
Reference in New Issue
Block a user