PelicanDT(Pelican Distributed Test),是阿里云提供的一款 Linux 系统远程控制利器,是主要针对分布式应用提供的集成测试解决方案,用于帮助开发者简单、高效地测试分布式应用。
PelicanDT 具有以下特点:
- 使用 Java 语言与 Linux 系统交互。
- 本地控制 Linux 系统执行命令。
- 通过简单的操作对应用注入异常来模拟测试环境。例如:应用停服、CPU 过高、内存过高、网络中断、网络流量延时等环境。
基于 PelicanDT 实现的Demo:
- Dubbo测试Demo工程:Dubbo-example
- Nacos测试Demo工程:Nacos-example
- RocketMQ测试Demo工程:RocketMQ-example
https://help.aliyun.com/document_detail/102518.html
- 将SDK添加到项目中
- 使用PelicanDT SDK有两种方式:
- 下载SDK源码包,在下载中心下载最新版的JAVA SDK到本地,并import 到您的工作目录中。
- 引入PelicanDT SDK依赖,通过maven二方库依赖的方式将PelicanDT的sdk加入到自己的项目中
<dependency> <groupId>com.alibaba.pelican</groupId> <artifactId>PelicanDT</artifactId> <version>1.0.6</version> </dependency>以下代码示例展示了使用PelicanDT SDK使用方式:
本地代码控制远程服务器执行命令:
- 创建并初始化RemoteCmdClient实例,RemoteCmdClient为远程服务器客户端。
- 填写远程服务器ip、userName、password信息
- 本地执行示例程序,向远程服务器执行pwd命令
import com.alibaba.pelican.chaos.client.impl.RemoteCmdClient; import lombok.extern.slf4j.Slf4j; import org.junit.Test; /** * @author moyun@middleware */ @Slf4j public class TestRemoteCmdClient { @Test public void testRemoteCmdClient() { //ECS可公网访问的IP String ip = ""; //ECS用户名,一般为root String userName = ""; //ECS登录密码 String password = ""; //创建并初始化RemoteCmdClient实例 RemoteCmdClientConfig remoteCmdClientConfig = new RemoteCmdClientConfig(); remoteCmdClientConfig.setIp(ip); remoteCmdClientConfig.setUserName(userName); remoteCmdClientConfig.setPassword(password); RemoteCmdClient client = new RemoteCmdClient(remoteCmdClientConfig); //执行pwd命令 RemoteCmdResult resultInfo = client.execCmdWithPTY(new RemoteCmd("pwd")); log.info(resultInfo.getStdInfo()); } }日志输出内容如下
[root@iz2ze0kv2rqck9wpheu5vxz ~]$pwd root [root@iz2ze0kv2rqck9wpheu5vxz ~]$export HISTFILE=/dev/null [root@iz2ze0kv2rqck9wpheu5vxz ~]$exit logout通过第2行内容可以看出,命令执行默认目录/root/
pelicandt's People
Forkers
p79n6a moyunalibaba yechengxu sew1ng zhendong590 fallfall zhanglei linqiuping mike-hmr sdgdsffdsfff tonytonyy csyorange joncv xz-zhuqi tools-env wuxiangdc byiocc zheng-zy myteam888 zjwind gholdzhang frankye84 hxr66666 ren-maomaopelicandt's Issues
There is a vulnerability in Spring Framework 4.2.8 ,upgrade recommended
Line 39 in c64bc13
CVE-2018-1270、CVE-2020-5421
Recommended upgrade version:4.3.29.RELEASE异常注入-网络包重复
Linux下用tc控制网络包重复
异常注入-模拟数据包乱序
Linux下用tc控制网络数据包乱序
client初始化不能指定端口
RemoteCmdClientConfig 这个不能指定端口信息
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
OpenClaw
Personal AI Assistant
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
