SkyWalking 安装部署

系统设置

1
iptables -P FORWARD ACCEPT
1
2
3
swapoff -a
# 防止开机自动挂载 swap 分区
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
1
2
3
4
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

1
2
3
4
5
6
7
8
9
10
11
12
13
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

1
2
3
4
5
6
7
# 下载安装包
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

启动相关容器

创建配置文件目录

1
2
3
4
5
6
7
8
9
mkdir -p /data/skywalking
cd /data/skywalking

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

编写 yml 文件

vi docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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

启动容器

1
2
3
4
5
6
7
8
# 拉去镜像并启动
docker-compose up -d
# 查看日志
docker-compose logs -f

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

访问 ip:8088

数据不持久化启动

1
./bin/startup.sh

下载 agent 代理包

1
2
3
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

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

开启日志收集

待更新