分布式skywalking安装部署总结

1、服务器配置

  1. 服务器规划
    在这里插入图片描述

2 skywalking服务端安装

2.1 zookeeper安装

2.1.1 jdk安装

	在服务器上安装jdk1.8,由于系统模板已经集成jdk 1.8.0_221,这里不在单独安装

2.1.2 获取zookeeper安装程序

将安装程序分别上传到zookeeper服务器的/workspaces目录下

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz

2.1.3 解压zookeeper应用到/root目录下

tar zxvf  apache-zookeeper-3.5.5-bin.tar.gz  -C /root

2.1.4 配置zookeeper

修改如下:

tickTime=2000
dataLogDir=/var/zookeeper/logs
dataDir=/var/zookeeper/data
clientPort=2181
initLimit=10
syncLimit=5
autopurge.snapRetainCount=500
autopurge.purgeInterval=24
server.1=zk服务1ip:2888:3888
server.2= zk服务2ip:2888:3888
server.3= zk服务3ip:2888:3888
 cd /root/apache-zookeeper-3.5.5-bin/conf
 cp zoo_sample.cfg zoo.cfg
 vim zoo.cfg

配置详细说明请参考:

https://www.cnblogs.com/guohu/p/10766465.html

配置集群信息是存在一定的格式:service.N =YYY: A:B
N:代表服务器编号(也就是myid里面的值)
YYY:服务器地址
A:表示 Flower 跟 Leader的通信端口,简称服务端内部通信的端口(默认2888)
B:表示 是选举端口(默认是3888)

参考文档:

https://blog.csdn.net/milhua/article/details/78931672

2.1.5 生成数据文件目录和myid文件

在每个zookeeper节点上创建zookeeper的数据目录,并且在数据目录下创建myid文件,文件中存放当前节点的server-id,
下面命令中server-id,根据节点信息调整

 mkdir -p /var/zookeeper/data && echo “1”> /var/zookeeper/data/myid

2.1.6 启动zookeeper

进入到/root/apache-zookeeper-3.5.5-bin/bin/下启动 zookeeper

cd  /root/apache-zookeeper-3.5.5-bin/bin
./zkServer.sh start

2.1.7 测试

 cd  /root/apache-zookeeper-3.5.5-bin/bin
 ./zkCli.sh -server 集群机器1IP地址:2181,集群机器2IP地址:2181,集群机器3IP地址:2181
 ./zkServer.sh status

2.2 elasticsraech安装

2.2.1 jdk安装

在服务器上安装jdk1.8,由于系统模板已经集成jdk 1.8.0_221,这里不在单独安装

2.2.2 获取elasticsearch 安装程序

将安装程序上传到elasticsearch服务器的/workspaces目录下

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-x86_64.rpm

2.2.3 安装elasticsearch

Yum install -y elasticsearch-7.5.1-x86_64.rpm

2.2.4 配置elasticsearch集群

只需要根据实际情况修改node.name 即可

cluster.name: skywalking
node.name: P-MAINTENANCE-SKY-ZK-ES-229
node.master: true
node.data: true 
path.data: /var/elasticsearch/data
path.logs: /var/elasticsearch/logs
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["es服务器ip1", " es服务器ip2", " es服务器ip3"]
cluster.initial_master_nodes: ["P-MAINTENANCE-SKY-ZK-ES-229", "P-MAINTENANCE-SKY-ZK-ES-230", "P-MAINTENANCE-SKY-ZK-ES-231"]
discovery.zen.minimum_master_nodes: 2
 cd /etc/elasticsearch/
 vim elasticsearch.yml

es详细配置参数说明(https://blog.csdn.net/yjclsx/article/details/81319454
https://my.oschina.net/Yumikio/blog/805877)

2.2.5 配置jvm信息

注意:初始化和最大必须一样否则无法启动
cd /etc/elasticsearch/
 vim jvm.options
-Xms4g 
-Xmx4g
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-Djava.io.tmpdir=${ES_TMPDIR}
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/var/elasticsearch
-XX:ErrorFile=/var/elasticsearch/logs/hs_err_pid%p.log
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/elasticsearch/logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

具体说明:https://www.cnblogs.com/hapjin/archive/2019/07/12/11135187.html

2.2.6 创建相关目录

创建elasticsearch的数据目录和日志目录并设置权限

 mkdir -p  /var/elasticsearch/data
 mkdir -p  /var/elasticsearch/logs
 chowm -R elasticsearch: elasticsearch /var/elasticsearch

2.2.7 启动服务

 systemctl start elasticsearch

2.2.8 验证服务

curl 主节点ip:9200/_cluster/stats?pretty
 curl 主节点ip:9200/_nodes/process?pretty

2.3 skywalkingcollector安装

2.3.1 jdk安装

在服务器上安装jdk1.8,由于系统模板已经集成jdk 1.8.0_221,这里不在单独安装

2.3.2 获取安装文件

将安装程序上传到collector服务器的/workspaces目录下

wget http://mirrors.tuna.tsinghua.edu.cn/apache/skywalking/6.6.0/apache-skywalking-apm-es7-6.6.0.tar.gz

2.3.3 解压collector到/root目录

tar zxvf apache-skywalking-apm-es7-6.6.0.tar.gz -C /root

2.3.4 配置collector连接zookeeper

cluster下注释掉standalone,打开zookeeper相关,并配置zookeeper集群地址

	cluster:
	  zookeeper:
	    nameSpace: ${SW_NAMESPACE:""}
	    hostPort: ${SW_CLUSTER_ZK_HOST_PORT:zk服务器IP地址1:2181,zk服务器IP地址2:2181,zk服务器IP地址3:2181}
	    # Retry Policy
	    baseSleepTimeMs: 1000 # initial amount of time to wait between retries
	    maxRetries: 3 # max number of times to retry
	    # Enable ACL
	    enableACL: ${SW_ZK_ENABLE_ACL:false} # disable ACL in default
	    schema: ${SW_ZK_SCHEMA:digest} # only support digest schema
	    expression: ${SW_ZK_EXPRESSION:skywalking:skywalking}
cd  /root/apache-skywalking-apm-bin-es7/conf
 vim application.yml

2.3.5 配置collector连接elasticsearch

storage下注释掉h2相关,打开elasticsearch相关

storage:
  elasticsearch7:
    # nameSpace: ${SW_NAMESPACE:""}
    # user: ${SW_ES_USER:""} # User needs to be set when Http Basic authentication is enabled
    # password: ${SW_ES_PASSWORD:""} # Password to be set when Http Basic authentication is enabled
    #trustStorePath: ${SW_SW_STORAGE_ES_SSL_JKS_PATH:""}
    #trustStorePass: ${SW_SW_STORAGE_ES_SSL_JKS_PASS:""}
    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:es服务器地址1:9200, es服务器地址2:9200, es服务器地址3:9200}
    protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"http"}
    indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2}
    indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0}
    # Those data TTL settings will override the same settings in core module.
    recordDataTTL: ${SW_STORAGE_ES_RECORD_DATA_TTL:7} # Unit is day
    otherMetricsDataTTL: ${SW_STORAGE_ES_OTHER_METRIC_DATA_TTL:45} # Unit is day
    monthMetricsDataTTL: ${SW_STORAGE_ES_MONTH_METRIC_DATA_TTL:18} # Unit is month
    # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html
    bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:2000} # Execute the bulk every 2000 requests
    bulkSize: ${SW_STORAGE_ES_BULK_SIZE:20} # flush the bulk every 20mb
    flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests
    concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests
    resultWindowMaxSize: ${SW_STORAGE_ES_QUERY_MAX_WINDOW_SIZE:10000}
    metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000}
    segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200}
    advanced: ${SW_STORAGE_ES_ADVANCED:""}
cd  /root/apache-skywalking-apm-bin-es7/conf
 vim application.yml

2.3.6修改collector启动脚本

修改初始化内存2G, 最大可用6G

vim oapService.sh
   JAVA_OPTS=”-Xms2G -Xmx6G”

注释掉webapp的启动

 vim startup.sh
  #!/usr/bin/env sh
  PRG=$0”
  PRGDIR=’dirname “$PRG”’
  OAP_EXE=oapService.sh
  #WEBAPP_EXE=webappService.sh$PRGDIR/$OAP_EXE#“$ PRGDIR/$ WEBAPP_EXE”

2.3.7 启动colletcot

cd  /root/apache-skywalking-apm-bin-es7/bin
 ./ startup.sh

2.3.8 验证

 tail -f /root/apache-skywalking-apm-bin-es7/logs/skywalking-oap-server.log

2.4 skywalking ui部署

2.4.1 jdk安装

在服务器上安装jdk1.8,由于系统模板已经集成jdk 1.8.0_221,这里不在单独安装

2.4.2 获取安装文件

将安装程序上传到UI服务器的/workspaces目录下

wget http://mirrors.tuna.tsinghua.edu.cn/apache/skywalking/6.6.0/apache-skywalking-apm-es7-6.6.0.tar.gz

2.4.3 解压UI到/root目录

 tar zxvf apache-skywalking-apm-es7-6.6.0.tar.gz -C /root

2.4.4 配置ui

 cd /root/apache-skywalking-apm-bin-es7/webapp
 vim webapp.yml
   listOfServers: collector服务器地址1:12800,collector服务器地址2:12800,collector服务器地址3:12800

2.4.5 修改UI启动脚本

注释掉oap服务的启动

cd  /root/apache-skywalking-apm-bin-es7/bin
vim startup.sh

文件如下:

#!/usr/bin/env sh
  PRG=”$0”
  PRGDIR=’dirname “$PRG”’
  #OAP_EXE=oapService.sh
  WEBAPP_EXE=webappService.sh
  #“$PRGDIR/$OAP_EXE”
 “$ PRGDIR/$ WEBAPP_EXE”

2.4.6 启动UI

cd  /root/apache-skywalking-apm-bin-es7/bin
 ./ startup.sh

2.4.7 验证

 tail -f /root/apache-skywalking-apm-bin-es7/logs/webapp.log

3 agent安装

3.1 获取程序

拷贝/root/apache-skywalking-apm-bin-es7/agent 文件夹到目标服务器上/root/agent

3.2 如果为oracle数据库需要上传oracle插件

将自己编译的apm-oracle-10.x-plugin-1.0.1.jar包放入agent程序的plugins目录下
链接:https://pan.baidu.com/s/1f1j7-PXiXUGtrKeBZZFhWQ
提取码:ot6p

3.3 修改配置

修改配置文件中注册到后台的服务名和后台的地址端口,
服务根据实际情况进行修改,格式环境-服务名,例如
Pro-portal
Uat-portal
其他项暂时保持默认不变

vi /root/agent/config/agent.config
  agent.service_name=${SW_AGENT_NAME:Uat-portal}
  collect,or.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:1 collector服务器ip地址:11800, collector服务器ip地址:11800, collector服务器ip地址:11800}

3.3 修改tomcat启动脚本

修改tomcat的bin/catalina.sh,在第一行加入

CATALINA_OPTS="$CATALINA_OPTS -javaagent:/root/agent/skywalking-agent.jar"; export CATALINA_OPTS

3.4 重启tomcat

重启tomcat加载agent。

备注:skywalking具体配置说明参考官网:https://github.com/apache/skywalking/blob/5.x/docs/README_ZH.md 或者https://github.com/apache/skywalking/blob/6.x/README.md
参数配置可以参考博客:https://smooth.blog.csdn.net/article/details/96479544

发布了15 篇原创文章 · 获赞 11 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览