CentOS下,搭建Graphite

1、安装主要依赖关系

配置yum,创建/etc/yum.repos.d/epel.repo  并编辑内容如下:

[epel]name=Extra Packages for Enterprise Linux 6 - $basearch

baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

failovermethod=priority

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

安装主要依赖:

yum install bitmap bitmap-fonts-compat Django django-tagging fontconfig cairo python-devel python-memcached python-twisted  pycairo mod_python python-ldap python-simplejson memcached python-zope-interface mod_wsgi python-sqlite2 bitmap Django django-tagging mod_python python-sqlite2 -y

2、下载源代码包

Graphite主要由三个部分组成:carbon,graphite-web,whisper。下载源代码数据包并解压缩如下:

下载并解压Graphite-web:

wget https://launchpadlibrarian.net/106575888/graphite-web-0.9.10.tar.gz

tar -axf graphite-web-0.9.10.tar.gz -C /usr/local/src/

PS:在解压缩了graphite-web-0.9.10数据包之后,利用其中的“check-dependencies.py”文件已经依赖关系的检查,再执行完该python脚本后,从其输出结果中可以看到有哪些额外的程序需要安装,缺少什么则利用yum程序在线安装即可,直到最后检测的结果提示如:All necessary dependencies are met.与 All optional dependencies are met. 则代表所有依赖关系均已解决。

下载并解压Whisper :

wget https://launchpadlibrarian.net/106575859/whisper-0.9.10.tar.gz

tar -axf whisper-0.9.10.tar.gz -C /usr/local/src/

下载并解压carbon:

wget https://launchpadlibrarian.net/106575865/carbon-0.9.10.tar.gz

tar -axf carbon-0.9.10.tar.gz -C /usr/local/src/

在下载与解压以上三部分代码包之后,分别进入各自解压后的数据包,并执行各自的python setup.py install,则完成Graphite三部分基本安装。

3、配置httpd相关文件

在/etc/httpd/conf.d/graphite.conf文件,执行 vim  /etc/httpd/conf.d/graphite.conf  并写入如下类容:

Listen 8080 

# You may need to manually edit this file   to fit your needs.

# This configuration assumes the default   installation prefix

# of /opt/graphite/, if you installed   graphite somewhere else

# you will need to change all the   occurances of /opt/graphite/

# in this file to your chosen install   location.

<VirtualHost *:8080>

 ServerName graphite

 DocumentRoot   "/opt/graphite/webapp" 

 #   I‘ve found that an equal number of processes & threads tends

 #   to show the best performance for Graphite (ymmv).

 WSGIDaemonProcess graphite processes=5   threads=5 display-name=‘%{GROUP}‘ inactivity-timeout=120

 WSGIProcessGroup graphite 

 #   You will need to create this file! There is a graphite.wsgi.example

 #   file in this directory that you can safely use, just copy it to graphite.wgsi

 WSGIScriptAlias /   /opt/graphite/conf/graphite.wsgi 

 Alias /content/   /opt/graphite/webapp/content/

 <Location "/content/">

 SetHandler None

 </Location> 

 #   NOTE: In order for the django admin site media to work you

 #   must change @[email protected] to be the path to your django

 #   installation, which is probably something like:

 #   /usr/lib/python2.6/site-packages/django

 Alias   /media/   "/usr/lib/python2.4/site-packages/django/contrib/admin/media/"

 <Location "/media/">

 SetHandler None

 </Location> 

 #   The graphite.wsgi file has to be accessible by apache. It won‘t

 #   be visible to clients because of the DocumentRoot though.

 <Directory /opt/graphite/conf/>

 Order deny,allow

 Allow from all

 </Directory> 

</VirtualHost>

vim /etc/httpd/conf.d/wsgi.conf 并写入如下内容:

LoadModule wsgi_module   modules/mod_wsgi.so

WSGISocketPrefix /var/run/wsg

4、配置Graphite:

分别执行如下命令,创建Graphite所必要的配置文件,一般来说就是将 /opt/graphite/conf/下的多个文件后缀中的example除去而生成可用的配置文件,这里最好是保留原有的*example 文件,以其出去后缀example的复件作为其配置文件使用。

cd /opt/graphite/conf/

cp graphite.wsgi.example graphite.wsgi

cp carbon.conf.example carbon.conf

cp storage-schemas.conf.example storage-schemas.conf

cd /opt/graphite/webapp/

cp local_settings.py.example local_setting.py

打开Django部分的settings.py文件,并作如下修改:

vim /opt/graphite/webapp/graphite/settings.py

?

以下是settings.py原有的关于数据库配置选项:

DATABASE_ENGINE = ‘django.db.backends.sqlite3‘    

                            # ‘postgresql‘, ‘mysql‘, ‘sqlite3‘ or   ‘ado_mssql‘.

#DATABASE_NAME = ‘‘         # Or path to   database file if using sqlite3.

#DATABASE_USER = ‘‘         # Not used with   sqlite3.

#DATABASE_PASSWORD = ‘‘     # Not used with   sqlite3.

#DATABASE_HOST = ‘‘         # Set to empty   string for localhost. Not used with sqlite3.

#DATABASE_PORT = ‘‘         # Set to empty   string for default. Not used with sqlite3.

在以上原有的基础上添加如下:

DATABASES = {

      ‘default‘: {

          ‘ENGINE‘: ‘django.db.backends.sqlite3‘,    

          ‘NAME‘: ‘/opt/graphite/storage/graphite‘,            

          ‘USER‘: ‘‘,           

          ‘PASSWORD‘: ‘‘,
          ‘HOST‘: ‘‘,
          ‘PORT‘: ‘‘,                     

      }

}

PS:这里为了方便,所以只用了sqlite数据库,如需使用例如MySQL数据库,则可以在此处填入相应数据库的配置选项即可。

5、数据库初始化

Graphite执行数据库初始化的过程与Django类似,cd /opt/graphite/webapp 进入该目录后执行 python manage.py syncdb 则执行数据库的初始化过程,并根据输出提示填入用户名、密码以及电子邮件等内容即可完成初始化过程。

[[email protected] ~]# python   /opt/graphite/webapp/graphite/manage.py syncdb

/usr/lib/python2.6/site-packages/django/conf/__init__.py:75:   DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use   STATIC_URL instead.

    "use STATIC_URL instead.", DeprecationWarning)

/usr/lib/python2.6/site-packages/django/conf/__init__.py:110:   DeprecationWarning: The SECRET_KEY setting must not be empty.

    warnings.warn("The SECRET_KEY setting must not be empty.",   DeprecationWarning)

/usr/lib/python2.6/site-packages/django/core/cache/__init__.py:82:   DeprecationWarning: settings.CACHE_* is deprecated; use settings.CACHES   instead.

    DeprecationWarning

Creating tables ...

Creating table account_profile

Creating table account_variable

Creating table account_view

Creating table account_window

Creating table account_mygraph

Creating table dashboard_dashboard_owners

Creating table dashboard_dashboard

Creating table events_event

Creating table auth_permission

Creating table auth_group_permissions

Creating table auth_group

Creating table auth_user_user_permissions

Creating table auth_user_groups

Creating table auth_user

Creating table django_session

Creating table django_admin_log

Creating table django_content_type

Creating table tagging_tag

Creating table tagging_taggeditem

You just installed Django‘s auth system,   which means you don‘t have any superusers defined.

Would you like to create one now?   (yes/no): y

Please enter either "yes" or   "no": yes

Username (leave blank to use ‘root‘): root

E-mail address: [email protected]

Password:

Password (again):

Superuser created successfully.

Installing custom SQL ...

Installing indexes ...

Installed 0 object(s) from 0 fixture(s)

并在最后修改/opt/graphite目录的所有者属性:

chown -R apache.apache /opt/graphite

PS:在开启Graphite之前最好检查一下Graphite目录以及目录中的各项文件或者目录文件的所有者是否是apache。

执行完以上步骤之后重启httpd服务并且开启graphite:

service httpd restart

python /opt/graphite/bin/carbon-cache.py start

6、访问Graphite主页

http://localhost:8080

时间: 2024-10-15 20:40:24

CentOS下,搭建Graphite的相关文章

centos下搭建dhcp服务器

centos下搭建dhcp服务器 一.软件环境 CentOS release 6.5 dhcp-4.1.1-51.P1.el6.centos.x86_64 dhcp-common-4.1.1-51.P1.el6.centos.x86_64 二.网络拓扑 dhcp服务器--H3c交换机(7503)-- H3c交换机(5500)-- H3c交换机(3100)--dhcp客户端(办公电脑) 网段: 10.2.240.0/24 10.2.180.0/24 dhcp服务器ip:10.2.33.253 三.

CentOS下搭建LAMP环境详解

前言:在这里将介绍如何在CentOS下搭建LAMP环境(全部使用源码编译安装),用于web服务器开发. •LAMP: Linux + Apache + PHP + Mysql. •系统: CentOS 6.5,32位. CentOS安装 我选取了32位的CentOS 6.5这个Linux系统,安装过程也很简单,不再过多叙述,只稍微介绍一下我的分区情况: 分区名  大小 /boot  200MB /swap  2GB(不大于物理分区即可) /  20GB /home 剩余空间 Apache编译安装

linux Centos下搭建性能监控Spotlight on Unix

公司要做压力测试,有Linux服务器一台,系统Centos6.5,为了直观的展示系统性能,更好的去分析服务器,故要搭建一个监控.闲言休讲,直奔主题. 首先,Linux服务器一台:系统Centos6.5 其次,在我的笔记本上安装监控软件客户端 软件下载地址链接: 链接:http://pan.baidu.com/s/14Vwlw     密码:tmw4 配置spotlight登陆用户,注意spotlight默认不能使用root用户进行连接,需要用户自己创建一个具有root权限的用户.具体方法新建账号

Centos下搭建 nginx+uwsgi+python

python做web应用最麻烦的还是配置服务器了,此话不假,光中间件就有好几种选择,fastcgi.wsgi.uwsgi,难 免让人眼花缭乱. 而听说uwsgi的效率是fastcgi和wsgi的10倍,因此初学python的我就有点跃跃欲试了,打算在centos下搭建个 nginx+uwsgi+python玩玩. 下面是本人经过google和亲身实践所得: 准备工作: yum install python-devel libxml2-devel python-setuptools zlib-de

centos下搭建.NET Core项目运行环境

centos下搭建.NET Core项目运行环境:https://github.com/Somnus/somnus.github.io/blob/master/doc/code/centos%E4%B8%8B%E6%90%AD%E5%BB%BA.NET%20Core%E9%A1%B9%E7%9B%AE%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83.md#%E7%99%BB%E5%BD%95%E6%95%B0%E6%8D%AE%E5%BA%93 原文地址:https://

CENTOS下搭建git代码仓库 ssh协议

centos服务器下搭建git仓库,使用ssh协议管理仓库代码权限    git官网(http://git-scm.com/) 使用ssh协议: 一.安装git,使用yum install git 或者使用 源码包安装git-2.2.0.tar.gz(https://www.kernel.org/pub/software/scm/git/) 新建git用户与用户组 # useradd git # passwd git 二,新建git仓库(仓库位置自己随用户自己决定,例/var/git/testp

CentOS下搭建SVN Server

1. 介绍 这里想在CentOS上搭建的是基于http访问的SVN Server 2. 软件准备 安装相关软件 yum install httpd httpd-devel mod_dav_svn subversion mod_ssl .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; backgro

centos下搭建ruby on rails环境

1.安装ruby 安装成功后,输入ruby -v 会有版本信息 2.执行gem install rails 安装rails 执行该过时出现等待,很久也没有反应,在网上查了之后才知道是找不到资源,解决办法是修改配置源 使用 gem source 命令配置 把http://rubygems.org的gem 改为http://http://ruby.taobao.org 最后确保保留一个有效源 ---------------------- 显示当前使用的sources gem sources 添加一个

centos下搭建多项目svn服务器

svn是多人协作开发中的利器,是一个开放源代码的版本控制系统. 相比与git,他的操作更加简单,windows下有优秀的图形界面,并且支持的文件类型比较多. 本文讲述如何在linux下搭建一个svn服务器,并且进行权限分配,项目管理. 服务器环境:centos7 安装步骤: 1.yum install subversion -y 出现complete即代表安装完成. 2.选择一个目录作为svn服务器根目录 我选择的是 /srv mkdir /srv/svn 3.创建版本库,因为要展示多个版本库的

Linux centOS下搭建RTMP服务器的具体步骤

以下的所需的安装包,可直接在linux系统终端下载,也可从其他地方下载之后拷到对应目录下解压使用,遇到连接不到国外网站时可改变压缩包地址 1.安装依赖包: yum install glibc.i686 #yum –y update #yum -y install gcc glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash.x86_64 perl-