操作系统:CentOS7.4
elasticsearch:用来存储数据
skywalking-oap-server:Skywalking服务器
skywalking-ui :Skywalking的UI界面
docker pull elasticsearch:7.9.0
docker pull apache/skywalking-oap-server:8.9.1
docker pull apache/skywalking-ui:8.9.1
docker images
mkdir -p /data/elasticsearch7/data
mkdir -p /data/elasticsearch7/logs
docker run -itd \
--name=es7 \
--restart=always \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-v /data/elasticsearch7/data:/usr/share/elasticsearch/data \
-v /data/elasticsearch7/logs:/usr/share/elasticsearch/logs \
elasticsearch:7.9.0
浏览器访问:http://192.168.3.176:9200/,返回:
{
name: "ac1504b16770",
cluster_name: "docker-cluster",
cluster_uuid: "k06cLZkBSjiO6aYVKBtfYQ",
version: {
number: "7.9.0",
build_flavor: "default",
build_type: "docker",
build_hash: "a479a2a7fce0389512d6a9361301708b92dff667",
build_date: "2020-08-11T21:36:48.204330Z",
build_snapshot: false,
lucene_version: "8.6.0",
minimum_wire_compatibility_version: "6.8.0",
minimum_index_compatibility_version: "6.0.0-beta1"
},
tagline: "You Know, for Search"
}
注意:需要先安装好es才能安装oap
docker run -itd \
--name skywalking-oap \
--restart=always \
-e TZ=Asia/Shanghai \
-p 12800:12800 \
-p 11800:11800 \
--link es7:es7 \
-e SW_STORAGE=elasticsearch \
-e SW_STORAGE_ES_CLUSTER_NODES=es7:9200 \
apache/skywalking-oap-server:8.9.1
-e TZ=Asia/Shanghai
:指定时区。
--link es7:es7
:关联es7容器,通过容器名字来解决ip会发生变更的问题。
-e SW_STORAGE=elasticsearch
:设置环境变量,指定存储方式。
-e SW_STORAGE_ES_CLUSTER_NODES=es7:9200
:设置环境变量,指定ES的地址
访问UI:http://192.168.3.176:8080/
官网有示例 docker-compose.yml
文件,我们只需要下载下来修改下即可。
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
#
http://www.apache.org/licenses/LICENSE-2.0
#
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
#
http://www.apache.org/licenses/LICENSE-2.0
#
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
version: '3.8'
services:
elasticsearch:
image: elasticsearch:7.9.0
container_name: es7
restart: always
ports:
- "9200:9200"
- "9300:9300"
healthcheck:
test: [ "CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
environment:
- discovery.type=single-node
# 锁定物理内存地址,防止elasticsearch内存被交换出去,也就是避免es使用swap交换分区,频繁的交换,会导致IOPS变高;
- bootstrap.memory_lock=true
# 设置时区
- TZ=Asia/Shanghai
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
oap:
image: apache/skywalking-oap-server:8.9.1
container_name: skywalking-oap
restart: always
# 设置依赖的容器
depends_on:
elasticsearch:
condition: service_healthy
# 关联ES的容器,通过容器名字来找到相应容器,解决IP变动问题
links:
- es7
# 端口映射
ports:
- "11800:11800"
- "12800:12800"
# 监控检查
healthcheck:
test: [ "CMD-SHELL", "/skywalking/bin/swctl ch" ]
# 每间隔30秒执行一次
interval: 30s
# 健康检查命令运行超时时间,如果超过这个时间,本次健康检查就被视为失败;
timeout: 10s
# 当连续失败指定次数后,则将容器状态视为 unhealthy,默认 3 次。
retries: 3
# 应用的启动的初始化时间,在启动过程中的健康检查失效不会计入,默认 0 秒。
start_period: 10s
environment:
# 指定存储方式
SW_STORAGE: elasticsearch
# 指定存储的地址
SW_STORAGE_ES_CLUSTER_NODES: es7:9200
SW_HEALTH_CHECKER: default
SW_TELEMETRY: prometheus
TZ: Asia/Shanghai
# JAVA_OPTS: "-Xms2048m -Xmx2048m"
ui:
image: apache/skywalking-ui:8.9.1
container_name: skywalking-ui
restart: always
depends_on:
oap:
condition: service_healthy
links:
- skywalking-oap
ports:
- "8080:8080"
environment:
SW_OAP_ADDRESS: http://skywalking-oap:12800
TZ: Asia/Shanghai
切换到 docker-compose.yml
文件所在的目录下,然后执行一下命令:
java -javaagent:/data/skywalking-agent/agent/skywalking-agent.jar
-Dskywalking.agent.service_name=my-app-service
-Dskywalking.collector.backend_service=192.168.3.176:11800
-jar my-app-service.jar &
Original: https://www.cnblogs.com/joshua317/p/16473393.html
Author: joshua317
Title: CentOS7.4系统下docker安装SkyWalking
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/534523/
转载文章受原作者版权保护。转载请注明原作者出处!