1.準備安裝文件
# 下載安裝包
wget -c -P /tmp http://mirrors.hust.edu.cn/apache/incubator/skywalking/5.0.0-GA/apache-skywalking-apm-incubating-5.0.0-GA.tar.gz
# 解壓
mkdir /opt/skywalking;\
tar xf /tmp/apache-skywalking-apm-incubating-5.0.0-GA.tar.gz -C /opt/skywalking
# 拷貝到安裝位置
cd /opt/skywalking;\
mv apache-skywalking-apm-incubating 5.0.0;\
ln -s /opt/skywalking/5.0.0 /opt/skywalking/current
# 新建用戶
useradd -s /sbin/nologin skywalking;\
mkdir /home/skywalking/data
2.安裝Collector
2.1更改配置文件
# 備份配置文件
mv /opt/skywalking/current/config/application.yml /opt/skywalking/current/config/application.yml_bak
# 創建配置文件
tee /opt/skywalking/current/config/application.yml << 'EOF'
cluster:
zookeeper:
hostPort: 192.168.1.41:2181,192.168.1.42:2181,192.168.1.43:2181
sessionTimeout: 100000
naming:
jetty:
# 配置agent發現collector集羣
host: 192.168.1.41
port: 10800
contextPath: /
cache:
# guava:
caffeine:
remote:
gRPC:
# 配置collector節點在集羣中相互通信
host: 192.168.1.41
port: 11800
agent_gRPC:
gRPC:
# 配置agent上傳(鏈路跟蹤和指標)數據到collector
host: 192.168.1.41
port: 11800
# Set these two setting to open ssl
#sslCertChainFile: $path
#sslPrivateKeyFile: $path
# Set your own token to active auth
authentication: Password_1234
agent_jetty:
jetty:
# 配置agent上傳(鏈路跟蹤和指標)數據到collector
# SkyWalking native Java/.Net/node.js agents don't use this.
# Open this for other implementor.
host: 192.168.1.41
port: 12800
contextPath: /
analysis_register:
default:
analysis_jvm:
default:
analysis_segment_parser:
default:
bufferFilePath: ../buffer/
bufferOffsetMaxFileSize: 10M
bufferSegmentMaxFileSize: 500M
bufferFileCleanWhenRestart: true
ui:
jetty:
# 配置UI訪問collector
host: 192.168.1.41
port: 12800
contextPath: /
storage:
elasticsearch:
clusterName: es_log
clusterTransportSniffer: true
clusterNodes: 192.168.1.41:9300,192.168.1.42:9300,192.168.1.43:9300
indexShardsNumber: 2
indexReplicasNumber: 0
highPerformanceMode: true
# Batch process setting
bulkActions: 2000 # Execute the bulk every 2000 requests
bulkSize: 20 # flush the bulk every 20mb
flushInterval: 10 # flush the bulk every 10 seconds whatever the number of requests
concurrentRequests: 2 # the number of concurrent requests
# 設置統計指標數據的失效時間,當指標數據失效時系統將數據自動刪除
traceDataTTL: 90 # Unit is minute
minuteMetricDataTTL: 90 # Unit is minute
hourMetricDataTTL: 36 # Unit is hour
dayMetricDataTTL: 45 # Unit is day
monthMetricDataTTL: 18 # Unit is month
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
# max collection's size of worker cache collection, setting it smaller when collector OutOfMemory crashed.
workerCacheMaxSize: 10000
EOF
2.2創建服務
tee /etc/systemd/system/skywalking-collector.service << 'EOF'
[Unit]
Description=Skywalking Collector
After=network.target
[Service]
Environment="JAVA_HOME=/usr/java/default" "COLLECTOR_HOME=/opt/skywalking/current"
Type=forking
User=skywalking
Group=skywalking
LimitNOFILE=65535
ExecStart=/opt/skywalking/current/bin/collectorService.sh
Restart=on-failure
WorkingDirectory=/opt/skywalking/current
[Install]
WantedBy=multi-user.target
EOF
2.3啓動腳本刪除註釋行
因原有腳本行首有註釋導致systemd啓動報錯
sed -i -c -e '/^#/d' /opt/skywalking/current/bin/collectorService.sh;\
sed '1 i#!/usr/bin/env sh' -i /opt/skywalking/current/bin/collectorService.sh
2.4啓動服務
chown -R skywalking. /home/skywalking /opt/skywalking;\
systemctl daemon-reload;\
systemctl enable skywalking-collector;\
systemctl start skywalking-collector;\
systemctl status skywalking-collector
2.5配置防火牆
firewall-cmd --add-port=10800/tcp --permanent;\
firewall-cmd --add-port=11800/tcp --permanent;\
firewall-cmd --add-port=12800/tcp --permanent;\
firewall-cmd --reload
3.安裝UI
3.1更改配置
# 備份
mv /opt/skywalking/current/webapp/webapp.yml /opt/skywalking/current/webapp/webapp.yml_bak
# 創建配置文件
tee /opt/skywalking/current/webapp/webapp.yml << 'EOF'
server:
port: 8080
collector:
path: /graphql
ribbon:
ReadTimeout: 10000
listOfServers: 192.168.1.41:10800,192.168.1.42:10800,192.168.1.43:10800
security:
user:
admin:
password: Password_2018
EOF
3.2啓動腳本刪除註釋行
因原有腳本行首有註釋導致systemd啓動報錯
sed -i -c -e '/^#/d' /opt/skywalking/current/bin/webappService.sh;\
sed '1 i#!/usr/bin/env sh' -i /opt/skywalking/current/bin/webappService.sh
3.3創建服務
tee /etc/systemd/system/skywalking-ui.service << 'EOF'
[Unit]
Description=Skywalking UI
After=network.target
[Service]
Environment="JAVA_HOME=/usr/java/default"
Type=forking
User=skywalking
Group=skywalking
LimitNOFILE=65535
ExecStart=/opt/skywalking/current/bin/webappService.sh
Restart=on-failure
WorkingDirectory=/opt/skywalking/current
[Install]
WantedBy=multi-user.target
EOF
3.5啓動服務
chown -R skywalking. /home/skywalking /opt/skywalking;\
systemctl daemon-reload;\
systemctl enable skywalking-ui;\
systemctl start skywalking-ui;\
systemctl status skywalking-ui
3.6配置防火牆
firewall-cmd --add-port=8080/tcp --permanent;\
firewall-cmd --reload