Graphite 系统安装,graphite系统安装
安装以来软件
- 安装mysql
yum install mysql-server mysql-devel mysql
默认yum安装版本 5.1.73
- 数据库字符集设置
mysql配置文件/etc/my.cnf中加入default-character-set=utf8
- 启动mysql服务:
service mysqld start或者/etc/init.d/mysqld start
- 添加开机启动:
chkconfig mysqld on
检查是否设置成功
chkconfig –list |grep mysqld
默认情况,mysql命令就可以进入mysql数据库
2.2 首先为用户创建一个数据库(testDB):
mysql>create database testDB;
2.3 授权test用户拥有testDB数据库的所有权限(某个数据库的所有权限):
mysql>grant all privileges on testDB.* to test@localhost identified by ‘1234’;
mysql>flush privileges;//刷新系统权限表
格式:grant 权限 on 数据库.* to 用户名@登录主机 identified by “密码”;
2.4 如果想指定部分权限给一用户,可以这样来写:
mysql>grant select,update on testDB.* to test@localhost identified by ‘1234’;
mysql>flush privileges; //刷新系统权限表
2.5 授权test用户拥有所有数据库的某些权限:
mysql>grant select,delete,update,create,drop on . to test@”%” identified by “1234”;
//test用户对所有数据库都有select,delete,update,create,drop 权限。
//@”%” 表示对所有非本地主机授权,不包括localhost。(localhost地址设为127.0.0.1,如果设为真实的本地地址,不知道是否可以,没有验证。)
//对localhost授权:加上一句grant all privileges on testDB.* to test@localhost identified by ‘1234’;即可。
====================================================================================================
http://heylinux.com/archives/3858.html
安装配置Graphite相关软件(MySQL部分可以分开配置,使用独立的服务器)
yum install -y graphite-web graphite-web-selinux MySQL-python
vi /etc/graphite-web/local_settings.py
DATABASES = {
‘default’: {
‘NAME’: ‘graphite’,
‘ENGINE’: ‘django.db.backends.mysql’,
‘USER’: ‘graphite’,
‘PASSWORD’: ‘xxxx’,
‘HOST’: ‘xx’,
‘PORT’: ‘3306’
}
}
执行数据库初始化
/usr/lib/python2.6/site-packages/graphite/manage.py syncdb
Would you like to create one now? (yes/no): yes
Username (leave blank to use ‘root’): root
E-mail address: guosuiyu@gmail.com
Password: graphite
Password (again): graphite
启动Apache服务,作为Graphite的Web服务器
service httpd start
安装底层的绘图与数据采集软件
yum install -y python-carbon python-whisper
启动数据采集进程
service carbon-cache start
更新配置,保留所有metrics目录下数据90天(默认仅保留1天,也就是说看不到1天以前的数据绘图)
vi /etc/carbon/storage-schemas.conf
[carbon]
priority = 101
pattern = ^carbon.
retentions = 60:90d
[default_1min_for_90days]
priority = 100
pattern = .*
retentions = 60:90d