ELK入门(十八)——Kibana APM server安装部署

一、前言

安装内容:

elasticsearch-7.10.1-linux-x86_64.tar.gz(依赖,注意版本)
kibana-7.10.1-linux-x86_64.tar.gz(依赖,注意版本)
apm-server-7.10.1-linux-x86_64.tar.gz (服务端包,注意版本)
elastic-apm-agent-1.21.0.jar(终端包,最新版就行)

前两者就不介绍了,网上的博客很多,会开始安装apm的应该也已经实现ELK搭建了。本文主要介绍apm和apm-agent的安装过程

开启Kibana,打开APM界面并setup instructions

网页很友好地给出了具体的配置过程。我在elasticsearch路径下创建了apm文件夹,apm server 和apm agent都放在这个底下

以及官方链接:https://www.elastic.co/guide/en/apm/agent/java/current/index.html

一、安装APM

1.安装包

APM官网安装地址(含完整操作过程):https://www.elastic.co/guide/en/apm/server/7.10/installing.html

或者直接使用链接https://artifacts.elastic.co/downloads/apm-server/apm-server-7.10.1-linux-x86_64.tar.gz(修改相应版本)

下载完安装包后,在elasticsrarch/路径下创建文件夹apm,将压缩包解压到该文件夹下

cd /data/elk-ayers/elasticsearch-7.10.1-node01/

mkdir apm
cd apm

tar -xvf apm-server-7.10.1-linux-x86_64.tar.gz 

2.配置apm-server.yml

cd apm-server-7.10.1-linux-x86_64
vim apm-server.yml

################################################ APM Server ################################################

apm-server:
  # Defines the host and port the server is listening on. Use "unix:/path/to.sock" to listen on a unix domain socket.
  #apm服务端对外提供http访问ip,端口 目前apm-server本身不支持集群,可以通过反向代理的服务来实现
  host: "ip:8200"

  #允许在kibana中对apm客户端的配置做调整
  kibana:
    # For APM Agent configuration in Kibana, enabled must be true.
    #enabled: false
    enabled: true

    # Scheme and port can be left out and will be set to the default (`http` and `5601`).
    # In case you specify an additional path, the scheme is required: `http://localhost:5601/path`.
    # IPv6 addresses should always be defined as: `https://[2001:db8::1]:5601`.
    #host: "localhost:5601"
    #配置对应kibana的访问地址,
    host: "ip:5601"

#================================= Template =================================

# A template is used to set the mapping in Elasticsearch.
# By default template loading is enabled and the template is loaded.
# These settings can be adjusted to load your own template or overwrite existing ones.

# Set to false to disable template loading.
setup.template.enabled: true

# Template name. By default the template name is "apm-%{[observer.version]}"
# The template name and pattern has to be set in case the elasticsearch index pattern is modified.
setup.template.name: "apm-%{[observer.version]}"

# Template pattern. By default the template pattern is "apm-%{[observer.version]}-*" to apply to the default index settings.
# The first part is the version of apm-server and then -* is used to match all daily indices.
# The template name and pattern has to be set in case the elasticsearch index pattern is modified.
setup.template.pattern: "apm-%{[observer.version]}-*"


#================================ Outputs =================================

# Configure the output to use when sending the data collected by apm-server.

#关闭iml策略
setup.ilm.enabled: false
#-------------------------- Elasticsearch output --------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  # Scheme and port can be left out and will be set to the default (`http` and `9200`).
  # In case you specify and additional path, the scheme is required: `http://localhost:9200/path`.
  # IPv6 addresses should always be defined as: `https://[2001:db8::1]:9200`.
  # hosts: ["localhost:9200"]
  hosts: ["http://ip:9200","http://ip:9200"]
  index: "apm-%{[observer.version]}-%{+yyyy.MM.dd}"

3、启动和查看

#非后台启动服务方式
./apm-server

#后台启动服务方式
nohup ./apm-server > /dev/null 2>&1 &

运行情况查看

#查看服务进程
ps -ef|grep apm-server 

#日志信息查看,以nohup运行时可以查看
# find / -name nohup.out
tail /路径/nohup.out

在Kibana查看,单击check按钮,发现成功检测到我们的APM

二、安装Apm agent (以Java为例)

1.安装包

根据提示,到Maven Centra下载agent:https://search.maven.org/artifact/co.elastic.apm/elastic-apm-agent,我直接下载的是这时的最新版1.21.0版本

关于Agent的官方链接:https://www.elastic.co/guide/en/apm/agent/java/current/index.html

当前apm文件夹下存在apm-server-7.10.1-linux-x86_64,再创建一个apm-agent文件夹

cd /data/elk-ayers/elasticsearch-7.10.1-node01/apm

mkdir apm-agent
cd apm-agent

2.配置

按照官网提示输入下方代码。注意要调整javaagent、server_urls、最后一行,分别是 路径与文件名 、 ip:port 、我们想部署的jar包。

java \
 -javaagent:/data/elk-ayers/elasticsearch-7.10.1-node01/apm/apm-agent/elastic-apm-agent-1.21.0.jar\
 -Delastic.apm.service_name=my-application\
 -Delastic.apm.server_urls=http://172.20.64.5:8200\
 -Delastic.apm.application_packages=org.example\
 -jar my-application.jar

3.查看进程

ps -ef|grep Delastic

发现有进程产生了,在kibana界面查看,发现生成了my-application

 

 

问题小结:

1.data path already locked by another beat.Please make sure that multiple beats not sharing the same data path.

2.unable to access jarfile xx.jar

这个问题一般是文件名或者路径出错了,检查以下路径和文件名,检查该文件是否存在

 

 

参考博客:

Linux 环境 离线 ELK7.4.0之APM服务安装(含kibana配套使用说明)

APM安装部署说明

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是将 ELK7.4.2 部署在 Docker Compose 中,并汉化 Kibana 的详细步骤: 1. 创建一个名为 `docker-elk` 的文件夹,并在该文件夹中创建一个 `docker-compose.yml` 文件。 2. 在 `docker-compose.yml` 文件中添加以下内容: ``` version: '3' services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 container_name: elasticsearch environment: - discovery.type=single-node ports: - 9200:9200 - 9300:9300 volumes: - ./elasticsearch/data:/usr/share/elasticsearch/data networks: - elk logstash: image: docker.elastic.co/logstash/logstash:7.4.2 container_name: logstash volumes: - ./logstash/config:/usr/share/logstash/pipeline/ ports: - 5000:5000 - 9600:9600 networks: - elk kibana: image: docker.elastic.co/kibana/kibana:7.4.2 container_name: kibana environment: - ELASTICSEARCH_URL=http://elasticsearch:9200 ports: - 5601:5601 volumes: - ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml networks: - elk networks: elk: ``` 3. 在 `docker-elk` 文件夹中创建一个名为 `kibana` 的文件夹,并在该文件夹中创建一个 `config` 文件夹。 4. 在 `config` 文件夹中创建一个 `kibana.yml` 文件,并将以下内容添加到该文件中: ``` server.name: kibana server.host: "0.0.0.0" i18n.locale: "zh-CN" ``` 其中,`i18n.locale` 的值可以设置为任何支持的语言。 5. 在 `docker-elk` 文件夹中创建一个名为 `elasticsearch` 的文件夹,并在该文件夹中创建一个 `data` 文件夹。 6. 在 `docker-elk` 文件夹中创建一个名为 `logstash` 的文件夹,并在该文件夹中创建一个 `config` 文件夹。 7. 在 `config` 文件夹中创建一个名为 `logstash.conf` 的文件,并将以下内容添加到该文件中: ``` input { tcp { port => 5000 } } output { elasticsearch { hosts => "elasticsearch:9200" index => "logstash-%{+YYYY.MM.dd}" } } ``` 8. 在 `docker-elk` 文件夹中打开终端,并运行以下命令: ``` docker-compose up -d ``` 该命令将下载并启动 ELK 服务。 9. 打开浏览器,访问 `http://localhost:5601`,即可进入 Kibana 界面。 10. 在 Kibana 界面中,选择 `Management`,然后选择 `Stack Management`,最后选择 `Kibana Settings`。 11. 在 `Kibana Settings` 中,将 `i18n.locale` 的值设置为 `zh-CN`,然后点击 `Save` 按钮。 12. 刷新浏览器页面,即可看到已经汉化的 Kibana 界面。 以上就是使用 Docker Compose 部署 ELK7.4.2 并汉化 Kibana 的详细步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值