一.版本说明
使用7.5的elasticsearch会报这个错误 Mapping definition has unsupported parameters 官方有给说明 Removal of mapping types 所以这边使用的是 apache-skywalking-apm-6.5.0.tar.gz 和 elasticsearch-6.4.0.tar.gz
二.elasticsearch部署
1.下载 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.0.tar.gz
2.修改配置文件 vi config/elasticsearch.yml
cluster.name: my-elastic64
node.name: elasticsearch64
network.host: 0.0.0.0
http.port: 19200
transport.tcp.port: 19300
3.创建elastic用户 useradd elastic
4.赋权 chown -R elastic:elastic /opt/elastic/elasticsearch-6.4.0
5.启动 切换elastic用户
./binelasticsearch -d
访问 http://192.168.33.88:19200/
三.skywalking部署
1.下载 wget http://mirrors.tuna.tsinghua.edu.cn/apache/skywalking/6.5.0/apache-skywalking-apm-6.5.0.tar.gz
2.解压到skywalking下
sudo tar zvxf apache-skywalking-apm-6.5.0.tar.gz -C /opt
mv /opt/apache-skywalking-apm-bin/ -C /opt/skywalking
3.开发端口 firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --permanent --add-port=11800/tcp
firewall-cmd --permanent --add-port=12800/tcp
firewall-cmd --reload
4.配置application.yml vi ./config/application.yml
去掉H2的 编辑elasticsearch
storage:
elasticsearch:
nameSpace: ${SW_NAMESPACE:"my-elastic64"}
clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:192.168.33.88:19200}
protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"http"}
# trustStorePath: ${SW_SW_STORAGE_ES_SSL_JKS_PATH:"../es_keystore.jks"}
# trustStorePass: ${SW_SW_STORAGE_ES_SSL_JKS_PASS:""}
# user: ${SW_ES_USER:""}
# password: ${SW_ES_PASSWORD:""}
# indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2}
# indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0}
# # Those data TTL settings will override the same settings in core module.
# recordDataTTL: ${SW_STORAGE_ES_RECORD_DATA_TTL:7} # Unit is day
# otherMetricsDataTTL: ${SW_STORAGE_ES_OTHER_METRIC_DATA_TTL:45} # Unit is day
# monthMetricsDataTTL: ${SW_STORAGE_ES_MONTH_METRIC_DATA_TTL:18} # Unit is month
# # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html
# bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:1000} # Execute the bulk every 1000 requests
# flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests
concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests
resultWindowMaxSize: ${SW_STORAGE_ES_QUERY_MAX_WINDOW_SIZE:10000}
metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000}
segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200}
# h2:
# driver: ${SW_STORAGE_H2_DRIVER:org.h2.jdbcx.JdbcDataSource}
# url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db}
# user: ${SW_STORAGE_H2_USER:sa}
# metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}
4.启动collector服务
./oapService.sh
cd /opt/skywalking/bin ./webappService.sh
四.项目部署
1.获取探针jar路径
/opt/skywalking/agent/skywalking-agent.jar
2.项目启动脚本增加
JAVA_OPT="${JAVA_OPT} -javaagent:/opt/skywalking/agent/skywalking-agent.jar -Dskywalking.agent.service_name=ES-DEMO -Dskywalking.collector.backend_service=192.168.33.88:11800"
3.完整的脚本
#!/bin/sh
cd `dirname $0`
JAR_NAME=`ls *.jar`
JAR_NUM=`ls *.jar| wc -l`
if [ $JAR_NUM -eq 0 ]; then
echo "no jar in this directory!"
exit 1
fi
if [ $JAR_NUM -gt 1 ]; then
echo "more than 1 jar in this directory!"
exit 1
fi
cygwin=false
darwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
Darwin*) darwin=true;;
OS400*) os400=true;;
esac
error_exit ()
{
echo "ERROR: $1 !!"
exit 1
}
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/java
[ ! -e "$JAVA_HOME/bin/java" ] && unset JAVA_HOME
if [ -z "$JAVA_HOME" ]; then
if $darwin; then
if [ -x '/usr/libexec/java_home' ] ; then
export JAVA_HOME=`/usr/libexec/java_home`
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
fi
else
JAVA_PATH=`dirname $(readlink -f $(which javac))`
if [ "x$JAVA_PATH" != "x" ]; then
export JAVA_HOME=`dirname $JAVA_PATH 2>/dev/null`
fi
fi
if [ -z "$JAVA_HOME" ]; then
error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!"
fi
fi
export JAVA_HOME
export JAVA="$JAVA_HOME/bin/java"
export BASE_DIR=$(cd `dirname $0`; pwd)
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=160m"
JAVA_OPT="${JAVA_OPT} -javaagent:/opt/skywalking/agent/skywalking-agent.jar -Dskywalking.agent.service_name=ES-DEMO -Dskywalking.collector.backend_service=192.168.33.88:11800"
JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/${JAR_NAME}"
if [ ! -d "${BASE_DIR}/logs" ]; then
mkdir ${BASE_DIR}/logs
fi
if [ ! -f "${BASE_DIR}/logs/start.out" ]; then
touch "${BASE_DIR}/logs/start.out"
fi
echo "$JAVA ${JAVA_OPT}"
echo "service is starting"
echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 &
nohup $JAVA ${JAVA_OPT} ${BASE_DIR}/${JAR_NAME} >> ${BASE_DIR}/logs/start.out 2>&1 &
echo "service is starting,you can check the ${BASE_DIR}/logs/start.out"
4.启动项目 在仪盘表就可以看到启动的项目
拓扑图可以看到项目服务之间的联系
在追踪可以查看到请求接口之间的链路关系
评论区