jvm-sandbox-repeater 编译测试

编译repeater操作简述

1: IDEAD 编译

2:test 不通过,可以不用管这个错误

3安装跳过test,可以成功install

mvn install -DskipTests

4:启动

点击绿色的运行

4.1命令行启动测试

java -jar repeater-console\repeater-console-start\target\repeater-console.jar

5windows 打包

使用git的cmd 运行

最后生成这个repeater-stable-bin.tar

这个应该是和https://github.com/alibaba/jvm-sandbox-repeater/releases/download/v1.0.0/sandbox-1.3.3-bin.tar 一样,但是下载不成功。后面安装可以使用这个自己编译打包的。如果能下载成功,自己不学习源码,只使用,可以不用编译直接下载包后安装部署测试。

6打包之后放到ubuntu 中,并放到对应的位置

对应的位置参考jvm-sandbox-repeater/bin/ install-repeater.sh 这个脚本,这个脚本是从github 下载编译好的 安装到linux 系统内。不需要编译即可。

但是repeater-stable-bin.tar 这个我下载多次都不成功。就使用上面IDEA编译并打包的

还需要下载https://github.com/alibaba/jvm-sandbox-repeater/releases/download/v1.0.0/sandbox-1.3.3-bin.tar还是需要这个的,这个也放到linux

sandbox-1.3.3-bin.tar

放到对应的目录,参考这个脚本,理解其操作

第一步从github 下载sandbox-1.3.3-bin.tar 使用 tar xz -C {HOME} 解压到 {HOME}

第二步从github 下载 repeater-stable-bin.tar 使用tar xz -C ${MODULE_HOME} 这个不容易下载,使用上面windows打包的。

MODULE_HOME=${HOME}/.sandbox-module


#!/usr/bin/env bash

typeset SANDBOX_HOME=${HOME}/sandbox

typeset MODULE_HOME=${HOME}/.sandbox-module

exit shell with err_code

$1 : err_code

$2 : err_msg

exit_on_err()
{
\[ ! -z "${2}" ] && echo "{2}" 1\>\&2 exit {1}
}

main(){
echo "====== begin to install sandbox and repeater module ======";
echo "====== step 0 begin to download sandbox package ======";
curl -s https://github.com/alibaba/jvm-sandbox-repeater/releases/download/v1.0.0/sandbox-1.3.3-bin.tar | tar xz -C {HOME} \|\| exit_on_err 1 "extract sandbox failed" echo "====== step 1 begin to download repeater module package ======"; if \[ ! -d {MODULE_HOME} ]; then
mkdir -p {MODULE_HOME} \|\| exit_on_err 1 "permission denied mkdir {MODULE_HOME}"
fi
curl -s https://github.com/alibaba/jvm-sandbox-repeater/releases/download/v1.0.0/repeater-stable-bin.tar | tar xz -C ${MODULE_HOME} || exit_on_err 1 "extract repeater failed"
echo "====== install finished ======";
}

main

7ubuntu 运行

~/jvm_sandbox/jvm-sandbox-repeater/bin$ ./bootstrap.sh

#!/usr/bin/env bash

exit shell with err_code

$1 : err_code

$2 : err_msg

exit_on_err()
{
\[ ! -z "${2}" ] && echo "{2}" 1\>\&2 exit {1}
}

PID=(ps -ef \| grep "repeater-bootstrap.jar" \| grep "java" \| grep -v grep \| awk '{print 2}')

expr ${PID} "+" 10 &> /dev/null

if occurred error,exit

if ! $? -eq 0 || "" = "${PID}" ;then
echo ""
else
echo "found target pid exist, pid is {PID}, kill it..." kill -9 {PID}
fi

if ! -f "${HOME}/.sandbox-module/repeater-bootstrap.jar" ; then
echo "repeater-bootstrap.jar not found, try to install";
sh ./install-local.sh || exit_on_err 1 "install repeater failed"
fi

{JAVA_HOME}/bin/java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 \\ -javaagent:{HOME}/sandbox/lib/sandbox-agent.jar=server.port=8820\;server.ip=0.0.0.0 \
-Dapp.name=repeater \
-Dapp.env=daily \
-jar ${HOME}/.sandbox-module/repeater-bootstrap.jar

没有安装mysql 报错

2025-07-12 22:22:52.457 WARN 11848 --- nio-8001-exec-8 o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08S01
2025-07-12 22:22:52.457 ERROR 11848 --- nio-8001-exec-8 o.h.engine.jdbc.spi.SqlExceptionHelper : Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2025-07-12 22:22:52.460 ERROR 11848 --- nio-8001-exec-8 o.a.c.c.C..\[.\[/.dispatcherServlet : Servlet.service() for servlet dispatcherServlet in context with path \[\] threw exception Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection with root cause

8安装mysql操作

不安装报错

8.1查看是否安装

dpkg -l | grep mysql
ii default-libmysqlclient-dev:amd64 1.0.5ubuntu2 amd64 MySQL database development files (metapackage)
ii libmysqlclient-dev 8.0.42-0ubuntu0.20.04.1 amd64 MySQL database development files
ii libmysqlclient21:amd64 8.0.42-0ubuntu0.20.04.1 amd64 MySQL database client library
ii mysql-common

安装MySQL:

sudo apt install mysql-server

8.2安装之后查看安装成功

以上说明安装成功

此时没有设置密码,使用sudo mysql -u root 即可登录

8.3如何设置密码

sudo mysql_secure_installation 作用是设置 root 密码

    • 如果 root 用户没有密码,会提示你设置一个强密码
    • 如果是新安装的 MySQL,root 用户默认没有密码

下面是操作记录
sudo mysql_secure_installation
sudo password for gao:

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
//这里并没有让输入密码,后面使用命令设置密码
Skipping password set for root as authentication with auth_socket is used by default.
If you would like to use password authentication instead, this can be done with the "ALTER_USER" command.
See https://dev.mysql.com/doc/refman/8.0/en/alter-user.html#alter-user-password-management for more information.

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : n

... skipping.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

  • Dropping test database...
    Success.

  • Removing privileges on test database...
    Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

8.4登录mysql设置密码

sudo mysql -u root登录后

命令如下

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

8.5但是无法设置成功由于策略必须大于8

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

必须大于8

修改策略,使其可以设置6位密码

8.6设置密码123456 成功

再次尝试设置,提示设置成功

8.7重启mysql服务

sudo systemctl start mysql

gao@ubuntu2004:~$ sudo mysql -u root

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

gao@ubuntu2004:~$ mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 8.0.42-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

8.8创建数据库repeater并初始化数据库数据

m

初始化数据库,初始化的sql文件在

|-------------------------------------------------------------------------------------------------|
| /jvm-sandbox-repeater/repeater-console/repeater-console-dal/src/main/resources/database.sql |

这个sql文件有点错误
CREATE DATABASE IF NOT EXISTS repeater
DEFAULT CHARSET utf8
COLLATE utf8_general_ci;

USE repeater; # 增加这一行

使用指令

ysql -u root -p < database.sql 导入

初始化成功,应该会创建了 repeater 这个数据库,且包括下面四个表:

console 工程中MySQL 的数据库配置信息在源码中的位置

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 位置:/jvm-sandbox-repeater/repeater-console/repeater-console-start/src/main/resources spring.datasource.url=jdbc:mysql://数据库IP/域名:数据库端口/数据库名?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.username=用户名 spring.datasource.password=密码 |
| |

我现在设置了和源码一样的账号和密码,所以不需要修改配置文件的username 和password

9ubuntu启动服务

~/jvm_sandbox/jvm-sandbox-repeater/bin$ ./bootstrap.sh

10 按照github readme 测试

指令如下

curl -s 'http://127.0.0.1:8001/regress/slogan?Repeat-TraceId=127000000001156034386424510000ed'

测试截图

11绑定特定后台应用-还没有实践

相关推荐
宸丶一2 小时前
Day 13:持久化记忆 - 让 Agent 拥有长期记忆
jvm·python·ai
cfm_29143 小时前
JVM新一代垃圾收集器深度解析:G1与ZGC
java·jvm
顺风尿一寸7 小时前
JVM 字段布局揭秘:Best‑Fit 算法如何为每个字段精准分配偏移量
jvm
小bo波9 小时前
Java反射机制——运行时"透视"类的秘密
java·jvm·反射·源码分析·动态代理·进阶·spring底层·框架原理
程序猿阿伟9 小时前
《拆解Chrome存储架构:浏览痕迹的残留死角与清除路径》
jvm·chrome·架构
于指尖飞舞10 小时前
java后端面试题(jvm极简)
java·开发语言·jvm
鹅城剑仙10 小时前
JVM 内存模型与 GC 调优实战指南
jvm
Javatutouhouduan10 小时前
2026年Java面试核心讲(终极版)全网首次开源!
java·jvm·java多线程·java面试·后端开发·java程序员·java八股文
程序员二叉20 小时前
【JUC】线程池全套深度详解|参数|流程|拒绝策略|调优|异常处理
java·开发语言·jvm·算法·面试·juc
小马爱打代码1 天前
面试题:内存模型与垃圾回收深度解析
jvm