数据库 – 如何设置RRD存储2年?

前端之家收集整理的这篇文章主要介绍了数据库 – 如何设置RRD存储2年?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在监控超过300台服务器,因为我正在使用 Ganglia.
其中使用RRD作为数据库来收集和存储与每个服务器的资源相关的数据.
我想有2年或更长的历史,所以阅读这篇 article,我认为我的RRA配置应该是:
RRAs "RRA:AVERAGE:0.5:1:17520"

17520 =(365天[年] x 2)* 24 [小时]

这是Ganglia默认配置,今天正在运行:

#
# Round-Robin Archives
# You can specify custom Round-Robin archives here (defaults are listed below)
#
# RRAs "RRA:AVERAGE:0.5:1:244" "RRA:AVERAGE:0.5:24:244" "RRA:AVERAGE:0.5:168:244" "RRA:AVERAGE:0.5:672:244" \
#      "RRA:AVERAGE:0.5:5760:374"
#

这是对的我的思维方式还是我在这里遗漏了什么?

解决方法

在研究了这个主题一段时间之后,我想出了一个可以帮助将来某个人的答案.我多次阅读这两篇文章,我建议这样做.
首先阅读本文,Creating an initial RRD然后阅读本文. How to create an RRDTool database

我会尽力解释一下.格式RRA:CF:xff:步骤:行:

RRA: Round Robin Archive
CF: Consolidation Factor
XFF: Xfile Factor
steps
rows

对我来说最大的问题是发现步骤和行的正确价值.
看完后,我想出了这样的解释:

1 day - 5-minute resolution
1 week - 15-minute resolution
1 month - 1-hour resolution
1 year - 6-hour resolution

RRA:AVERAGE:0.5:1:288 \
RRA:AVERAGE:0.5:3:672 \
RRA:AVERAGE:0.5:12:744 \
RRA:AVERAGE:0.5:72:1480

请记住,我们的步骤是300秒,所以这个想法非常简单:
如果我想解决一天有86400秒,如第一个例子所示,我需要多少行?答案是288行.为什么?

`86400 seconds [1 day] / 300 seconds [5 minutes`] = 288 rows

另一个例子,如果我想解决
1周[= 604800秒],15分钟[= 900秒] = 604800/900 = 672行

所以它继续其他的价值观.这样您就可以找到所需的行数.
找出你需要的步骤非常简单,你只需要采取步骤的乘数即可.

让我解释一下:我们的步骤是300秒,对吧?

所以如果我们要解决5分钟[= 300秒],我们只需要乘以1,对吗?
因此,15分钟意味着300秒x 3,1小时意味着300 x 12,6小时意味着300 x 72,依此类推.

在我的具体情况下,我想我的步骤是30秒,所以我想出了这些结构:

1   every time           30 seconds      1 * 30s = 30s
2   every second time     1 minute       2 * 30s = 1m
4   every third time      2 minutes      4 * 30s = 2m
10  every 10th time       5 minutes     10 * 30s = 5m
20  every 20th time      10 minutes     20 * 30s = 10m
60  every 60th time      30 minutes     60 * 30s = 30m
80  every 80th time      40 minutes     80 * 30s = 40m
100 every 100th time     50 minutes    100 * 30s = 50m
120 every 120th time      1 hour       120 * 30s = 1h
240 every 240th time      2 hours      240 * 30s = 2h
360 every 360th time      3 hours      360 * 30s = 3h

RRA:AVERAGE:0.5:1:120 \
RRA:AVERAGE:0.5:2:120 \
RRA:AVERAGE:0.5:4:120 \
RRA:AVERAGE:0.5:10:288 \
RRA:AVERAGE:0.5:20:1008 \
RRA:AVERAGE:0.5:60:1440 \
RRA:AVERAGE:0.5:80:3240 \
RRA:AVERAGE:0.5:100:5184 \
RRA:AVERAGE:0.5:120:8760 \
RRA:AVERAGE:0.5:240:8760 \
RRA:AVERAGE:0.5:360:8760 \

意思是:

1 hour    -  30 seconds  resolution
2 hours   -  1 minute    resolution
4 hours   -  2 minutes   resolution
1 day     -  5 minutes   resolution
1 week    - 10 minutes   resolution
1 month   - 30 minutes   resolution
3 months  - 40 minutes   resolution
6 months  - 50 minutes   resolution
1 year    -  1 hour      resolution
2 year    -  2 hour      resolution
3 year    -  3 hour      resolution

嗯,我希望这对某人有帮助,就是这样.

猜你在找的MsSQL相关文章