升级到 Airflow 2 后,我在某些 DAG 中遇到了该错误:
ModuleNotFoundError: No module named 'airflow.operators.sensors'
Run Code Online (Sandbox Code Playgroud) 我正在尝试为我想在 docker 中运行的应用程序创建一个 Dockerfile。我正在使用命令 activator run 运行该应用程序。这个命令在文件结构里面
xyz\Desktop\ffa_predix\activator-1.2.10。所以,我已经进入文件并将我的 Dockerfile 放在那里,内容如下。
FROM jboss/base-jdk:7
RUN mkdir -p /ffa_app
COPY . /ffa_app
WORKDIR /ffa_app
CMD ["activator" , "run"]
EXPOSE 9000
Run Code Online (Sandbox Code Playgroud)
但是在转到第二行后,它给了我错误:
mkdir:无法创建目录“/ffa_app”:权限被拒绝。
我想在不同的时间运行一个 cron。
是否可以在我的 YML 文件中执行类似的操作:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: my-cronjob
spec:
schedule:
- "*/10 00-08 * * *"
- "*/5 09-18 * * *"
- "*/10 19-23 * * *"
concurrencyPolicy: Forbid
...
Run Code Online (Sandbox Code Playgroud)
或者我是否必须为每个计划时间创建单独的 YML 文件?
我有一个与batch.size生产者配置相关的问题。
batch.size当达到并且生产者应用程序线程发送更多数据时会发生什么?
线程是否会阻塞,直到包含批处理的缓冲区中的空间可用为止?
我正在尝试构建一个脚本,kubectl get pods当我在 Ubuntu 服务器上进行任何更改/删除 pod 时,该脚本可以跟随(-f)查看实时更新。
什么是最简单/有效的方法?
我使用这个命令在K8S上部署了一个elasticsearchhelm install elasticsearch elastic/elasticsearch集群。
我可以看到 Pod 正在运行:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
elasticsearch-master-0 0/1 Running 0 4m30s
kibana-kibana-5697fc485b-qtzzl 0/1 Running 0 130m
Run Code Online (Sandbox Code Playgroud)
服务看起来也不错:
$ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
elasticsearch-master ClusterIP 10.105.59.248 <none> 9200/TCP,9300/TCP 4m50s
elasticsearch-master-headless ClusterIP None <none> 9200/TCP,9300/TCP 4m50s
kibana-kibana ClusterIP 10.104.31.124 <none> 5601/TCP 6d7h
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 10d
Run Code Online (Sandbox Code Playgroud)
但deploymentelasticsearch没有:
$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
kibana-kibana 0/1 1 …Run Code Online (Sandbox Code Playgroud) 我有一个包含 50000 个条目的 CSV 文件,我想使用 JDBC 中的批处理将其导入到 SQL 中。
最佳的批量大小应该是多少?
我已经构建了一个网络服务器,并试图对其进行密码保护。我正在尝试使用 Spring Boot 设置基本身份验证。到目前为止,这是我的配置文件:
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/", "/v1/occupancy/*")
.permitAll()
.anyRequest()
.authenticated()
.and()
.httpBasic();
}
}
Run Code Online (Sandbox Code Playgroud)
这按预期工作并保护我的 GET 端点之一,使我能够进行身份验证。
但是,对于 POST 端点,这不起作用。端点看起来像这样:
@RequestMapping(path = "/v1/admin/repository")
public class RepositoryOptionsController {
private final EstablishmentOptionsRepositoryService establishmentOptionsRepositoryService;
private final SubAreaOptionsRepositoryService subAreaOptionsRepositoryService;
@PostMapping("/establishment/options")
public ResponseEntity<String> postEstablishmentOption(@RequestBody OptionsRequestDto body) {
Run Code Online (Sandbox Code Playgroud)
当我做
curl -X POST "http://localhost:8080/v1/admin/repository/establishment/options" -u root -v -d "{...}"
Run Code Online (Sandbox Code Playgroud)
我明白了
Enter host password for user 'root':
Note: Unnecessary use of -X …Run Code Online (Sandbox Code Playgroud) 我有一个基于 Webflux 的微服务,它有一个简单的反应存储库:
public interface NotificationRepository extends ReactiveMongoRepository<Notification, ObjectId> {
}
Run Code Online (Sandbox Code Playgroud)
现在我想扩展这个微服务来使用来自 Kafka 的事件消息。然后该消息/事件将被保存到数据库中。
对于 Kafka 监听器,我使用了 Spring Cloud Stream。我创建了一些简单的消费者,它工作得很好 - 我能够使用消息并将其保存到数据库中。
@Bean
public Consumer<KStream<String, Event>> documents(NotificationRepository repository) {
return input ->
input.foreach((key, value) -> {
LOG.info("Received event, Key: {}, value: {}", key, value);
repository.save(initNotification(value)).subscribe();
});
}
Run Code Online (Sandbox Code Playgroud)
但这是连接 Spring Cloud Stream 消费者和反应式存储库的正确方法吗?看起来不像是我subscribe()最后必须打电话的时候。
我阅读了Spring Cloud Stream 文档(针对 3.0.0 版本),他们说
Native support for reactive programming - since v3.0.0 we no longer distribute spring-cloud-stream-reactive modules and instead relying on …Run Code Online (Sandbox Code Playgroud) reactive-programming apache-kafka project-reactor spring-cloud-stream spring-webflux
我在这里Dockerfile找到了这个样本:
// version 1
FROM ubuntu:latest
RUN apt update && apt install ssh -y
RUN service ssh start
CMD ["/usr/sbin/sshd","-D"]
Run Code Online (Sandbox Code Playgroud)
当我构建并运行它时Dockerfile,它在前台运行一个 SSH 服务器,这很棒。
如果我使用以下内容Dockerfile:
// version 2
FROM ubuntu:latest
RUN apt update && apt install ssh -y
RUN service ssh start
# CMD ["/usr/sbin/sshd","-D"] // without this line
Run Code Online (Sandbox Code Playgroud)
然后运行容器:
~$ docker run -p 2222:22 -it ssh_server
Run Code Online (Sandbox Code Playgroud)
并尝试从另一个终端连接它,它不起作用。看来对 sshd 的调用是必要的。另一方面,如果我只是在 Dockerfile 中安装 SSH:
// version 3
FROM ubuntu:latest
RUN apt-get update && apt-get install …Run Code Online (Sandbox Code Playgroud) kubernetes ×3
apache-kafka ×2
docker ×2
airflow ×1
cron ×1
dockerfile ×1
http ×1
java ×1
jdbc ×1
kubectl ×1
linux ×1
spring-boot ×1
sql ×1
sqlyog ×1
ssh ×1
ubuntu ×1