先安装好jdk8(略),经测试高于jdk8不支持。java
http://skywalking.apache.org/downloads/
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" -P /opt/downloads http://mirrors.tuna.tsinghua.edu.cn/apache/skywalking/6.3.0/apache-skywalking-apm-6.3.0.tar.gzmysql
tar zxvf /opt/downloads/apache-skywalking-apm-6.3.0.tar.gz -C /optweb
以es做为存储的状况,资料网上不少了,本例以mysql做为储存
vim /opt/apache-skywalking-apm-bin/config/application.yml
注释掉storage:h2 解锁mysql
找个mysql-connector-java-5.1.47.jar放入apache-skywalking-apm-bin/oap-libs
经测试mysql/j版本是6.x.x或8.x.x会有问题sql
vim /opt/apache-skywalking-apm-bin/config/datasource-settings.properties
修改mysql的配置
在对应的mysql中添加数据库数据库
加入dataSource.useSSL=false (可选)apache
agent
使用javaagent无侵入式的配合collector实现对分布式系统的追踪和相关数据的上下文传递。
配置说明
agent.namespace: 跨进程链路中的header,不一样的namespace会致使跨进程的链路中断
agent.service_name:一个服务(项目)的惟一标识,这个字段决定了在sw的UI上的关于service的展现名称
agent.sample_n_per_3_secs: 客户端采样率,默认是-1表明全采样
agent.authentication: 与collector进行通讯的安全认证,须要同collector中配置相同
agent.ignore_suffix: 忽略特定请求后缀的trace
collecttor.backend_service: agent须要同collector进行数据传输的IP和端口
logging.level: agent记录日志级别vim
修改配置
vim /opt/apache-skywalking-apm-bin/agent/config/agent.config
agent.service_name是应用程序名
collector.backend_service是agent的地址安全
核对webapp
vim /opt/apache-skywalking-apm-bin/webapp/webapp.yml
server:
port为网站端口,默认的8080容易与其余软件冲突,建议改一下好比18080
server:
ip设置为0.0.0.0 (可选)
collector:ribbon:listOfServers设置为127.0.0.1:12800(多个以逗号隔开)
用户名密码默认admincookie
保证18080,11800,12800端口不被占用oracle
启动前先初始化 /opt/apache-skywalking-apm-bin/bin/oapServiceInit.sh
看见 SkyWalking OAP started successfully! 执行成功,mysql数据库中将表被添加。
安装oap守护进程
vim /lib/systemd/system/skywalking-oap.service
[Unit] Description=skywalking-oap After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/opt/apache-skywalking-apm-bin/bin/oapService.sh Restart=always PrivateTmp=true [Install] WantedBy=multi-user.target
官方提供的sh脚本#!/usr/bin/env sh不在顶部会形成systemd启动报错
把#!/usr/bin/env sh提至顶部
sed -i -c -e '/^#!\/usr\/bin\/env sh/d' /opt/apache-skywalking-apm-bin/bin/oapService.sh
sed '1 i\ ' -i /opt/apache-skywalking-apm-bin/bin/oapService.sh
sed '1 i#!/usr/bin/env sh' -i /opt/apache-skywalking-apm-bin/bin/oapService.sh
权限
chmod 777 /opt/apache-skywalking-apm-bin/bin/oapService.sh
chmod 777 /lib/systemd/system/skywalking-oap.service
systemctl enable skywalking-oap.service
systemctl daemon-reload
运行
systemctl start skywalking-oap.service
查看进程
netstat -anltp|grep 11800
netstat -anltp|grep 12800
安装webapp守护进程
vim /lib/systemd/system/skywalking-webapp.service
[Unit] Description=skywalking-webapp After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/opt/apache-skywalking-apm-bin/bin/webappService.sh Restart=always PrivateTmp=true [Install] WantedBy=multi-user.target
官方提供的sh脚本#!/usr/bin/env sh不在顶部会形成systemd启动报错
把#!/usr/bin/env sh提至顶部
sed -i -c -e '/^#!\/usr\/bin\/env sh/d' /opt/apache-skywalking-apm-bin/bin/webappService.sh
sed '1 i\ ' -i /opt/apache-skywalking-apm-bin/bin/webappService.sh
sed '1 i#!/usr/bin/env sh' -i /opt/apache-skywalking-apm-bin/bin/webappService.sh
权限
chmod 777 /opt/apache-skywalking-apm-bin/bin/webappService.sh
chmod 777 /lib/systemd/system/skywalking-webapp.service
systemctl enable skywalking-webapp.service
systemctl daemon-reload
systemctl start skywalking-webapp.service
查看日志
tail -f /var/log/messages
列出当前系统服务的状态
systemctl list-units