标签:
一、基本架构图
1、整个架构组件:
2、总体流程:
2.1、metrics存储
2.2、metrics查询
二、配置文件
1、statsd
config.js
1 { 2 port: 8125, 3 4 graphitePort: 2013, 5 graphiteHost: "127.0.0.1", 6 flushInterval: 10000, 7 8 backends: [ "./backends/graphite" ], 9 graphite: { 10 legacyNamespace: false 11 } 12 }
说明:
2、carbon
2.1、carbon.conf
1 [cache] 2 MAX_CACHE_SIZE = inf 3 MAX_UPDATES_PER_SECOND = 500 4 MAX_CREATES_PER_MINUTE = 50 5 LOCAL_DATA_DIR = /opt/graphite/storage/whisper 6 USER= 7 8 LINE_RECEIVER_INTERFACE = 127.0.0.1 9 PICKLE_RECEIVER_INTERFACE = 127.0.0.1 10 CACHE_QUERY_INTERFACE = 127.0.0.1 11 12 [cache:a] 13 LINE_RECEIVER_PORT = 2003 14 PICKLE_RECEIVER_PORT = 2004 15 CACHE_QUERY_PORT = 7002 16 17 [cache:b] 18 LINE_RECEIVER_PORT = 2103 19 PICKLE_RECEIVER_PORT = 2104 20 CACHE_QUERY_PORT = 7102 21 22 [relay] 23 LINE_RECEIVER_INTERFACE = 127.0.0.1 24 LINE_RECEIVER_PORT = 2013 25 PICKLE_RECEIVER_INTERFACE = 127.0.0.1 26 PICKLE_RECEIVER_PORT = 2014 27 28 RELAY_METHOD = consistent-hashing 29 DESTINATIONS = 127.0.0.1:2004:a, 127.0.0.1:2104:b 30 31 MAX_QUEUE_SIZE = 10000
说明:
2.2、storage-schema.conf(存储模式,实际上最前边的配置也是carbon-cache向whisper写入metrics的时间间隔)
1 [statsd] 2 pattern = ^stats\. 3 retentions = 10s:6h,60s:1d,10m:7d 4 5 [default_1min_for_1day] 6 pattern = .* 7 retentions = 60s:1d
2.3、storage-aggregation.conf(高精度向低精度聚合的聚合规则)
1 [min] 2 pattern = \.min$ 3 xFilesFactor = 0.1 4 aggregationMethod = min 5 6 [max] 7 pattern = \.max$ 8 xFilesFactor = 0.1 9 aggregationMethod = max 10 11 [sum] 12 pattern = \.count$ 13 xFilesFactor = 0 14 aggregationMethod = sum 15 16 [default_average] 17 pattern = .* 18 xFilesFactor = 0.5 19 aggregationMethod = average
3、graphite-web
local_settings.py
1 DATABASES = { 2 ‘default‘: { 3 ‘NAME‘: ‘/opt/graphite/storage/graphite.db‘, 4 ‘ENGINE‘: ‘django.db.backends.sqlite3‘, 5 ‘USER‘: ‘‘, 6 ‘PASSWORD‘: ‘‘, 7 ‘HOST‘: ‘‘, 8 ‘PORT‘: ‘‘ 9 } 10 } 11 12 CARBONLINK_HOSTS = ["127.0.0.1:7002:a", "127.0.0.1:7102:b"]
注意:
4、grafana
/etc/grafana/grafana.ini
说明:该文件暂时不做任何变动。(只是在第一次启动之前指定了admin_user和admin_password)
注意:读取的是default.ini和grafana.ini(后者优先级高,会覆盖前者配置)
三、启动
1、carbon
2、graphite-web
3、statsd
4、grafana
四、测试
1、单独测试两个carbon-cache
2、加入carbon-relay
3、加入statsd
五、最后的一张图
标签:
原文地址:http://www.cnblogs.com/java-zhao/p/5929240.html