当前位置:网站首页>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" }
边栏推荐
- QT adjust win screen brightness and sound size
- Five problems of database operation in commodity supermarket system
- AcWing 3438. 数制转换
- Embedded-c language-7
- Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026
- Kotlin的协程:上下文
- Electronic technology 20th autumn "Introduction to machine manufacturing" online assignment 3 [standard answer]
- Notes on problems -- watching videos on edge will make the screen green
- MySQL has been stopped in the configuration interface during installation
- 远程办公工具分享|社区征文
猜你喜欢

Notes on problems -- watching videos on edge will make the screen green

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

How to purchase Google colab members in China

Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028
![[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

Draw some simple graphics with MFC

POM in idea XML graying solution

Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028

Golang unit test, mock test and benchmark test
![[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
随机推荐
QT学习日记9——对话框
鸿蒙第四次培训
Five problems of database operation in commodity supermarket system
Inheritance of ES6 class
Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
[combinatorics] recursive equation (special solution form | special solution solving method | special solution example)
Test your trained model
Servlet specification Part II
1164 Good in C
【RT-Thread】nxp rt10xx 设备驱动框架之--rtc搭建和使用
[vscode] convert tabs to spaces
面试官:值为 nil 为什么不等于 nil ?
How to purchase Google colab members in China
一位普通程序员一天工作清单
数学公式(测试)
ES6类的继承
Draw some simple graphics with MFC
Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code
Dagong 21 autumn "power plant electrical part" online operation 1 [standard answer] power plant electrical part
Getting started with deops
