当前位置:网站首页>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下载和配置
- Which securities company is better to open an account? Is online account opening safe
- How can the advertising system of large factories be upgraded without the presence of large models
- 迷失在Mysql的锁世界
- 好用app推荐:扫描二维码、扫描条形码并查看历史
- MySQL存储数据加密
- Shell 脚本实现应用服务日志入库 Mysql
- 不同环境相同配置项的内容如何diff差异?
- Scala download and configuration
- El tree combined with El table, tree adding and modifying operations
猜你喜欢

AscendEX 上线 Walken (WLKN) - 一款卓越领先的“Walk-to-Earn”游戏

赋能数字经济 福昕软件出席金砖国家可持续发展高层论坛

30余家机构联合发起数字藏品行业倡议,未来会如何前进?

UML图记忆技巧
【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】

Why do you have to be familiar with industry and enterprise business when doing Bi development?

PMO:比较25种分子优化方法的样本效率

el-tree结合el-table,树形添加修改操作

可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成

抖音实战~评论数量同步更新
随机推荐
MySQL存储数据加密
Huawei Nova 10 series released Huawei application market to build a solid application security firewall
php短视频源码,点赞时会有大拇指动画飘起
Force buckle_ Palindrome number
面试题 01.08. 零矩阵
Nat. Commun.| 机器学习对可突变的治疗性抗体的亲和力和特异性进行共同优化
283. Moving zero-c and language assisted array method
服务线上治理
The proofreading activity of data science on the command line second edition was restarted
好用app推荐:扫描二维码、扫描条形码并查看历史
File read write
Force buckle 3_ 383. Ransom letter
Deveco device tool 3.0 release brings five capability upgrades to make intelligent device development more efficient
Machine learning notes mutual information
el-tree结合el-table,树形添加修改操作
Embedded development: skills and tricks -- seven skills to improve the quality of embedded software code
广电五舟与华为签署合作协议,共同推进昇腾AI产业持续发展
[acwing] solution of the 58th weekly match
Sqlserver encrypts and decrypts data
制作条形码的手机App推荐