当前位置:网站首页>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
边栏推荐
- 电话加密,中间4为****代替
- WebGIS framework -- kalrry
- LOGO特训营 第三节 首字母创意手法
- NAACL-22 | 在基于Prompt的文本生成任务上引入迁移学习的设置
- HBuilder X 常用的快捷键
- vim 从嫌弃到依赖(23)——最后的闲扯
- i.MX6ULL驱动开发 | 24 - 基于platform平台驱动模型点亮LED
- How to transfer to software testing, one of the high paying jobs in the Internet? (software testing learning roadmap attached)
- [Yugong series] go teaching course 003-ide installation and basic use in July 2022
- MySQL存储数据加密
猜你喜欢
Zhiyang innovation signed a cooperation agreement with Huawei to jointly promote the sustainable development of shengteng AI industry
BigFilter全局交易防重组件的介绍与应用
2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import “fmt“ func main() { fmt.Pri
嵌入式开发:技巧和窍门——提高嵌入式软件代码质量的7个技巧
赋能数字经济 福昕软件出席金砖国家可持续发展高层论坛
虚拟人产业面临的挑战
智洋创新与华为签署合作协议,共同推进昇腾AI产业持续发展
Locust性能测试 —— 环境搭建及使用
并发网络模块化 读书笔记转
The use of complex numbers in number theory and geometry - Cao Zexian
随机推荐
抖音实战~评论数量同步更新
LOGO特训营 第三节 首字母创意手法
É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)
PostgreSQL服务端编程聚合和分组
BigFilter全局交易防重组件的介绍与应用
283. 移动零-c与语言辅助数组法
Xiangjiang Kunpeng joined the shengteng Wanli partnership program and continued to write a new chapter of cooperation with Huawei
Jvm-Sandbox-Repeater的部署
阿里推出新品牌“瓴羊”,致力成为“数字化领头羊”
将QA引入软件开发生命周期是工程师要遵循的最佳实践
TCP协议三次握手过程
NAACL-22 | 在基于Prompt的文本生成任务上引入迁移学习的设置
From repvgg to mobileone, including mobileone code
Solana链上应用Crema因黑客攻击停运
可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
More than 30 institutions jointly launched the digital collection industry initiative. How will it move forward in the future?
The use of complex numbers in number theory and geometry - Cao Zexian
Interview question 01.08 Zero matrix
ACM Multimedia 2022 | 视觉语言预训练模型中社会偏见的反事实衡量和消除
Flask 上下文详解