跳到主要内容

SkyWalking 安装部署

· 阅读需 3 分钟

SkyWalking 安装部署

系统设置

  • 设置 iptables
iptables -P FORWARD ACCEPT
  • 关闭swap
swapoff -a
# 防止开机自动挂载 swap 分区
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
  • 设置yum源
curl -o /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum clean all && yum makecache

安装 Docker

yum install docker-ce-cli-19.03.9-3.el7  docker-ce-19.03.9-3.el7 -y

# 配置docker加速
mkdir -p /etc/docker
vi /etc/docker/daemon.json

{
"registry-mirrors": ["镜像加速地址, 改自己的~"]

}

# 启动docker
systemctl enable docker && systemctl start docker

安装 Docker-compose

# 下载安装包
wget https://github.com/docker/compose/releases/download/1.28.6/docker-compose-Linux-x86_64

chmod +x docker-compose-Linux-x86_64
mv docker-compose-Linux-x86_64 /usr/local/sbin/docker-compose

docker-compose version

启动相关容器

  • elasticsearch 作为 skywalking 的存储,保存链路和日志数据等

  • oap 数据接收和分析 Observability Analysis Platform

  • ui web端的数据展示

创建配置文件目录

mkdir -p /data/skywalking
cd /data/skywalking

vi docker-compose.yml
# 拉去镜像并启动
docker-compose up -d
# 查看日志
docker-compose logs -f

编写 yml 文件

vi docker-compose.yml

version: '3.8'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.1
container_name: elasticsearch
restart: always
ports:
- 9200:9200
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- TZ=Asia/Shanghai
ulimits:
memlock:
soft: -1
hard: -1
oap:
image: apache/skywalking-oap-server:8.7.0-es7
container_name: oap
depends_on:
- elasticsearch
links:
- elasticsearch
restart: always
ports:
- 11800:11800
- 12800:12800
healthcheck:
test: ["CMD-SHELL", "/skywalking/bin/swctl"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
environment:
TZ: Asia/Shanghai
SW_STORAGE: elasticsearch7
SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
ui:
image: apache/skywalking-ui:8.7.0
container_name: ui
depends_on:
- oap
links:
- oap
restart: always
ports:
- 8088:8080
environment:
TZ: Asia/Shanghai
SW_OAP_ADDRESS: http://oap:12800

启动容器

# 拉去镜像并启动
docker-compose up -d
# 查看日志
docker-compose logs -f

# docker 全部开启和全部关闭
docker start `docker ps -qa`
docker stop `docker ps -qa`

访问 ip:8088

数据不持久化启动

 ./bin/startup.sh

下载 agent 代理包

wget https://archive.apache.org/dist/skywalking/8.7.0/apache-skywalking-apm-es7-8.7.0.tar.gz

tar xf apache-skywalking-apm-es7-8.7.0.tar.gz

启动 agent

java -javaagent:上一步解压目录/agent/skywalking-agent.jar=agent.service_name=自定义服务名,collector.backend_service=服务器IP:11800 -jar xx.jar

开启日志收集

待更新