美文网首页
SkyWalking部署

SkyWalking部署

作者: 追梦小蜗牛 | 来源:发表于2020-09-23 21:00 被阅读0次
image.jpg

介绍:

SkyWalking 创建于2015年,提供分布式追踪功能;他被用于追踪、监控和诊断分布式系统,特别是使用微服务架构,云原生或容器技术。

功能:

  • 分布式追踪和上下文传输
  • 应用、实例、服务性能指标分析
  • 应用拓扑分析
  • 应用和服务依赖分析
  • 慢服务检测
  • 性能优化

组成:

  • Agent:作用是使用JavaAgent字节码增强技术将Agent的代码织入程序中,完成Agent无代码侵入地获取程序内方法的上下文并进行增强和收集信息并发送给Collector;与Collector进行心跳,表明Agent客户端的存活。
  • Collector:作用是维护存活的Agent实例,并收集从Agent发送至Collector的数据,进行处理及持久化。
  • Web:作用是将Collector收集的参数进行不同维度的展示。

Elasticsearch:

Elasticsearch是一个开源的分布式、RESTful 风格的搜索和数据分析引擎,它的底层是开源库Apache Lucene,Lucene 可以说是当下最先进、高性能、全功能的搜索引擎库。
为了解决Lucene使用时的繁复性,于是Elasticsearch便应运而生。它使用 Java 编写,内部采用 Lucene 做索引与搜索,但是它的目标是使全文检索变得更简单,简单来说,就是对Lucene 做了一层封装,它提供了一套简单一致的 RESTful API 来帮助我们实现存储和检索。

Elasticsearch安装、配置

从官网下载对应的包,不同的版本可能需要不同的jdk版本;直接解压,修改elasticsearch.yml,执行./bin/elasticsearch命令,第一次可能会报一个异常如下:

java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.jav
a:103) ~[elasticsearch-6.7.0.jar:6.7.0]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[ela
sticsearch-6.7.0.jar:6.7.0]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) [elast
icsearch-6.7.0.jar:6.7.0]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159
) [elasticsearch-6.7.0.jar:6.7.0]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:
150) [elasticsearch-6.7.0.jar:6.7.0]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwar
eCommand.java:86) [elasticsearch-6.7.0.jar:6.7.0]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:1
24) [elasticsearch-cli-6.7.0.jar:6.7.0]
    at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cl
i-6.7.0.jar:6.7.0]

为了安全起见,默认不能使用root账户登录,需要新建一个用户来执行。接下来,有可能会遇到下一个异常:

[2020-09-23T01:44:27,315][ERROR][o.e.b.Bootstrap          ] [node-1] node valida
tion exception
[1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase 
to at least [65535]
[2020-09-23T01:44:27,319][INFO ][o.e.n.Node               ] [node-1] stopping ..
.
[2020-09-23T01:44:27,359][INFO ][o.e.n.Node               ] [node-1] stopped
[2020-09-23T01:44:27,359][INFO ][o.e.n.Node               ] [node-1] closing ...
[2020-09-23T01:44:27,383][INFO ][o.e.n.Node               ] [node-1] closed
[2020-09-23T01:44:27,385][INFO ][o.e.x.m.p.NativeController] [node-1] Native con
troller process has stopped - no new native processes can be started
[2020-09-23T01:54:39,269][INFO ][o.e.e.NodeEnvironment    ] [node-1] using [1] d
ata paths, mounts [[/ (/dev/sda1)]], net usable_space [35.9gb], net total_space 
[58.8gb], types [ext4]

这个异常需要修改一个文件:/etc/security/limits.conf,增加如下两行:
easy soft nofile 65536
easy hard nofile 65536
查看命令:ulimit -Hn、ulimit -Sn


图片.png

修改完之后,应该就可以正常启动了。
elasticsearch.yml配置文件:

# Use a descriptive name for your cluster:
#
cluster.name: my-es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /usr/local/elasticsearch/data
#
# Path to log files:
#
path.logs: /usr/local/elasticsearch/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200

SkyWalking安装

直接下载对应的发布包,解压到对应的目录,直接运行./bin/startup.sh,应该可以正常启动。
然后直接访问:http://127.0.0.1:8080
新建几个测试demo,发起rest调用。
界面如下图:


图片.png
图片.png
图片.png

总结:

多动手,多思考,多借助工具。

相关文章

网友评论

      本文标题:SkyWalking部署

      本文链接:https://www.haomeiwen.com/subject/yhaoyktx.html