signoz 1天前 · 2026-11-23 11:54:05 · 5 阅读
部署到 Azure 容器应用
开始之前,请确保你已具备:
- 已安装并认证 Azure CLI(运行
az login) - 拥有以下权限:
- 创建 Container Apps 环境
- 创建 存储账户和文件共享
- Azure CLI 版本为 2.62 或更高
设置 Azure 基础设施
1. 安装 Container Apps 扩展
安装 Azure CLI 并添加 Container Apps 扩展:
Copyaz extension add --name containerapp
详细的设置说明请参考 入门指南。
2. 配置环境变量
设置部署变量。请将占位符值替换为你自己的配置:
Copy# 你的配置
SUBSCRIPTION_ID=<YOUR_SUBSCRIPTION_ID>
RG_NAME=<YOUR_RESOURCE_GROUP>
LOCATION=<YOUR_LOCATION> # 选择支持的区域
STORAGE_ACCOUNT=<uniquestorageacct> # 仅限小写字母和数字
ENV_NAME=signoz
FILE_SHARE_NAME=signoz
注意:存储账户名称必须全局唯一,仅包含小写字母和数字,长度在 3-24 个字符之间。请参阅 支持区域 了解可用位置。
3. 创建资源组和 Container Apps 环境
创建基础的 Azure 资源:
Copy# 设置你的订阅(如果尚未配置)
az account set --subscription $SUBSCRIPTION_ID
# 创建资源组
az group create \
--name $RG_NAME \
--location $LOCATION
# 创建 Container Apps 环境
az containerapp env create \
--name $ENV_NAME \
--resource-group $RG_NAME \
--location $LOCATION
4. 创建存储账户和文件共享
ClickHouse 需要持久化存储配置数据。了解更多关于 Container Apps 中的 Azure Files 的信息:
Copy# 创建存储账户
az storage account create \
--name "$STORAGE_ACCOUNT" \
--resource-group "$RG_NAME" \
--location "$LOCATION" \
--sku Standard_LRS \
--kind StorageV2
# 创建文件共享
az storage share-rm create \
--resource-group "$RG_NAME" \
--storage-account "$STORAGE_ACCOUNT" \
--name "$FILE_SHARE_NAME"
# 获取存储账户密钥
STORAGE_KEY=$(az storage account keys list \
--resource-group "$RG_NAME" \
--account-name "$STORAGE_ACCOUNT" \
--query "[0].value" -o tsv)
# 将存储挂载到 Container Apps 环境
az containerapp env storage set \
--name $ENV_NAME \
--resource-group $RG_NAME \
--storage-name signoz \
--azure-file-account-name $STORAGE_ACCOUNT \
--azure-file-account-key "$STORAGE_KEY" \
--azure-file-share-name $FILE_SHARE_NAME \
--access-mode ReadWrite展开 29 行
5. 准备 SigNoz 配置文件
先在本地创建以下配置文件,然后上传到文件共享中。
Clickhouse 配置
config.xml(点击展开配置文件)config.xml<?xml version="1.0"?>
<clickhouse>
<max_connections>4096</max_connections>
<keep_alive_timeout>3</keep_alive_timeout>
<max_concurrent_queries>100</max_concurrent_queries>
<mark_cache_size>5368709120</mark_cache_size>
<mmap_cache_size>1000</mmap_cache_size>
<compiled_expression_cache_size>134217728</compiled_expression_cache_size>
<compiled_expression_cache_elements_size>10000</compiled_expression_cache_elements_size>
<custom_settings_prefixes></custom_settings_prefixes>
<dictionaries_config>*_dictionary.xml</dictionaries_config>
<user_defined_executable_functions_config>*function.xml</user_defined_executable_functions_config>
<user_scripts_path>/var/lib/clickhouse/user_scripts/</user_scripts_path>
<http_port>8123</http_port>
<tcp_port>9000</tcp_port>
<mysql_port>9004</mysql_port>
<postgresql_port>9005</postgresql_port>
<interserver_http_port>9009</interserver_http_port>
<logger>
<level>information</level>
<formatting>
<type>json</type>
</formatting>
</logger>
<macros>
<shard>01</shard>
<replica>example01-01-1</replica>
</macros>
<prometheus>
<endpoint>/metrics</endpoint>
<port>9363</port>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
<status_info>true</status_info>
</prometheus>
<opentelemetry_span_log>
<engine>engine MergeTree
partition by toYYYYMM(finish_date)
order by (finish_date, finish_time_us, trace_id)</engine>
</opentelemetry_span_log>
<query_masking_rules>
<rule>
<name>hide encrypt/decrypt arguments</name>
<regexp>((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\)</regexp>
<replace>\1(???)</replace>
</rule>
</query_masking_rules>
<send_crash_reports>
<enabled>false</enabled>
<anonymize>false</anonymize>
<endpoint>https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277</endpoint>
</send_crash_reports>
<merge_tree_metadata_cache>
<lru_cache_size>268435456</lru_cache_size>
<continue_if_corrupted>true</continue_if_corrupted>
</merge_tree_metadata_cache>
<user_directories>
<users_xml>
<!-- 预定义用户配置文件的路径。 -->
<path>users.xml</path>
</users_xml>
<local_directory>
<!-- 通过 SQL 命令创建的用户存储所在的文件夹路径。 -->
<path>/var/lib/clickhouse/access/</path>
</local_directory>
</user_directories>
<default_profile>default</default_profile>
<distributed_ddl>
<!-- ZooKeeper 中用于 DDL 查询队列的路径 -->
<path>/clickhouse/task_queue/ddl</path>
</distributed_ddl>
</clickhouse>
展开 73 行
users.xml(点击展开配置)users.xml<?xml version="1.0"?>
<clickhouse>
<profiles>
<default>
<max_memory_usage>10000000000</max_memory_usage>
<load_balancing>random</load_balancing>
</default>
<readonly>
<readonly>1</readonly>
</readonly>
</profiles>
<users>
<default>
<password></password>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</default>
</users>
<quotas>
<default>
<interval>
<duration>3600</duration>
<queries>0</queries>
<errors>0</errors>
<result_rows>0</result_rows>
<read_rows>0</read_rows>
<execution_time>0</execution_time>
</interval>
</default>
</quotas>
</clickhouse>
展开 35 行
cluster.xml(点击展开配置)cluster.xml<?xml version="1.0"?>
<clickhouse>
<zookeeper>
<node index="1">
<host>signoz-zookeeper</host>
<port>2181</port>
</node>
</zookeeper>
<remote_servers>
<cluster>
<shard>
<replica>
<host>127.0.0.1</host>
<port>9000</port>
</replica>
</shard>
</cluster>
</remote_servers>
</clickhouse>
custom-function.yaml(点击展开配置)custom-function.xml
<functions>
<function>
<type>executable</type>
<name>histogramQuantile</name>
<return_type>Float64</return_type>
<argument>
<type>Array(Float64)</type>
<name>buckets</name>
</argument>
<argument>
<type>Array(Float64)</type>
<name>counts</name>
</argument>
<argument>
<type>Float64</type>
<name>quantile</name>
</argument>
<format>CSV</format>
<command>./histogramQuantile</command>
</function>
</functions>展开 21 行
signoz-otel-collector-config.yaml(点击展开配置)signoz-otel-collector-config.yaml
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
max_recv_msg_size_mib: 16
http:
endpoint: 0.0.0.0:4318
jaeger:
protocols:
grpc:
endpoint: 0.0.0.0:14250
thrift_http:
endpoint: 0.0.0.0:14268
httplogreceiver/heroku:
endpoint: 0.0.0.0:8081
source: heroku
httplogreceiver/json:
endpoint: 0.0.0.0:8082
source: json
processors:
batch:
send_batch_size: 50000
timeout: 1s
signozspanmetrics/delta:
metrics_exporter: signozclickhousemetrics
latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s]
dimensions_cache_size: 100000
dimensions:
- name: service.namespace
default: default
- name: deployment.environment
default: default
- name: signoz.collector.id
aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
extensions:
health_check:
endpoint: 0.0.0.0:13133
zpages:
endpoint: localhost:55679
pprof:
endpoint: localhost:1777
exporters:
clickhousetraces:
datasource: tcp://signoz-clickhouse:9000/signoz_traces?password=password
use_new_schema: true
signozclickhousemetrics:
dsn: tcp://signoz-clickhouse:9000/signoz_metrics?password=password
timeout: 45s
clickhouselogsexporter:
d原始来源: signoz