目录
skywalking部署示意图
server安装
裸机安装
docker单节点安装
docker集群安装
k8s安装
helm安装(官方)
k8s yaml安装
动态配置安装
client agent安装
注意:本文档基于skywalking 8.8.1版本,对应服务端和agent端必须于该版本适配。skywalking不同版本间,尤其跨大版本,差异很大,请务必注意版本选择。
裸机安装方式,skywalking ui和oap server是合在一起的,不用分开安装。
详细安装请参考官方文档:
Downloads | Apache SkyWalking
docker oap server单机
docker run -p 11800:11800 -p 12800:12800 \
-e TZ=Asia/Shanghai \
--name oap --restart always -d apache/skywalking-oap-server:8.8.1
docker ui 单机
docker run -p 8080:8080 --name oap-ui \
-e TZ=Asia/Shanghai \
--restart always -d -e SW_OAP_ADDRESS=http://10.157.8.6:12800 apache/skywalking-ui:8.8.1
将10.157.8.6 替换为oap服务地址
启动完成,浏览器访问UI服务地址8080端口。
http://localhost:8080
oap server 安装
在oap集群机器节点分别执行以下指令
docker run -p 11800:11800 -p 12800:12800 \
-e TZ="Asia/Shanghai" \
-e SW_STORAGE=elasticsearch \
-e SW_STORAGE_ES_CLUSTER_NODES="10.157.8.6:9200,10.157.8.7:9200,10.157.8.8:9200" \
-e SW_STORAGE_ES_HTTP_PROTOCOL=http \
-e SW_ES_USER="" \
-e SW_ES_PASSWORD="" \
-e SW_CLUSTER=nacos \
-e SW_SERVICE_NAME=SkyWalking_OAP_Cluster \
-e SW_CLUSTER_NACOS_HOST_PORT="http://10.157.8.6:8848" \
-e SW_CLUSTER_NACOS_USERNAME=nacos \
-e SW_CLUSTER_NACOS_PASSWORD=nacos \
-e SW_CONFIGURATION=nacos \
-e SW_CONFIG_NACOS_SERVER_GROUP="skywalking" \
-e SW_CONFIG_NACOS_SERVER_ADDR="http://10.157.8.6" \
-e SW_CONFIG_NACOS_SERVER_PORT=8848 \
-e SW_CONFIG_NACOS_USERNAME=nacos \
-e SW_CONFIG_NACOS_PASSWORD=nacos \
-e SW_CORE_RECORD_DATA_TTL=365 \
-e SW_CORE_METRICS_DATA_TTL=365 \
--name oap --restart always -d apache/skywalking-oap-server:8.8.1
说明:
存储端基于elastic Search集群,SW_STORAGE=elasticsearch参数设置。
oap server集群基于nacos集群做分布式协调,SW_CLUSTER=nacos参数设置。
动态配置基于nacos集群管理,SW_CONFIGURATION=nacos参数设置。
SW_CORE_RECORD_DATA_TTL=365,表示trace日志失效时间,单位天。
SW_CORE_METRICS_DATA_TTL=365,表示metric统计日志失效时间,单位天。
ui 安装
docker run -p 8080:8080 --name oap-ui \
-e TZ=Asia/Shanghai \
--restart always -d -e SW_OAP_ADDRESS=http://10.157.8.6:12801 apache/skywalking-ui:8.8.1
SW_OAP_ADDRESS值替换为oap集群地址,多个oap节点,可通过前置Nginx代理作负载均衡转发
skywalking k8s安装可通过helm和纯yaml文件两种方式。
官方默认通过helm管理,k8s集群master节点需先安装helm工具。
# 安装helm
wget -c https://mirrors.huaweicloud.com/helm/v3.7.0/helm-v3.7.0-linux-amd64.tar.gz
tar -zxvf helm-v3.7.0-linux-amd64.tar.gz
cp linux-amd64/helm /usr/bin/
#验证helm是否安装成功
helm help
#添加helm chart仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
#列出索引chart仓库命令
helm repo list
k8s skywalking安装
skywalking ui和oap server 以k8s集群pod方式启动,elasticSearch和nacos均为外置服务集群
helm install "skywalking" skywalking/skywalking -n "default" \
--set oap.image.tag=8.8.1 \
--set oap.storageType=elasticsearch \
--set ui.image.tag=8.8.1 \
--set elasticsearch.enabled=false \
--set elasticsearch.config.host="10.157.8.6" \
--set elasticsearch.config.port.http=9201 \
--set elasticsearch.config.user="" \
--set elasticsearch.config.password="" \
--set oap.env.SW_CLUSTER=nacos \
--set oap.env.SW_SERVICE_NAME=SkyWalking_OAP_Cluster \
--set oap.env.SW_CLUSTER_NACOS_HOST_PORT="http://10.157.8.6:8848" \
--set oap.env.SW_CLUSTER_NACOS_USERNAME=nacos \
--set oap.env.SW_CLUSTER_NACOS_PASSWORD=nacos \
--set oap.env.SW_CONFIGURATION=nacos \
--set oap.env.SW_CONFIG_NACOS_SERVER_GROUP="skywalking" \
--set oap.env.SW_CONFIG_NACOS_SERVER_ADDR="http://10.157.8.6" \
--set oap.env.SW_CONFIG_NACOS_SERVER_PORT=8848 \
--set oap.env.SW_CONFIG_NACOS_USERNAME=nacos \
--set oap.env.SW_CONFIG_NACOS_PASSWORD=nacos \
--set oap.env.SW_CORE_RECORD_DATA_TTL=365 \
--set oap.env.SW_CORE_METRICS_DATA_TTL=365
说明:
helm卸载
helm uninstall skywalking
skywalking-cluster.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: skywalking
component: ui
release: skywalking
name: skywalking-ui
namespace: default
spec:
replicas: 2
revisionHistoryLimit: 10
selector:
matchLabels:
app: skywalking
component: ui
release: skywalking
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: skywalking
component: ui
release: skywalking
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app: skywalking
component: ui
release: skywalking
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- env:
- name: SW_OAP_ADDRESS
value: 'http://skywalking-oap:12800'
image: 'apache/skywalking-ui:8.8.1'
imagePullPolicy: IfNotPresent
name: ui
ports:
- containerPort: 8080
name: page
protocol: TCP
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
labels:
app: skywalking
component: ui
release: skywalking
name: skywalking-ui
namespace: default
spec:
type: ClusterIP
ports:
- name: rest
port: 80
protocol: TCP
targetPort: 8080
selector:
app: skywalking
component: ui
release: skywalking
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: skywalking
component: oap
release: skywalking
name: skywalking-oap
namespace: default
spec:
replicas: 2
revisionHistoryLimit: 10
selector:
matchLabels:
app: skywalking
component: oap
release: skywalking
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: skywalking
component: oap
release: skywalking
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app: skywalking
component: oap
release: skywalking
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- env:
- name: JAVA_OPTS
value: '-Xmx2g -Xms2g'
- name: SW_CLUSTER_K8S_NAMESPACE
value: default
- name: SW_STORAGE
value: elasticsearch
- name: SW_STORAGE_ES_CLUSTER_NODES
value: '10.157.4.100:9200,10.157.4.101:9200,10.157.4.102:9200'
- name: SW_ES_USER
value: ''
- name: SW_ES_PASSWORD
value: ''
- name: SW_CLUSTER
value: nacos
- name: SW_CLUSTER_NACOS_HOST_PORT
value: 'http://10.157.4.95:8848'
- name: SW_CLUSTER_NACOS_PASSWORD
value: nacos
- name: SW_CLUSTER_NACOS_USERNAME
value: nacos
- name: SW_CONFIGURATION
value: nacos
- name: SW_CONFIG_NACOS_SERVER_GROUP
value: skywalking
- name: SW_CONFIG_NACOS_SERVER_ADDR
value: 'http://10.157.4.95'
- name: SW_CONFIG_NACOS_SERVER_PORT
value: '8848'
- name: SW_CONFIG_NACOS_USERNAME
value: nacos
- name: SW_CONFIG_NACOS_PASSWORD
value: nacos
- name: SW_CORE_METRICS_DATA_TTL
value: '365'
- name: SW_CORE_RECORD_DATA_TTL
value: '365'
- name: SW_SERVICE_NAME
value: SkyWalking_OAP_Cluster
image: 'apache/skywalking-oap-server:8.8.1'
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 20
successThreshold: 1
tcpSocket:
port: 12800
timeoutSeconds: 1
name: oap
ports:
- containerPort: 11800
name: grpc
protocol: TCP
- containerPort: 12800
name: rest
protocol: TCP
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 20
successThreshold: 1
tcpSocket:
port: 12800
timeoutSeconds: 1
dnsPolicy: ClusterFirst
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
labels:
app: skywalking
component: oap
release: skywalking
name: skywalking-oap
namespace: default
spec:
selector:
app: skywalking
component: oap
release: skywalking
type: ClusterIP
ports:
- name: grpc
port: 11800
protocol: TCP
targetPort: 11800
- name: rest
port: 12800
protocol: TCP
targetPort: 12800
下载附件 skywalking-cluster.yml 到k8s master节点机器上
调整skywalking-cluster.yml文件中的部署环境变量值
kubectl启动skywalking集群
# k8s master节点启动 skywalking
kubectl apply -f skywalking-cluster.yml
# 查看pod运行情况
watch kubectl get pods -o wide
Skywalking配置参数信息除通过oap server程序包config目录下application.yml配置文件修改外,还提供了配置中心接入的方式。
框架提供了apollo/etcd/nacos等多种组件实现。接入配置中心的好处,配置信息修改,不重启oap server即可生效。
下面以nacos为例,接入告警配置到配置中心。
Oap server启动参数configuration.selector值修改为nacos
示例:以docker环境变量方式覆盖默认configuration.selector配置项以及configuration.nacos.*的参数值
启动oap server成功,打开nacos管理界面,新增配置
输入相关信息,保存
其中,data Id值对应skywalking 动态配置参数的config key,点击动态配置列表查看(注意:非所有skywalking配置项都支持动态配置,只有列表中列出的才支持)。
具体列表形如:
修改告警配置,对应dataId值为alarm.default.alarm-settings。Nacos的配置内容为skywalking中config目录下alarm-settings.yml文件信息。
Nacos保存成功,查看oap server端log,收到以下信息,表明配置生效。
注意:skywalking oap server使用最新稳定版本8.8.1,集成时请选择匹配版本,8.*和之前版本api不兼容。
官方支持语言平台兼容列表:
三方支持语言平台兼容列表:
支持pyhton/.net/PHP/Node.js/Go/ C++/ Lua agent in Nginx + LUA/ Lua agent in Kong等
详细参考官方文档
https://skywalking.apache.org/docs/main/v8.8.1/en/setup/service-agent/server-agents/