如何通过常平小学网站进行小说创作并从中盈利?

摘要:常平小学网站建设,小说投稿赚钱的网站,温州市网页制作项文静,安全平台前言在微服务系统里,对微服务程序的运行状况的跟踪和监控是必不可少的;例如GPE,T
常平小学网站建设,小说投稿赚钱的网站,温州市网页制作项文静,安全平台前言在微服务系统里#xff0c;对微服务程序的运行状况的跟踪和监控是必不可少的#xff1b;例如GPE#xff0c;TelegrafinfluxDB都提供了微服务体系监控的方案#xff0c; ZIPKIN#xff0c; Skywalking都提供了微服务云体系的APM的方案#xff1b; 这些解决方案功能全面…前言在微服务系统里对微服务程序的运行状况的跟踪和监控是必不可少的例如GPETelegrafinfluxDB都提供了微服务体系监控的方案 ZIPKIN Skywalking都提供了微服务云体系的APM的方案 这些解决方案功能全面但是都需要提供额外的资源进行架构 其实在SpringBoot构建的微服务中本身就带有了Actuator组件能够提供相关的功能如果我们对此要求不特别高我们可以在自己的微服务中开启Actuator的功能即可Spring Boot ActuatorSpring Boot Actuator是SpringBoot框架的一个子项目。它使用HTTP的方式公开任何正在运行的应用程序的操作信息。Spring Boot Actuator直接是内嵌如我们的微服务中可以直接从生产就绪的应用程序中获取健康和监控指标。通过Actuator收集度量、了解流量或了解数据库状态变得非常容易。今天咱们这个文章我们一起来看看如何使用和配置Spring Boot Actuator。引入Actuator在项目pom.xml文件里引入actuator的依赖包dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-actuator/artifactId/dependency服务端点(ENDPOINT)Spring Boot Actuator通过HTTP的方式为使用者提供了一个内置端点列表端点列表可以展示出应用程序的操作信息通过Actuator的技术规范开发者可以在自己的相关组件中实现Actuator的Endpoint而启用组件相关的端点信息在最新版本中默认情况下Actuator启动后默认启用了两个端点/health和/info。启动Spring Boot的应用 根据应用的端口在http://IP:port/context/actuator 这个地址就可以查看到应用的Actuator信息默认情况下只启用health和info两个Endpoint 我们通过exposure的配置对可以暴露的Endpoint进行配置在yaml或者properties中配置暴露部分端点management.endpoints.web.exposure.includeinfo,health,beans,env暴露所有端点management.endpoints.web.exposure.include*不暴露beans端点management.endpoints.web.exposure.excludebeans开启shutdown端点用来关闭服务开启远程关闭功能。这个很危险默认关闭一般情况下别开有安全风险上面开启所有端点也不会打开shutdown端点需要配置文件单独配置。management.endpoint.shutdown.enabledtrue/actuator/shutdown 只支持POST请求。在图中出现了很多的比如http://localhost:7500/codeman/actuator/nacosdiscovery这是由于其他的nacos-discovery-starter扩展了自己的Endpoint每个这里的endpoint都可以通过http进行访问比如 http://localhost:7500/codeman/actuator/health查看重要度量指标信息metrics-requiredMetricName: { href: http://localhost:8082/actuator/metrics/{requiredMetricName}, templated: true }, //返回应用的各类重要度量指标信息 metrics: { href: http://localhost:8082/actuator/metrics, templated: false },先通过http://localhost:8082/actuator/metrics应用的各类重要度量指标信息。{ names: [ http.server.requests, jvm.buffer.count, jvm.buffer.memory.used, jvm.buffer.total.capacity, jvm.classes.loaded, jvm.classes.unloaded, jvm.gc.live.data.size, jvm.gc.max.data.size, jvm.gc.memory.allocated, jvm.gc.memory.promoted, jvm.gc.pause, jvm.memory.committed, jvm.memory.max, jvm.memory.used, jvm.threads.daemon, jvm.threads.live, jvm.threads.peak, jvm.threads.states, logback.events, process.cpu.usage, process.start.time, process.uptime, system.cpu.count, system.cpu.usage, tomcat.sessions.active.current, tomcat.sessions.active.max, tomcat.sessions.alive.max, tomcat.sessions.created, tomcat.sessions.expired, tomcat.sessions.rejected ]}然后通过http://localhost:8082/actuator/metrics/{requiredMetricName}查看对应指标详细数据比如我们要查看jvm内存使用情况就通过http://localhost:8082/actuator/metrics/jvm.memory.used查看。系统环境变量http://localhost:8082/actuator/env路径映射和端口最新版本中默认情况所有端点都暴露在“/actuator”路径下可以通过路径映射来修改默认的路径这个方法也是一种比较简易的安全保护方法把默认值换成自己的值配置management.endpoints.web.base-path/manage通过上面的配置就把路径换成了自己的manager路径需要使用xxxx/manage来进行访问避免其他的外部使用者猜到路径也可以通过路径映射去修改endpoint的访问路径配置management.endpoints.web.path-mapping.info_info通过上面的配置将info修改成_info默认情况下actuator使用和应用相同的端口也可以配置actuator使用自己的端口配置management.server.port17501路径映射和端口保护是最简单的安全保护的一种方法 也可以使用spring-boot-starter-security模板的集成来更高级的对actuator的访问进行保护常用的Endpoint推荐大家一定要自行去试试并查看以下Endpoint这几个Endpoint是排查Spring Boot非常有用的Endpoint/health 端点应用健康信息是一个汇总的信息 management.endpoint.health.show-detailsalways开启详细信息/metrics 端点当前应用的各类重要度量指标比如内存信息、线程信息、垃圾回收信息、tomcat、数据库连接池等/beans 端点当前应用的各Bean对象的注册信息/heapdump 端点 自动生成一个 当前Jvm 的堆文件 heapdump。/threaddump 端点当前线程的情况。 主要展示了线程名、线程ID、线程的状态、是否等待锁资源、线程堆栈等信息Endpoint扩展自定义如上图中我们看到的http://localhost:7500/codeman/actuator/nacosdiscovery不是默认的actuator的端点是nacos-discovery-starter扩展的Endpoint用来对获取和知悉Nacos Discovery当前的信息 有时候我们需要去扩展自己的Endpoint定义Endpoint入口Slf4j Endpoint(id feign-info) Component public class FeignSampleEndpoint{ReadOperationpublic FeignSampleState detailState(Selector String[] paths){FeignSampleState state feignSampleState;if(paths!null){Arrays.stream(paths).forEach( one- {state.getInfo().put(one , one );});}return state;} }这个就是一个简单的Endpoint定义 通过Endpoint(idfeign-info)定义了一个feign-info的Endpoint, 方法ReadOperation使用Get DeleteOperation使用Delete协议 WriteOperation使用Post协议定义后就可以通过 xxxx/actuator/feign-info 来进行Endpoint的访问Endpoint了参考文章https://blog.csdn.net/inthirties/article/details/126850399https://blog.csdn.net/weixin_34628145/article/details/123188215