最近,我开始使用具有以下属性的 Quartz 持久作业存储:
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
Run Code Online (Sandbox Code Playgroud)
我在 spring 中使用基于 cron 的触发器定义了一个示例作业:
<bean id="sampleCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="sampleJobDetail"/>
<property name="cronExpression" value="0/5 * * * * ?"/>
Run Code Online (Sandbox Code Playgroud)
我看到作业确实每 5 秒执行一次,一切都很好。现在我停止该程序,这是一个简单的控制台应用程序,没有 Web 容器或任何其他内容,等待约 30 秒并重新运行我的程序。我看到的是,当调度程序启动时,作业会被触发很多次。例如,如果作业执行如下:
public class SampleJob implements Serializable, Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
System.out.println("Executing the job Job " + new Date());
}
Run Code Online (Sandbox Code Playgroud)
}
重启后输出如下:
Executing the job Job Mon Mar 31 08:34:18 IDT 2014
Executing the job Job Mon Mar 31 08:34:18 IDT …Run Code Online (Sandbox Code Playgroud) 我在本地 kubernetes 集群中部署了 Spring Boot 驱动的微服务。微服务使用 micrometer 和 prometheus 注册表,但由于我们公司的政策,执行器可在另一个端口上使用:
http://host:8081/manage/prometheus在本地运行进程时访问和查看指标(没有 kubernetes)。现在,我是 Prometheus 的初学者,对 kubernetes 的知识相当有限(我有 Java 开发人员背景)。
我已经用我的应用程序创建了一个 POD 并成功地在 kubernetes 中运行它。它可以工作并且我可以访问它(对于 8080,我已经创建了一个服务来映射端口)并且我可以从同一台 PC 执行“业务”级别的 http 请求。
但是我还没有找到任何在图片中添加普罗米修斯的例子。Prometheus 应该像另一个 pod 一样部署在同一个 kubernetes 集群中。所以我开始了:
FROM @docker.registry.address@/prom/prometheus:v2.15.2
COPY entrypoint.sh /
USER root
RUN chmod 755 /entrypoint.sh
ADD ./prometheus.yml /etc/prometheus/
ENTRYPOINT ["/entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
entrypoint.sh看起来像:
#!/bin/sh
echo "About to run prometheus"
/bin/prometheus --config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/prometheus \
--storage.tsdb.retention.time=3d \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.console.templates=/etc/prometheus/consoles
Run Code Online (Sandbox Code Playgroud)
我的问题是我应该如何定义,prometheus.yml以便它从我的 spring boot …
在我们的项目中,我们使用 ELK 堆栈将日志存储在一个集中的地方。但是我注意到最近版本的 ElasticSearch 支持各种聚合。此外 Kibana 4 支持很好的图形方式来构建图形。即使是最新版本的 grafana 现在也可以使用 Elastic Search 2 数据源。
那么,这一切是否意味着 ELK 堆栈现在可以用于存储系统内部收集的计量信息,或者它仍然不能被视为现有解决方案的严重竞争对手:石墨、流入数据库等。如果是这样,是否有人在生产中使用 ELK 进行计量?你能分享一下你的经验吗?
只是为了澄清这些概念,我认为计量数据是可以汇总并显示在“随时间推移”图表中的东西,而不是主要用例正在搜索的常规日志消息。
非常感谢提前
在我的服务 /actuator/health 端点之一中,需要更多时间(大约 9 秒)。我正在使用以下依赖项,如何调试?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
使用的 Spring Boot 版本: 2.0.3.RELEASE
谢谢,哈里