https://github.com/apache/skywalking-docker/tree/master/6/6.5
https://hub.docker.com/r/apache/skywalking-oap-server
https://hub.docker.com/r/apache/skywalking-ui
mkdir /opt/skywalking-oap-server
wget -P /opt/skywalking-oap-server https://github.com/apache/skywalking-docker/blob/master/6/6.5/oap/docker-entrypoint.sh
wget -P /opt/skywalking-oap-server https://github.com/apache/skywalking-docker/blob/master/6/6.5/oap/log4j2.xml
vim /opt/skywalking-oap-server/Dockerfile
FROM apache/skywalking-oap-server:6.5.0
EXPOSE 12800 11800 1234
vim /opt/skywalking-oap-server/docker-compose.yml
es:
非docker版 目前已经支持es7.x,需配置成
storage:
elasticsearch7:
以下是es6
version: '3.3'
services:
oap:
image: v-skywalking-oap-server
container_name: skywalking-oap-server
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 11800:11800
- 12800:12800
- 1234:1234
environment:
SW_STORAGE: elasticsearch
SW_STORAGE_ES_CLUSTER_NODES: 192.168.1.101:9200
mysql:
version: '3.3'
services:
oap:
image: v-skywalking-oap-server
container_name: skywalking-oap-server
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 11800:11800
- 12800:12800
- 1234:1234
environment:
SW_STORAGE: mysql
SW_JDBC_URL: "jdbc:mysql://192.168.0.101:3306/skywalking?useSSL=false"
SW_DATA_SOURCE_USER: root
SW_DATA_SOURCE_PASSWORD: root
SW_DATA_SOURCE_CACHE_PREP_STMTS: "true"
SW_DATA_SOURCE_PREP_STMT_CACHE_SQL_SIZE: 250
SW_DATA_SOURCE_PREP_STMT_CACHE_SQL_LIMIT: 2048
SW_DATA_SOURCE_USE_SERVER_PREP_STMTS: "true"
SW_STORAGE_MYSQL_QUERY_MAX_SIZE: 5000
volumes:
- ./oap-libs/mysql-connector-java-5.1.47.jar:/skywalking/oap-libs/mysql-connector-java-5.1.47.jar
若以nacos作为集群模式
nacos的docker-compose配置
https://github.com/apache/skywalking-docker/blob/master/6/6.5/oap/docker-entrypoint.sh
generateClusterNacos() {
cat <<EOT >> ${var_application_file}
cluster:
nacos:
serviceName: \${SW_SERVICE_NAME:"SkyWalking_OAP_Cluster"}
hostPort: \${SW_CLUSTER_NACOS_HOST_PORT:nacos:8848}
namespace: \${SW_CLUSTER_NACOS_NAMESPACE:nacos:"public"}
EOT
}
SW_CLUSTER: nacos
默认standalone
version: '3.3'
services:
oap:
image: v-skywalking-oap-server
container_name: skywalking-oap-server
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 11800:11800
- 12800:12800
- 1234:1234
environment:
SW_CORE_GRPC_HOST: 0.0.0.0
SW_CORE_GRPC_PORT: 11800
SW_CORE_REST_HOST: 0.0.0.0
SW_CORE_REST_PORT: 12800
SW_STORAGE: mysql
SW_JDBC_URL: "jdbc:mysql://mysqlserver:3306/skywalking?useSSL=false"
SW_DATA_SOURCE_USER: root
SW_DATA_SOURCE_PASSWORD: root
SW_DATA_SOURCE_CACHE_PREP_STMTS: "true"
SW_DATA_SOURCE_PREP_STMT_CACHE_SQL_SIZE: 250
SW_DATA_SOURCE_PREP_STMT_CACHE_SQL_LIMIT: 2048
SW_DATA_SOURCE_USE_SERVER_PREP_STMTS: "true"
SW_STORAGE_MYSQL_QUERY_MAX_SIZE: 5000
SW_CLUSTER: nacos
SW_SERVICE_NAME: SkyWalking_OAP_Cluster
SW_CLUSTER_NACOS_HOST_PORT: nacosserver:8848
SW_CLUSTER_NACOS_NAMESPACE: public
SW_CORE_ENABLE_DATA_KEEPER_EXECUTOR: "true"
SW_CORE_DATA_KEEPER_EXECUTE_PERIOD: 5
SW_CORE_RECORD_DATA_TTL: 90
SW_CORE_MINUTE_METRIC_DATA_TTL: 90
SW_CORE_HOUR_METRIC_DATA_TTL: 36
SW_CORE_DAY_METRIC_DATA_TTL: 45
SW_CORE_MONTH_METRIC_DATA_TTL: 18
SW_CORE_ENABLE_DATABASE_SESSION: "true"
volumes:
- ./oap-libs/mysql-connector-java-5.1.47.jar:/skywalking/oap-libs/mysql-connector-java-5.1.47.jar
extra_hosts:
- "mysqlserver:192.168.0.101"
- "nacosserver:192.168.0.101"
下载mysql-connector-java-5.1.47.jar
wget -P /opt/downloads https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz
mkdir /opt/skywalking-oap-server/oap-libs
tar zxvf /opt/downloads/mysql-connector-java-5.1.47.tar.gz -C /opt/skywalking-oap-server/oap-libs
cp /opt/skywalking-oap-server/oap-libs/mysql-connector-java-5.1.47/mysql-connector-java-5.1.47.jar /opt/skywalking-oap-server/oap-libs/
rm -rf /opt/skywalking-oap-server/oap-libs/mysql-connector-java-5.1.47
在Mysql创建skywalking库
初始化mysql脚本
mkdir /opt/skywalking-oap-server/bin/
vim /opt/skywalking-oap-server/bin/oapServiceInit.sh
#!/usr/bin/env sh
PRG="$0"
PRGDIR=`dirname "$PRG"`
[ -z "$OAP_HOME" ] && OAP_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`
OAP_LOG_DIR="${OAP_HOME}/logs"
JAVA_OPTS=" -Xms256M -Xmx512M"
if [ ! -d "${OAP_HOME}/logs" ]; then
mkdir -p "${OAP_LOG_DIR}"
fi
_RUNJAVA=${JAVA_HOME}/bin/java
[ -z "$JAVA_HOME" ] && _RUNJAVA=java
CLASSPATH="$OAP_HOME/config:$CLASSPATH"
for i in "$OAP_HOME"/oap-libs/*.jar
do
CLASSPATH="$i:$CLASSPATH"
done
OAP_OPTIONS=" -Doap.logDir=${OAP_LOG_DIR}"
eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} ${OAP_OPTIONS} -classpath $CLASSPATH -Dmode=init org.apache.skywalking.oap.server.starter.OAPServerStartUp \
2>${OAP_LOG_DIR}/oap.log 1> /dev/null &"
if [ $? -eq 0 ]; then
sleep 1
echo "SkyWalking OAP started successfully!"
else
echo "SkyWalking OAP started failure!"
exit 1
fi
存储参考:https://github.com/apache/skywalking/blob/master/docs/en/setup/backend/backend-storage.md
cd /opt/skywalking-oap-server
docker-compose build
docker-compose up -d --force-recreate
docker-compose down
docker-compose restart
查看日志
docker logs --tail="500" skywalking-oap-server
必须在容器启动后进入容器后执行初始化脚本:
docker exec -it skywalking-oap-server /bin/bash
chmod 777 /skywalking/bin/oapServiceInit.sh
/skywalking/bin/oapServiceInit.sh
复制出配置
docker cp skywalking-oap-server:/skywalking/config/application.yml /opt/skywalking-oap-server/application_bak.yml
--------------------------------------------------------------------
mkdir /opt/skywalking-ui
wget -P /opt/skywalking-ui https://github.com/apache/skywalking-docker/blob/master/6/6.3/ui/docker-entrypoint.sh
wget -P /opt/skywalking-ui https://github.com/apache/skywalking-docker/blob/master/6/6.3/ui/logback.xml
vim /opt/skywalking-ui/Dockerfile
FROM apache/skywalking-ui:6.5.0
EXPOSE 8080
vim /opt/skywalking-ui/docker-compose.yml
version: '3.3'
services:
oap:
image: v-skywalking-ui
restart: always
container_name: skywalking-ui
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 11880:8080
environment:
SW_OAP_ADDRESS: skywalkingoapserver:12800
extra_hosts:
- "skywalkingoapserver:192.168.0.101"
SW_OAP_ADDRESS可以是oap集群的多个地址
ui的路径为/skywalking/webapp/webapp.yml
cd /opt/skywalking-ui
docker-compose build
docker-compose up -d --force-recreate
docker-compose down
docker-compose restart
查看日志
docker logs --tail="500" skywalking-ui
进入容器
docker exec -it skywalking-ui /bin/bash
复制出配置
docker cp skywalking-ui:/skywalking/webapp/webapp.yml /opt/skywalking-ui/webapp_bak.yml
需要agent时安装包下载地址:http://skywalking.apache.org/downloads/
agent集群配置
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:192.168.0.101:11800,192.168.0.102:11800}
注:java程序部署在docker里 spring.cloud.sentinel.transport.client-ip 就需设置了
来源:oschina
链接:https://my.oschina.net/u/4270792/blog/3454189