skywalking6.1.0安装(centos7.6)

先安装好jdk8(略),经测试高于jdk8不支持。

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.1.0/apache-skywalking-apm-6.1.0.tar.gz
tar zxvf /opt/downloads/apache-skywalking-apm-6.1.0.tar.gz -C /opt

以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会有问题

vim /opt/apache-skywalking-apm-bin/config/datasource-settings.properties
修改mysql的配置
在对应的mysql中添加数据库

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 /opt/apache-skywalking-apm-bin/agent/config/agent.config
agent.service_name是应用程序名
collector.backend_service是agent的地址,修改为0.0.0.0:11800

核对webapp
vim /opt/apache-skywalking-apm-bin/webapp/webapp.yml
server:
port为网站端口,默认的8080容易与其他软件冲突,建议改一下比如18080
server:
ip设置为0.0.0.0 (可选)
collector:ribbon:listOfServers设置为0.0.0.0:12800(可选)
用户名密码默认admin

保证18080,10800,11800,12800端口不被占用

启动前先初始化 /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 /lib/systemd/system/skywalking-oap.service

systemctl enable skywalking-oap.service
systemctl daemon-reload

运行
systemctl start skywalking-oap.service


安装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 /lib/systemd/system/skywalking-webapp.service

systemctl enable skywalking-webapp.service
systemctl daemon-reload

systemctl start skywalking-webapp.service

猜你喜欢

转载自www.cnblogs.com/wintersoft/p/10896169.html