当前位置:网站首页>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" }
边栏推荐
- Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
- Leetcode 108 converts an ordered array into a binary search tree -- recursive method
- Research Report on market demand and investment planning for the development of China's office chair industry, 2022-2028
- Assembly for unloading Loadfrom() loaded assembly - unloading the assembly loaded with assembly LoadFrom()
- 数仓任务里面 跑SQL任务的时候用的数据库账号是在哪里配置的
- i++与++i的区别:通俗易懂的讲述他们的区别
- 一位普通程序员一天工作清单
- List的stream中Long对象与long判等问题记录
- Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028
- Vs2013 has blocked the installer, and ie10 needs to be installed
猜你喜欢
Records of long objects and long judgments in the stream of list
Embedded-c language-7
问题随记 —— 在 edge 上看视频会绿屏
Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
TCP拥塞控制详解 | 3. 设计空间
Baiwen.com 7 days Internet of things smart home learning experience punch in the next day
Tensorboard quick start (pytoch uses tensorboard)
Golang unit test, mock test and benchmark test
Play with fancy special effects. This AE super kit is for you
Applet setting multi account debugging
随机推荐
Baiwen.com 7 days Internet of things smart home learning experience punch in the next day
Qt调节Win屏幕亮度和声音大小
1146_ SiCp learning notes_ exponentiation
[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source
[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
TCP拥塞控制详解 | 3. 设计空间
Comparison of kotlin collaboration + retro build network request schemes
Online assignment 3 of mobile Internet technology in the 20th autumn of electronic technology [standard answer]
[combinatorics] recursive equation (special solution example 1 Hannover tower complete solution process | special solution example 2 special solution processing when the characteristic root is 1)
i++与++i的区别:通俗易懂的讲述他们的区别
Mathematical formula (test)
Assembly for unloading Loadfrom() loaded assembly - unloading the assembly loaded with assembly LoadFrom()
ArrayList分析3 : 删除元素
Graduation summary
Leetcode 108 converts an ordered array into a binary search tree -- recursive method
【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
PR second time
The third day of writing C language by Yabo people
PS screen printing brush 131, many illustrators have followed suit