sentry安装与配置

文章目录

  • 1 切换到python虚拟环境
  • 2 安装postgresql
  • 3 安装sentry
  • 4 创建sentry目录
  • 5 初始化
  • 6 修改配置文件
  • 7 初始化数据库
  • 8 启动
  • 9 登录
  • 10 查看sentry安装目录
  • 技术交流

1 切换到python虚拟环境

# source /Data/apps/ops4env/bin/activate

2 安装postgresql

# sudo yum install -y postgresql-devel.x86_64

3 安装sentry

这里安装v8.14.1版本

# pip install sentry==8.14.1 -i https://pypi.doubanio.com/simple

4 创建sentry目录

# mkdir /Data/apps/sentry

5 初始化

$ sentry init /Data/apps/sentry

发现多了config.yml,sentry.conf.py 配置

(ops4env) [dev@sxxxx-dev sentry]$ ll
总用量 8
-rw-rw-r-- 1 dev dev 1966 4月  29 14:25 config.yml
-rw-rw-r-- 1 dev dev 3581 4月  29 14:25 sentry.conf.py
(ops4env) [dev@sxxxx-dev sentry]$

6 修改配置文件

vi config.yml

(提前部署好redis实例10.1.201.101:6537,只用修改redis.clusters)

redis.clusters:
  default:
    hosts:
      0:
        host: 10.1.201.101
        port: 6537

vi sentry.conf.py

(提前创建好mysql数据库sentry,只用修改DATABASES、BROKER_URL)。如果发现端口被占用,修改SENTRY_WEB_PORT

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'sentry',
        'USER': 'admin',
        'PASSWORD': 'p123456',
        'HOST': '10.1.210.168',
        'PORT': '3306',
        'AUTOCOMMIT': True,
        'ATOMIC_REQUESTS': False,
    }
}
 
 
BROKER_URL = 'redis://10.1.201.101:6537'
 
SENTRY_WEB_PORT = 9100

7 初始化数据库

# export SENTRY_CONF="/Data/apps/sentry"
# sentry django syncdb
# sentry django migrate

初始化过程中,创建一个超级用户 [email protected] pwd123456

Would you like to create a user account now? [Y/n]: Y
Email: [email protected]
Password:
Repeat for confirmation:
Should this user be a superuser? [y/N]: y
User created: [email protected]

8 启动

# export SENTRY_CONF="/Data/apps/sentry"
# sentry run web
# sentry run worker
# sentry run cron

9 登录

http://101.1.21.170:9100/ [email protected] pwd123456
sentry安装与配置_第1张图片

10 查看sentry安装目录

(ops4env) [dev@cxxx-dev sentry]$ python
Python 2.7.9 (default, Sep 8 2015, 11:07:50)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/Data/apps/ops4env/lib/python27.zip', '/Data/apps/ops4env/lib/python2.7', '/Data/apps/ops4env/lib/python2.7/plat-linux2', '/Data/apps/ops4env/lib/python2.7/lib-tk', '/Data/apps/ops4env/lib/python2.7/lib-old', '/Data/apps/ops4env/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/Data/apps/ops4env/lib/python2.7/site-packages']
>>>

cd /Data/apps/ops4env/lib/python2.7/site-packages/sentry

技术交流

CleverCode是一名架构师,技术交流,咨询问题,请加CleverCode创建的qq群(架构师俱乐部):517133582。加群和腾讯,阿里,百度,新浪等公司的架构师交流。【架构师俱乐部】宗旨:帮助你成长为架构师!
在这里插入图片描述

你可能感兴趣的:(架构师)