当前位置:网站首页>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
边栏推荐
- Datax的学习笔记
- Hbuilderx runs the wechat developer tool "fail to open ide" to solve the error
- Nuxt - Project packaging deployment and online to server process (SSR server rendering)
- 2B和2C
- 838. Heap sorting
- MySQL strengthen knowledge points
- 2022流动式起重机司机考试题模拟考试题库模拟考试平台操作
- redis原理和使用-安装和分布式配置
- Innovus卡住,提示X Error:
- Clean the label folder
猜你喜欢

Datax的学习笔记

Original root and NTT 5000 word explanation

220. Presence of repeating element III

Redis principle and usage - installation and distributed configuration

围棋智能机器人阿法狗,阿尔法狗机器人围棋

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

JDBC database connection pool (Druid Technology)

Nuxt - Project packaging deployment and online to server process (SSR server rendering)

Nuxt - 项目打包部署及上线到服务器流程(SSR 服务端渲染)

谷粒学院的全部学习源码
随机推荐
The essence of attack and defense strategy behind the noun of network security
李沐d2l(四)---Softmax回归
Announcement | FISCO bcos v3.0-rc4 is released, and the new Max version can support massive transactions on the chain
PAT 甲级 A1013 Battle Over Cities
Mutual transformation of array structure and tree structure
redis原理和使用-基本特性
MySQL 强化知识点
MySQL strengthen knowledge points
Nuxt - Project packaging deployment and online to server process (SSR server rendering)
Qt | 关于如何使用事件过滤器 eventFilter
187. Repeated DNA sequence
Error: Cannot find module ‘umi‘ 问题处理
js闭包:函数和其词法环境的绑定
CF1481C Fence Painting
Stm32+mfrc522 completes IC card number reading, password modification, data reading and writing
"No input file specified" problem handling
pycharm 打开多个项目的两种小技巧
Flask project learning (I) -- sayhello
codeforces dp合集
Tornado multi process service