简介
sentry 是一个开源的实时错误监控的项目,它支持很多端的配置,包括 web 前端、服务器端、移动端及其游戏端。
支持各种语言,例如 python、oc、java、node、javascript 等。也可以应用到各种不同的框架上面,如前端框架中的
vue 、angular 、react 等最流行的前端框架。
提供了github、slack、trello 的常见的开发工具的集成。可以自己安装并且搭建 sentry 应用。
优点
- 多项目,多用户
- 界面友好
- 可以配置异常触发规则,例如监控到程序出现异常后发送邮件
- 支持语言多
部署Sentry
Docker 19.03.6 Compose 1.24.1 4 CPU Cores 8 GB RAM 20 GB Free Disk Space
实时日志平台(错误日志收集)
部署docker
代码语言:javascript复制mkdir /etc/docker
yum -y localinstall containerd.io-1.2.10-3.2.fc30.x86_64.rpm docker-ce-cli-19.03.6-3.fc30.x86_64.rpm docker-ce-19.03.1-3.el7.x86_64.rpm
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://plqjafsr.mirror.aliyuncs.com"]
}
EOF
# 启动Docker后台服务
systemctl start docker && systemctl enable docker
systemctl daemon-reload
部署python3
代码语言:javascript复制yum -y install python36 git
# 移除之前的python
mv /usr/bin/python /usr/bin/python2_bak
安装docker-compose
代码语言:javascript复制 curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
tail -1 /etc/profile
export PATH="/usr/local/bin:$PATH"
source /etc/profile
chmod x /usr/local/bin/docker-compose
docker-compose --version
# docker-compose version 1.25.5, build 8a1c60f6
下载版本库
代码语言:javascript复制git clone https://github.com/getsentry/onpremise.git
cd onpremise
启动安装
代码语言:javascript复制./install.sh
[root@sentry-12 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sentry-cleanup-onpremise-local latest fb03d231ab9d 2 minutes ago 939MB
symbolicator-cleanup-onpremise-local latest d5124910e9fd 2 minutes ago 190MB
snuba-cleanup-onpremise-local latest b9974e6d30da 3 minutes ago 401MB
getsentry/sentry nightly b79a66325a5a 2 hours ago 939MB
getsentry/snuba nightly bbf0cc57cdb1 3 hours ago 401MB
getsentry/snuba <none> 4dcd02402a7c 23 hours ago 401MB
getsentry/relay nightly fb4c6feab731 3 days ago 220MB
getsentry/symbolicator nightly d2df7abbe190 8 days ago 190MB
maxmindinc/geoipupdate latest 8ec32cc727c7 9 days ago 10.6MB
redis 5.0-alpine 618083532dc7 2 weeks ago 29.3MB
postgres 9.6 673ba4512dda 2 weeks ago 200MB
tianon/exim4 latest d02995a16c40 2 weeks ago 157MB
busybox latest 388056c9a683 3 weeks ago 1.23MB
yandex/clickhouse-server 20.3.9.70 abe55fc6544d 11 months ago 497MB
nginx 1.16 dfcfd8e9a5d3 12 months ago 127MB
confluentinc/cp-kafka 5.5.0 89e8e98718a8 12 months ago 598MB
confluentinc/cp-zookeeper 5.5.0 124ff6469e3d 12 months ago 598MB
memcached 1.5-alpine 0dbf6b4c454b 14 months ago 9.19MB
[root@sentry-12 ~]#
# 创建用户与密码
# 注意内存大小
# 启动, 通过IP:9000即可访问,用之前创建账号即可登录
docker-compose up
lsof -i:9000
访问
修改语言和时区
使用
创建项目
再启动
编译Jar包
代码语言:javascript复制# 安装maven
tar xf apache-maven-3.6.1-bin.tar.gz
mv apache-maven-3.6.1 /usr/local/
cd /usr/local/apache-maven-3.6.1/
tail -2 /etc/profile
export MAVEN_HOME="/usr/local/apache-maven-3.6.1"
export PATH=${PATH}:${MAVEN_HOME}/bin
source /etc/profile
# 修改mvn仓库源
vim /usr/local/apache-maven-3.6.1/conf/settings.xml
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
# 将上面dsn地址修改到源码的 PassportDemoApplication类
# 重新编译
rm -rf target/*
mvn clean package
# 修改启动命令
java -Dspring.cloud.nacos.discovery.server-addr=192.168.91.11:8848
-Dspring.cloud.nacos.config.server-addr=192.168.91.11:8848
-jar target/demo-0.0.1-SNAPSHOT.jar