码迷,mamicode.com
首页 > 其他好文 > 详细

Graphite+StatsD部署手册

时间:2018-11-13 17:13:35      阅读:421      评论:0      收藏:0      [点我收藏+]

标签:table   main   mode   lin   argv   sha   key   template   ice   

安装pip、carbon 和whisper

yum -y install epel-release   #安装epel扩展源pip才能安装

yum -y install python-pip

yum -y install python-devel

yum -y install gcc

yum -y install unzip

pip install carbon (pip install --no-index --find-links=/app/tools/stada/ carbon)

如果incremental报错,请先手动安装它:pip install --no-index --find-links=/app/tools/stada/ incremental

pip install whisper(pip install --no-index --find-links=/app/tools/stada/ whisper)

安装graphite-web

yum -y install libffi-devel zlib-devel openssl-devel install uwsgi-plugin-python

pip install graphite-web (pip install --no-index --find-links=/app/tools/stada/ graphite-web)

pip uninstall django

pip install django==1.8(pip install --no-index --find-links=/app/tools/stada/ django==1.8)

修改配置文件

cd /opt/graphite/conf/

ls #查看所有文件,拷贝去除example

cp aggregation-rules.conf.example aggregation-rules.conf

cp blacklist.conf.example blacklist.conf

cp carbon.amqp.conf.example carbon.amqp.conf

cp carbon.conf.example carbon.conf

cp dashboard.conf.example dashboard.conf

cp graphite.wsgi.example graphite.wsgi

cp graphTemplates.conf.example graphTemplates.conf

cp relay-rules.conf.example relay-rules.conf

cp rewrite-rules.conf.example rewrite-rules.conf

cp storage-aggregation.conf.example storage-aggregation.conf

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

cp whitelist.conf.example whitelist.conf

cd /opt/graphite/webapp/graphite

cp local_settings.py.example local_settings.py

cd ../

mv content static

添加配置文件

vi uwsgi.ini

[uwsgi]

# Django-related settings

socket = :8000

buffer-size = 40000

plugins=python

# the base directory (full path)

chdir = /opt/graphite/webapp

# Django s wsgi file

module = graphite.wsgi

# process-related settings

# master

master = true

# maximum number of worker processes

processes = 1

# ... with appropriate permissions - may be needed

# chmod-socket = 664

# clear environment on exit

vacuum = true

创建manage.py,进行数据库的操作

cd /opt/graphite/webapp/

vi manage.py 写入如下内容:

#!/usr/bin/env python

import os

import sys

 

 

if __name__ == "__main__":

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "graphite.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

数据库操作

pip install scandir (pip install --no-index --find-links=/app/tools/stada/ scandir)

python manage.py migrate

vi /opt/graphite/webapp/graphite/local_settings.py

#取消SECRET_KEY、TIME_ZONE注释,并且修改值:

SECRET_KEY = ‘@2o8&38gcsb(p*o*dy(fmh!_3-30a1qwq$sadb+6vk243%wj0#‘

TIME_ZONE = ‘Asia/Shanghai‘

#保存退出

通过manage.py shell修改网站登录的用户名和密码

python manage.py shell

>>> from django.contrib.auth.models import User

>>> user_list=[x for x in User.objects.all()]

>>> print user_list

#如果user_list不为空

>>>user=user_list[0]

>>>user.username=‘admin‘

>>>user.set_password=‘123123‘

>>>user.save()

#如果user_list为空

>>>quit()

python manage.py createsuperuser

#根据提示创建你的用户

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

Email address: luoxijun@sfmail.sf-express.com

Password:     #输入后不会显示,我输的admin@123456

Password (again):     #输入后不会显示

启动carboncarbon会在默认的2003端口接收数据

# pip install --no-index --find-links=/app/tools/stada/ service_identity

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

uwsgi --ini /opt/graphite/webapp/uwsgi.ini

#再新建一个窗口,启动nginx,或者让uwsgi后台运行,建议测试的时候新建窗口,错误好捕获。启动nginx之前,先关闭防火墙或者开启8001端口。我做测试,就关闭防火墙了。

systemctl disable firewalld #停用防火墙

systemctl stop firewalld    #禁止防火墙

/usr/local/nginx/sbin/nginx           #启动nginx

/usr/local/nginx/sbin/nginx -s reload   #重启nginx

 

Graphite+StatsD部署手册

标签:table   main   mode   lin   argv   sha   key   template   ice   

原文地址:https://www.cnblogs.com/chmyee/p/9952992.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!