当前位置:网站首页>Elastic APM installation and use
Elastic APM installation and use
2022-07-26 09:16:00 【Or turn around】
stay The above distributed tracking system selection and practice in , I briefly introduced APM System , Here is a record of Elastic APM Installation and use process of .
build elk
according to es Official website description: deploy separately ( See references ).
Deploy elasticsearch
Download... From the command line elasticsearch:curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-linux-x86_64.tar.gz
Extract to the specified directory , Such as /usr/local Catalog .
Get into elasticsearch Of bin Catalog , function elasticsearch Script :./elasticsearch
You can start elasticsearch. To the local 9200 Port send a http request , Get back to the following :
Deploy logstash
download logstash:https://www.elastic.co/cn/downloads/logstash(7.9 edition )
Extract to the specified directory , Such as /usr/local.
Get into logstash Catalog , function logstash Script :./bin/logstash -f config/logstash-sample.conf
You can see the current output :
If elasticsearch Not running , May be an error : Unable to connect es example .
Deploy kibana
Download... From the command line kibana:wget https://artifacts.elastic.co/downloads/kibana/kibana-7.0.1-linux-x86_64.tar.gz
Extract to the specified directory , Get into bin Directory execution scripts :./kibana
visit 127.0.0.1:5601, You can see the interface kibana Interface :
Elk Use
It's starting up logstash It is started through the sample configuration file , Now create a new configuration file logstash.conf:
And then restart it logstash, Specify the configuration file as the newly created file :
./bin/logstash -f config/logstash.conf
This configuration file represents reading data from the file , And store it to elasticsearch in , The index name is test-log-[ years ].
stay kibana Of manager Page view index , You will find a new one named test-log-2020.11 The index of .
establish Index pattern, Enter the index regular expression , Will automatically match the index file :
After creating the regular expression of the index , stay discover The page can select the index . You can search data by entering query criteria in the search box .
Elastic APM
start-up apm server
download (https://www.elastic.co/guide/en/apm/server/7.0/installing.html
) And extract the apm server To the specified directory , Get into bin Directory import kibana apm Instrument cluster and start apm server:
./apm-server setup
./apm-server -e
start-up agent
In different languages agent The use of is different . Let's say python Of agent Take an example to illustrate .
Supported by web Refer to the official website description for the framework and version :https://www.elastic.co/guide/en/apm/agent/python/5.x/supported-technologies.html.
Python Medium agent It is provided in the form of a library , Just integrate in the code , As shown below :
from flask import Flask
from elasticapm.contrib.flask import ElasticAPM
from elasticapm.handlers.logging import LoggingHandler
app = Flask(__name__)
app.config['ELASTIC_APM'] = {
'SERVER_URL': 'http://127.0.0.1:8200',
'DEBUG': True
}
apm = ElasticAPM(app, service_name='python-test', logging=True)
port = 5000
@app.route('/')
def hello_world():
try:
1 / 0
except ZeroDivisionError:
apm.client.capture_exception()
return 'Hello World! I am running on port ' + str(port)
if __name__ == '__main__':
handler = LoggingHandler(client=apm.client)
app.logger.addHandler(handler)
app.run(host='0.0.0.0', port=port)
visit http://127.0.0.1:5000/ Interface , Output :Hello World! I am running on port 5000.
The official website said support 6.0+ Version of tornado, But use agent After that, the service cannot be started ,why??
APM Interface
Get into kibana Of apm menu , Create as directed apm Interface . After completion, you can see the following interface :
Click on server Get into :

Get into discover menu , choice apm-* Indexes , You can see apm Index data .
The next article will continue with cat Installation and use .
Reference material
[1].https://www.elastic.co/guide/en/apm/get-started/7.9/install-and-run.html
边栏推荐
- Grain College of all learning source code
- Where are the laravel framework log files stored? How to use it?
- 力扣链表题
- 聪明的美食家 C语言
- How to quickly learn a programming language
- Advanced mathematics | Takeshi's "classic series" daily question train of thought and summary of error prone points
- Server memory failure prediction can actually do this!
- ext3文件系统的一个目录下,无法创建子文件夹,但可以创建文件
- 公告 | FISCO BCOS v3.0-rc4发布,新增Max版,可支撑海量交易上链
- 760. String length
猜你喜欢

Study notes of canal

STM32+MFRC522完成IC卡号读取、密码修改、数据读写

CSDN Top1 "how does a Virgo procedural ape" become a blogger with millions of fans through writing?

NTT(快速数论变换)多项式求逆 一千五百字解析

The Child and Binary Tree-多项式开根求逆

分布式跟踪系统选型与实践

2022流动式起重机司机考试题模拟考试题库模拟考试平台操作

NFT与数字藏品到底有何区别?

unity TopDown角色移动控制

Horizontal comparison of the data of the top ten blue chip NFTs in the past half year
随机推荐
Elastic APM安装和使用
Espressif plays with the compilation environment
unity TopDown角色移动控制
Error: cannot find module 'UMI' problem handling
垂直搜索
[MySQL] detailed explanation of MySQL lock (III)
Datax的学习笔记
zsh: command not found: nvm
Nuxt - 项目打包部署及上线到服务器流程(SSR 服务端渲染)
209. Subarray with the smallest length
Day06 homework - skill question 7
Pat grade a a1013 battle over cities
QtCreator报错:You need to set an executable in the custom run configuration.
2022化工自动化控制仪表操作证考试题模拟考试平台操作
839. Simulation reactor
【线上死锁分析】由index_merge引发的死锁事件
2B和2C
【ARKit、RealityKit】把图片转为3D模型
JS - DataTables control on the number of displays per page
jvm命令归纳