您的位置:首页 > 运维架构 > Linux

Centos7 安装skywalking+elasticsearch,实现java web程序链路追踪

2020-02-11 19:11 841 查看

skywalking+elasticsearch实现java web程序链路追踪

源码:联系作者1782800572

Skywalking暂不支持elasticsearch版本6.0.0以上

安装elastic search5.6.13:
tar -xzvf elasticsearch-5.6.13.tar.gz --解压安装包
mv elasticsearch-5.6.13 /usr/local/elasticsearch --移动安装包到指定目录
cd /usr/local/elasticsearch --进入目录
groupadd elsearch --创建elsearch组
useradd elsearch -g elsearch --创建elsearch用户
mkdir -p /path/to/data
mkdir -p /path/to/logs
chown -R elsearch:elsearch /path/to/
chmod -R 776 /path/to/
chown -R elsearch:elsearch /usr/local/elasticsearch
chmod -R 776 /usr/local/elasticsearch
su elsearch
cd /usr/local/elasticsearch
vi config/elasticsearch.yml --修改配置文件:
cluster.name: application ##集群名称
node.name: “node-1” ##节点名称,同一集群下名称不同
node.master: true ##是否可选为主节点
node.data: true ##是否存放数据
path.data: /path/to/data ##数据目录
path.logs: /path/to/logs ##日志目录
transport.tcp.port: 9300 ##tcp端口
http.port: 9200 ##http端口
discovery.zen.ping.unicast.hosts: [“节点ip”,”节点IP”] ##初始化节点
network.host: 0.0.0.0 ##默认0.0.0.0
network.bind_host: 0.0.0.0
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

浏览器查看启动状态:

安装skywalking 5.0.0-GA

官网下载:http://skywalking.apache.org/downloads/

解压:tar –zxvf apache-skywalking-apm-incubating-5.0.0-GA.tar.gz

修改配置文件:collector连接文件

#cluster:
#  zookeeper:
#    hostPort: localhost:2181
#    sessionTimeout: 100000
naming:
jetty:
host: 192.168.37.130  #虚拟机地址
port: 10800
contextPath: /
cache:
#  guava:
caffeine:
remote:
gRPC:
host: 192.168.37.130
port: 11800
agent_gRPC:
gRPC:
host: 192.168.37.130
port: 11800
#Set these two setting to open ssl
#sslCertChainFile: $path
#sslPrivateKeyFile: $path

#Set your own token to active auth
#authentication: xxxxxx
agent_jetty:
jetty:
host: 192.168.37.130
port: 12800
contextPath: /
analysis_register:
default:
analysis_jvm:
default:
analysis_segment_parser:
default:
bufferFilePath: ../buffer/
bufferOffsetMaxFileSize: 10M
bufferSegmentMaxFileSize: 500M
bufferFileCleanWhenRestart: true
ui:
jetty:
host: 192.168.37.130
port: 12800
contextPath: /
storage:
elasticsearch:
clusterName: CollectorDBCluster
clusterTransportSniffer: true
clusterNodes: 192.168.37.130:9300
indexShardsNumber: 2
indexReplicasNumber: 0
highPerformanceMode: true
ttl: 7
#storage:
#  h2:
#    url: jdbc:h2:~/memorydb
#    userName: sa
configuration:
default:
#     namespace: xxxxx
# alarm threshold
applicationApdexThreshold: 2000
serviceErrorRateThreshold: 10.00
serviceAverageResponseTimeThreshold: 2000
instanceErrorRateThreshold: 10.00
instanceAverageResponseTimeThreshold: 2000
applicationErrorRateThreshold: 10.00
applicationAverageResponseTimeThreshold: 2000
# thermodynamic
thermodynamicResponseTimeStep: 50
thermodynamicCountOfResponseTimeSteps: 40

配置sky walking 可视化界面

启动skywalking:

浏览器查看:

或者linux端:
ps –ef|grep collector 查看是否启动collector
ps –ef|grep web 查看是否启动web端
配置web界面:

server:
port: 8080
collector:
path: /graphql
ribbon:
ReadTimeout: 10000
listOfServers: 192.168.37.130:10800  #192.168.37.130需要同collector配置文件中一致

security:
user:
admin:
password: admin   # 默认登陆名及密码 user:admin pws:admin

访问web界面

配置java项目:

进入agent文件夹配置java项目

vi agent.config

agent.application_code=CollectorDBCluster  #同es配置文件中的cluster_name的值一致
collector.servers=192.168.37.130:10800  #同webapp.yml中配置一致

# Collector 接受追踪信息REST-Service 服务名称.
# 默认不需要修改
collector.service_name=/segments
# 向collector发送数据时,单次调用的最大容量
collector.batch_size=50
# 内部缓冲池大小,此值必须是2的指数倍。
buffer.size=512
# 日志文件名称前缀
logging.file_name=skywalking-agent.log
# 日志文件最大大小
# 如果超过此大小,则会生成新文件。
# 默认为300M
logging.max_file_size=314572800
# Logging level
logging.level=DEBUG

启动命令:java -javaagent:/usr/local/project/springboot-es/agent/skywalking-agent.jar -jar springboot_es_demo.jar

**:标红部分说明:这里的sky walking-agent.jar是拷贝出来的agent目录中的。

  • 点赞
  • 收藏
  • 分享
  • 文章举报
xian-boy 发布了1 篇原创文章 · 获赞 0 · 访问量 913 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: