当前位置:网站首页>Deployment of JVM sandbox repeater
Deployment of JVM sandbox repeater
2022-07-04 22:23:00 【Wu_ Candy】
1. What is? jvm-sandbox-repeater?
jvm-sandbox-repeater yes JVM-Sandbox An important module under the ecosystem , It has JVM-Sandbox All the characteristics of , The plug-in design is easy to quickly adapt to various middleware , Encapsulate request recording / Playback basic protocol , It also provides a variety of common and extensible resources API.jvm-sandbox Refer to JVM Sandbox container , A kind of JVM Non intrusive operation period of AOP Solution .
2. What is its core competence ?
2.1 Universal recording / Playback capability
(1). No intrusive recording HTTP/Java/Dubbo Enter the reference / Return value recording capability ( Business systems have no perception )
(2). be based on TTL Provide multi line program sub call tracing , Fully trace the call path of a request
(3). Entry request (HTTP/Dubbo/Java) Traffic playback 、 Child call (Java/Dubbo) Return value Mock Ability
2.2 Fast and scalable API Realization
(1). Recording / Playback plug-in architecture
(2). Provide standard interface , configurable / Simple coding to realize a kind of general plug-in
2.3. standalone Working mode
No need to rely on any server / Storage , Can work alone , Provide recording / Playback capability
3. How to deploy ?
3.1 Console Deploy
setp1: Download the source code
git clone https://github.com/alibaba/jvm-sandbox-repeater
step2: Configuration database information application.properties And initialization related to the initialization database sql The file address is :
./jvm-sandbox-repeater/repeater-console/repeater-console-dal/src/main/resources/database.sql
step3: Configure on server mvn command
If it is configured yum Source , You can use the following command to directly install maven
yum install maven
step4: Compile and start console command
cd ./jvm-sandbox-repeater
mvn install -DskipTests && nohup java -jar repeater-console/repeater-console-start/target/repeater-console.jar > console.log 2>&1 &
3.2 Repeater Deploy
setp1: In the source download directory above
cd ./jvm-sandbox-repeater/bin && sh install-local.sh
install-local.sh The script is as follows :
[email protected] bin # more sh install-local.sh
#!/usr/bin/env bash
# repeater's target dir
REPEATER_TARGET_DIR=../target/repeater
# exit shell with err_code
# $1 : err_code
# $2 : err_msg
exit_on_err()
{
[[ ! -z "${2}" ]] && echo "${2}" 1>&2
exit ${1}
}
# package
sh ./package.sh || exit_on_err 1 "install failed cause package failed" # Here we call package.sh Script , The following will be analyzed separately
# extract sandbox to ${HOME}
curl -s http://sandbox-ecological.oss-cn-hangzhou.aliyuncs.com/sandbox-1.2.1-bin.tar | tar xz -C ${HOME} || exit_on_err 1 "extract sandbox failed" # Download and unzip sandbox Package
# copy module to ~/.sandbox-module
mkdir -p ${HOME}/.sandbox-module || exit_on_err 1 "permission denied, can not mkdir ~/.sandbox-module" # Create directory
cp -r ${REPEATER_TARGET_DIR}/* ${HOME}/.sandbox-module || exit_on_err 1 "permission denied, can not copy module to ~/.sandbox-module" # Copy ../target/repeater All the files in the directory are in the directory created by the previous command
package.sh The script is as follows :
[email protected] bin # more package.sh
#!/usr/bin/env bash
# repeater's target dir
REPEATER_TARGET_DIR=../target/repeater # Defining variables
# exit shell with err_code
# $1 : err_code
# $2 : err_msg
exit_on_err()
{
[[ ! -z "${2}" ]] && echo "${2}" 1>&2
exit ${1}
}
# maven package the sandbox
mvn clean package -Dmaven.test.skip=true -f ../pom.xml || exit_on_err 1 "package repeater failed." # Compile the package
mkdir -p ${REPEATER_TARGET_DIR}/plugins # Create directory
mkdir -p ${REPEATER_TARGET_DIR}/cfg # Create directory
cp ./repeater-logback.xml ${REPEATER_TARGET_DIR}/cfg/repeater-logback.xml \ # Copy files to repeater Catalog
&& cp ./repeater.properties ${REPEATER_TARGET_DIR}/cfg/repeater.properties \
&& cp ./repeater-config.json ${REPEATER_TARGET_DIR}/cfg/repeater-config.json \
&& cp ../repeater-module/target/repeater-module-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/repeater-module.jar \
&& cp ../repeater-console/repeater-console-start/target/repeater-console.jar ${REPEATER_TARGET_DIR}/repeater-bootstrap.jar \
&& cp ../repeater-plugins/ibatis-plugin/target/ibatis-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/ibatis-plugin.jar \
&& cp ../repeater-plugins/java-plugin/target/java-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/java-plugin.jar \
&& cp ../repeater-plugins/mybatis-plugin/target/mybatis-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/mybatis-plugin.jar \
&& cp ../repeater-plugins/dubbo-plugin/target/dubbo-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/dubbo-plugin.jar \
&& cp ../repeater-plugins/redis-plugin/target/redis-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/redis-plugin.jar \
&& cp ../repeater-plugins/http-plugin/target/http-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/http-plugin.jar \
&& cp ../repeater-plugins/hibernate-plugin/target/hibernate-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/hibernate-plugin.jar \
&& cp ../repeater-plugins/spring-data-jpa-plugin/target/spring-data-jpa-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/spring-data-jpa-plugin.jar
repeater The log configuration file is as follows :
repeater The log path of is :~/logs/sandbox/repeater/repeater.log --》 This is because logback.xml Configuration determines repeater-logback.xml The contents of the document are as follows :
[email protected] bin #more repeater-logback.xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="10000">
<appender name="REPEATER-FILE-APPENDER" class="ch.qos.logback.core.rolling.Ro
llingFileAppender">
<file>${user.home}/logs/sandbox/repeater/repeater.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>${user.home}/logs/sandbox/repeater/repeater.log.%d{y
yyy-MM-dd}</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<root level="info">
<appender-ref ref="REPEATER-FILE-APPENDER"/>
</root>
</configuration>
3.3 Sandbox Deploy
https://github.com/alibaba/jvm-sandbox
- JVM-SANDBOX( The sandbox ) It realizes a method without restarting 、 Don't invade the target JVM Applied AOP Solution
- Operation steps : Download the latest version of JVM-SANDBOX
wget http://ompc.oss-cn-hangzhou.aliyuncs.com/jvm-sandbox/release/sandbox-stable-bin.zip
# decompression
unzip sandbox-stable-bin.zip
# Enter the sandbox to execute the script
cd sandbox/bin
# stay ~/sandbox/bin/sandbox.sh Starting up cfg There is a sandbox.properties file , The catalogue is /root/sandbox/cfg
sandbox.properties The document specifies user_module=~/.sandbox-module
# Mount target JVM process , Here we use console Apply as an example to mount , One command is done :
sh ~/sandbox/bin/sandbox.sh -p `ps -ef | grep "console" | grep -v grep | awk '{print $2}'` -P 12250 【 This order will console JVM Mount the process 】
~/.sandbox-module You can see :
[email protected] .sandbox-module # tree
.
├── cfg
│ ├── repeater-config.json
│ ├── repeater-logback.xml # This repeater Log configuration file after startup
│ └── repeater.properties # hold repeater.properties Inside ip and port It is amended as follows console The machine started ip and port
├── plugins
│ ├── dubbo-plugin.jar
│ ├── hibernate-plugin.jar
│ ├── http-plugin.jar
│ ├── ibatis-plugin.jar
│ ├── java-plugin.jar
│ ├── mybatis-plugin.jar
│ ├── redis-plugin.jar
│ └── spring-data-jpa-plugin.jar
├── repeater-bootstrap.jar
└── repeater-module.jar #repeater Module startup jar
Sandbox Log configuration :
#more sandbox-logback.xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="10000">
<appender name="SANDBOX-FILE-APPENDER" class="ch.qos.logback.core.rolling.Rol
lingFileAppender">
<file>${user.home}/logs/sandbox/sandbox.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>${user.home}/logs/sandbox/sandbox.log.%d{yyyy-MM-dd}
</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %SANDBOX_NAMESPACE %-5level %msg%n</
pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<root level="info">
<appender-ref ref="SANDBOX-FILE-APPENDER"/>
</root>
</configuration>
4.Console The deployed launch page is shown in the following figure
end
边栏推荐
- Scala download and configuration
- odps 中 对表进行了一次备份,为什么在元数据库查m_table 时,两张表的逻辑大小不一致,但数
- El tree combined with El table, tree adding and modifying operations
- Force buckle_ Palindrome number
- 力扣2_1480. 一维数组的动态和
- Challenges faced by virtual human industry
- The proofreading activity of data science on the command line second edition was restarted
- New intersectionobserver usage notes
- 复数在数论、几何中的用途 - 曹则贤
- 傳智教育|如何轉行互聯網高薪崗比特之一的軟件測試?(附軟件測試學習路線圖)
猜你喜欢
Bookmark
Scala下载和配置
Energy momentum: how to achieve carbon neutralization in the power industry?
广电五舟与华为签署合作协议,共同推进昇腾AI产业持续发展
KDD2022 | 什么特征进行交互才是有效的?
Xiangjiang Kunpeng joined the shengteng Wanli partnership program and continued to write a new chapter of cooperation with Huawei
Éducation à la transmission du savoir | Comment passer à un test logiciel pour l'un des postes les mieux rémunérés sur Internet? (joindre la Feuille de route pour l'apprentissage des tests logiciels)
虚拟人产业面临的挑战
Domestic database chaos
【C语言进阶篇】数组&&指针&&数组笔试题
随机推荐
Embedded development: skills and tricks -- seven skills to improve the quality of embedded software code
LOGO特训营 第三节 首字母创意手法
阿里推出新品牌“瓴羊”,致力成为“数字化领头羊”
LOGO特训营 第一节 鉴别Logo与Logo设计思路
抖音实战~评论数量同步更新
【Acwing】第58场周赛 题解
Implementation rules for archiving assessment materials of robot related courses 2022 version
QT - plot other problems
30余家机构联合发起数字藏品行业倡议,未来会如何前进?
Xiangjiang Kunpeng joined the shengteng Wanli partnership program and continued to write a new chapter of cooperation with Huawei
Enabling digital economy Fuxin software attends the BRICs high level Forum on Sustainable Development
WebGIS框架---kalrry
Interview question 01.08 Zero matrix
Nat. Commun.| 机器学习对可突变的治疗性抗体的亲和力和特异性进行共同优化
MySQL存储数据加密
Service online governance
TCP protocol three times handshake process
idea中pom.xml依赖无法导入
MySQL storage data encryption
达梦数据凭什么被称为国产数据库“第一股”?