sitespeedio/graphite本镜像是基于官方Graphite镜像(graphiteapp/graphite-statsd)的封装版本,专为配合sitespeed.io工具设计,支持快速部署Graphite(1.1.3版本)并优化指标存储配置。镜像默认启用Basic Auth认证,固定数据存储目录,可直接用于收集、存储sitespeed.io生成的性能指标,也可通过自定义配置适配其他监控场景。
/opt/graphite/storage/whisper,支持外部挂载实现数据持久化。storage-schemas.conf和storage-aggregation.conf文件,调整指标存储周期和聚合规则。使用默认的guest/guest认证凭证启动容器,仅用于测试环境:
shdocker run -d \ --name graphite \ -p 8080:80 \ # Web界面端口(映射到宿主机8080) -p 2003:2003 \ # 指标接收端口(Carbon缓存端口) sitespeedio/graphite
注意:默认认证安全性低,生产环境需替换为自定义.htpasswd文件。
通过挂载宿主机的.htpasswd文件替换默认认证凭证,步骤如下:
htpasswd工具创建(参考Apache文档):
shhtpasswd -c /local/path/to/.htpasswd <用户名> # 按提示输入密码
shdocker run -d \ --name graphite \ -p 8080:80 \ -p 2003:2003 \ -v /local/path/to/.htpasswd:/etc/nginx/.htpasswd \ # 挂载自定义认证文件 sitespeedio/graphite
为避免容器重启导致数据丢失,需将Graphite的whisper数据目录挂载到宿主机:
shdocker run -d \ --name graphite \ -p 8080:80 \ -p 2003:2003 \ -v /local/path/to/.htpasswd:/etc/nginx/.htpasswd \ # 自定义认证 -v /path/to/whisper:/opt/graphite/storage/whisper \ # 持久化数据目录 sitespeedio/graphite
默认存储策略为retentions = 10m:60d,30m:90d(10分钟/点存储60天,30分钟/点存储90天,共3个月数据)。如需调整(如延长存储周期),可通过挂载自定义storage-schemas.conf文件实现:
创建storage-schemas.conf文件,示例内容(存储1年数据):
ini[default_1min_for_1year] pattern = .* retentions = 10m:180d, 30m:365d # 10分钟/点存180天,30分钟/点存365天
shdocker run -d \ --name graphite \ -p 8080:80 \ -p 2003:2003 \ -v /local/path/to/.htpasswd:/etc/nginx/.htpasswd \ -v /path/to/whisper:/opt/graphite/storage/whisper \ -v /path/to/storage-schemas.conf:/opt/graphite/conf/storage-schemas.conf \ # 挂载自定义存储策略 sitespeedio/graphite
创建docker-compose.yml文件,整合认证、数据持久化和自定义存储策略:
yamlversion: '3' services: graphite: image: sitespeedio/graphite container_name: graphite ports: - "8080:80" - "2003:2003" volumes: - /local/path/to/.htpasswd:/etc/nginx/.htpasswd # 自定义认证 - /path/to/whisper:/opt/graphite/storage/whisper # 数据持久化 - /path/to/storage-schemas.conf:/opt/graphite/conf/storage-schemas.conf # 自定义存储策略 restart: unless-stopped # 容器退出时自动重启
启动命令:docker-compose up -d
| 挂载路径 | 用途说明 |
|---|---|
/etc/nginx/.htpasswd | Basic Auth认证文件,格式为用户名:加密密码(需通过htpasswd工具生成)。 |
/opt/graphite/storage/whisper | Graphite数据存储目录(Whisper数据库),挂载后数据可持久化。 |
/opt/graphite/conf/storage-schemas.conf | 指标存储策略配置文件,定义不同指标的采样间隔和保留周期。 |
/opt/graphite/conf/storage-aggregation.conf | 指标聚合规则配置文件,定义历史数据如何合并(如平均值、最大值)。 |
本镜像基于官方Graphite镜像graphiteapp/graphite-statsd构建,继承其核心组件(Carbon、Whisper、Graphite Web),并添加sitespeed.io适配配置。
manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务