k8s

skywalking安装及使用

2022-07-21  本文已影响0人  羋学僧

安装elasticsearch

解压:

tar -zxvf elasticsearch-7.10.1-linux-x86_64.tar.gz -C /usr/local/ 
目录结构

创建es用户:

useradd es
passwd es
chown -R es /usr/local/elasticsearch-7.10.1/

切换到root用户

cd /usr/local/elasticsearch-7.10.1

tar -zxvf jdk-11.0.15.1_linux-x64_bin.tar.gz
vim /etc/profile
#配置jdk11
export JAVA_HOME=/usr/local/elasticsearch-7.10.1/jdk-11.0.15.1
export PATH=$JAVA_HOME/bin:$PATH
 
#添加jdk判断
if [ -x "$JAVA_HOME/bin/java" ]; then
    JAVA="/usr/local/elasticsearch-7.10.1/jdk-11.0.15.1/bin/java"
else
    JAVA=`which java`
fi
source /etc/profile

使用es用户启动es

cd /usr/local/elasticsearch-7.10.1/bin/
./elasticsearch
访问9200端口

设置外网访问

vim /usr/local/elasticsearch-7.10.1/config/elasticsearch.yml
network.host: 0.0.0.0

安装skywalking

https://archive.apache.org/dist/skywalking/8.5.0/apache-skywalking-apm-es7-8.5.0.tar.gz
tar -zxvf apache-skywalking-apm-es7-8.5.0.tar.gz -C /usr/local/

vim /usr/local/apache-skywalking-apm-bin-es7/config/application.yml

搜索cluster:选择单机

cluster:
  selector: ${SW_CLUSTER:standalone}

搜索storage:

storage:
  selector: ${SW_STORAGE:elasticsearch7}

修改ui端口

vim /usr/local/apache-skywalking-apm-bin-es7/webapp/webapp.yml
server:
  port: 8097

启动服务

cd /usr/local/apache-skywalking-apm-bin-es7/bin/
sh startup.sh

启动java服务

java -javaagent:/usr/local/apache-skywalking-apm-bin-es7/agent_test/skywalking-agent.jar -Dserver.prot=8096 -jar gift-0.0.1-SNAPSHOT.jar

批量访问

http://192.168.117.160:8096/qzcsbj/gift/order/findByOrderNumber?order_number=110

定期删除日志:日志保留一周

skywalking的日志比较占用磁盘空间
crontab -e
0 0 * * 0 rm -f /usr/local/apache-skywalking-apm-bin-es7/logs/*
上一篇下一篇

猜你喜欢

热点阅读