当前位置:网站首页>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
边栏推荐
- Advanced mathematics | Takeshi's "classic series" daily question train of thought and summary of error prone points
- 187. Repeated DNA sequence
- Stm32+mfrc522 completes IC card number reading, password modification, data reading and writing
- pycharm 打开多个项目的两种小技巧
- Pat grade a a1076 forwards on Weibo
- MySQL 强化知识点
- Polynomial open root
- 756. Serpentine matrix
- 760. String length
- Original root and NTT 5000 word explanation
猜你喜欢

What is the difference between NFT and digital collections?
![[leetcode database 1050] actors and directors who have cooperated at least three times (simple question)](/img/ab/bad6b86039384af7b829bef5316923.png)
[leetcode database 1050] actors and directors who have cooperated at least three times (simple question)

redis原理和使用-安装和分布式配置

Use of off heap memory

对标注文件夹进行清洗

Does volatile rely on the MESI protocol to solve the visibility problem? (next)

Unity topdown character movement control

Datax的学习笔记

ext3文件系统的一个目录下,无法创建子文件夹,但可以创建文件

巴比特 | 元宇宙每日必读:元宇宙的未来是属于大型科技公司,还是属于分散的Web3世界?...
随机推荐
Sending and receiving of C serialport
Probability model in machine learning
Horizontal comparison of the data of the top ten blue chip NFTs in the past half year
【final关键字的使用】
Mutual transformation of array structure and tree structure
聪明的美食家 C语言
【Mysql】一条SQL语句是怎么执行的(二)
756. Serpentine matrix
JS - DataTables 关于每页显示数的控制
PHP和MySQL获取week值不一致的处理
The idea shortcut key ALT realizes the whole column operation
【Mysql】认识Mysql重要架构(一)
力扣链表题
codeforces dp合集
Apple generated and verified tokens for PHP
838. 堆排序
Elastic APM安装和使用
力扣——二叉树剪枝
The Child and Binary Tree-多项式开根求逆
2022茶艺师(中级)特种作业证考试题库模拟考试平台操作