Centos 7搭建Skywalking

作者: tianwen01 | 来源:发表于2019-01-07 13:12 被阅读3次

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

相关文章

网友评论

    本文标题:Centos 7搭建Skywalking

    本文链接:https://www.haomeiwen.com/subject/vhhurqtx.html