当前位置:网站首页>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" }
边栏推荐
- Managing multiple selections with MVVM - managing multiple selections with MVVM
- [set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
- 聊聊支付流程的设计与实现逻辑
- MinGW compile boost library
- University of Electronic Science and technology, accounting computerization, spring 20 final exam [standard answer]
- Vs2013 has blocked the installer, and ie10 needs to be installed
- 1164 Good in C
- Inheritance of ES6 class
- STM32实现74HC595控制
- 1147_ Makefile learning_ Target files and dependent files in makefile
猜你喜欢

Automata and automatic line of non-standard design

QT adjust win screen brightness and sound size

Golang单元测试、Mock测试以及基准测试

Qt调节Win屏幕亮度和声音大小

Five problems of database operation in commodity supermarket system

Select 3 fcpx plug-ins. Come and see if you like them
![Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)](/img/be/4ef38f711e7319a2cc83db2bee3a07.jpg)
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)

【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用

互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼

Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
随机推荐
Vs2013 has blocked the installer, and ie10 needs to be installed
Where is the monitoring page of RDS database?
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
Financial management (Higher Vocational College) financial management online Assignment 1 in autumn 20
Answer to the homework assessment of advanced English reading (II) of the course examination of Fuzhou Normal University in February 2022
[RT thread] NXP rt10xx device driver framework -- Audio construction and use
数仓任务里面 跑SQL任务的时候用的数据库账号是在哪里配置的
RDS数据库的监测页面在哪看?
[RT thread] NXP rt10xx device driver framework -- pin construction and use
When absolutely positioned, the element is horizontally and vertically centered
聊聊支付流程的設計與實現邏輯
STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
[combinatorics] recursive equation (the non-homogeneous part is an exponential function and the bottom is the characteristic root | example of finding a special solution)
聊聊支付流程的设计与实现逻辑
Swm32 series Tutorial 4 port mapping and serial port application
POM in idea XML graying solution
[combinatorics] generating function (linear property | product property)
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
PR second time
c# .net 工具生态
