当前位置:网站首页>Micro service component sentinel console call
Micro service component sentinel console call
2022-07-03 17:44:00 【kjshuan】
02 Microservice component Sentinel ( Console version )
Step one linux To configure

Start the console command ( Pay attention to dragging the file into linux Under the opt)
#1 Open edit file vim dashboard.sh # Copy the following account number cm password ok( Be careful - You may have to hit it manually ) java -Dserver.port=8858 -Dsentinel.dashboard.auth.username=cm -Dsentinel.dashboard.auth.password=ok -jar /opt/sentinel-dashboard-1.8.1.jar #2 Authorization file name chmod 777 dashboard.sh ls ./dashboard.sh cat dashboard.sh ls /opt/ #3 Browser launch ( Enter your own address ) http://192.168.64.200:8858/#/login #4 account number cm password ok

The above content is displayed and successfully entered !!!
Sentinel It will be initialized the first time the client calls , Start sending heartbeat packets to the console , So make sure the client has access ;
Spring Cloud Alibaba Integrate Sentinel
First step To configure pom
<dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency>
The second step is configuration controller
@RestController
@RequestMapping("/nssent")
public class InitCtrl {
@RequestMapping("/init")
public String sayHello(){
return "Hello World";
}
}
Step 3 configuration yml
server: port: 12005 spring: application: name: nessentinelctl cloud: sentinel: transport: dashboard: 192.168.64.200:8858
Step 4 start the browser to input
http://localhost:12005/nssent/init # Refresh several times Enter the following address http://192.168.64.200:8858/#/dashboard
Step 5 realize flow control
#1 stay controller Add code Custom flow control prompt
@RestController @RequestMapping("/nssent") public class InitCtrl { @RequestMapping("/init") @SentinelResource(value = "it",blockHandler = "ctlHandler") public String sayHello(){ return "Hello World"; } public String ctlHandler(BlockException ex){ return " You are under flow control o(╥﹏╥)o"; } }
install jmeter( Pressure test )
Click on jemter.bat

java Code implementation replaces jemeter test ( Pure code version )
# The first step is to import pom rely on
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
# The second step is to write code
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
// Create a thread pool Default 10 Threads
ExecutorService pool = Executors.newFixedThreadPool(10);
//for Loop execution 10 Time
for (int i = 0; i < 10; i++) {
pool.execute(()->{
try {
CloseableHttpClient chc= HttpClients.createDefault();
HttpGet get = new HttpGet("http://localhost:12005/nssent/init");
CloseableHttpResponse response= chc.execute(get);
System.out.println( Thread.currentThread().getName()+"--------->"+
EntityUtils.toString(response.getEntity()));
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
}
}

------------- project Writing interface -------------( Expand knowledge And sentinel irrelevant )


get length 255 byte 2048 character post 2g There is no limit to the theory

{ "high":100, "weight":60, "scene-manager":"2022-SBZL-05966", "indate":"2022-03-12", "range":"2.6-60" }
边栏推荐
- September, 19, "cam principle and application" online assignment [Full Score answer]
- Applet setting multi account debugging
- TCP congestion control details | 3 design space
- [combinatorics] generating function (linear property | product property)
- 【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
- [RT thread] NXP rt10xx device driver framework -- Audio construction and use
- Golang单元测试、Mock测试以及基准测试
- 1164 Good in C
- 一位普通程序员一天工作清单
- Leetcode 669 pruning binary search tree -- recursive method and iterative method
猜你喜欢

Draw some simple graphics with MFC
![[RT thread] NXP rt10xx device driver framework -- pin construction and use](/img/75/b4f034bfe49409f76e7fd92758804e.png)
[RT thread] NXP rt10xx device driver framework -- pin construction and use

聊聊支付流程的設計與實現邏輯

SWM32系列教程4-端口映射及串口应用

Records of long objects and long judgments in the stream of list

QT learning diary 9 - dialog box

MySQL grouping query
![[RT thread] NXP rt10xx device driver framework -- RTC construction and use](/img/19/91a9d84ba84f81ef125c33eb4007bc.png)
[RT thread] NXP rt10xx device driver framework -- RTC construction and use

聊聊支付流程的设计与实现逻辑
![[RT thread] NXP rt10xx device driver framework -- Audio construction and use](/img/85/32a83eaa4b7f5b30d4d7c4f4c32791.png)
[RT thread] NXP rt10xx device driver framework -- Audio construction and use
随机推荐
[combinatorics] recursive equation (four cases where the non-homogeneous part of a linear non-homogeneous recursive equation with constant coefficients is the general solution of the combination of po
Draw some simple graphics with MFC
Golang unit test, mock test and benchmark test
[mathematical logic] equivalent calculus and reasoning calculus of predicate logic (individual word | predicate | quantifier | predicate logic formula | two basic formulas | proposition symbolization
PR second time
Create a new file from templates with bash script - create new file from templates with bash script
Swm32 series Tutorial 4 port mapping and serial port application
First day of rhcsa study
Answer to the homework assessment of advanced English reading (II) of the course examination of Fuzhou Normal University in February 2022
Records of long objects and long judgments in the stream of list
[RT thread] NXP rt10xx device driver framework -- pin construction and use
1147_ Makefile learning_ Target files and dependent files in makefile
Stm32h7 Hal library SPI DMA transmission has been in busy solution
Deops入门
Graduation summary
QT学习日记9——对话框
Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
远程办公工具分享|社区征文
Where is the database account used when running SQL tasks in data warehouse tasks configured
聊聊支付流程的设计与实现逻辑
