当前位置: 首页 > article >正文

Flink启动任务

Flink

以本地运行作为解读,版本1.16.0


文章目录

  • Flink
  • 前言
  • StreamExecutionEnvironment
  • LocalExecutor
  • MiniCluster
    • 启动MiniCluster
  • TaskManager
  • TaskExecutor
    • 提交Task(submitTask)
  • StreamGraph
  • 二、使用步骤
    • 1.引入库
    • 2.读入数据
  • 总结


前言

提示:这里可以添加本文要记录的大概内容:

例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。


提示:以下是本篇文章正文内容,下面案例可供参考

StreamExecutionEnvironment

流执行环境:本地使用:LocalStreamEnvironment,远程使用:RemoteStreamEnvironment。

1.1 通过StreamExecutionEnvironment调用execute(String jobName)方法。
1.1.1 获取所有算子,只能包含一个sink(输出)类型的算子。
1.1.2 调用方法getStreamGraph()将算子转换为流图(StreamGraph)。
1.1.3 调用execute(StreamGraph streamGraph)。

public JobExecutionResult execute(String jobName) throws Exception {final List<Transformation<?>> originalTransformations = new ArrayList<>(transformations);StreamGraph streamGraph = getStreamGraph();if (jobName != null) {streamGraph.setJobName(jobName);}try {return execute(streamGraph);} catch (Throwable t) {// Retry without cache if it is caused by corrupted cluster dataset.invalidateCacheTransformations(originalTransformations);streamGraph = getStreamGraph(originalTransformations);return execute(streamGraph);}
}

1.2 通过StreamExecutionEnvironment调用execute(String jobName)方法。
1.2.1 通过executeAsync(StreamGraph streamGraph),方法异步执行流图。
1.2.2 根据返回的JobClient,用户控制作业的执行。

public JobExecutionResult execute(StreamGraph streamGraph) throws Exception {final JobClient jobClient = executeAsync(streamGraph);try {final JobExecutionResult jobExecutionResult;if (configuration.getBoolean(DeploymentOptions.ATTACHED)) {jobExecutionResult = jobClient.getJobExecutionResult().get();} else {jobExecutionResult = new DetachedJobExecutionResult(jobClient.getJobID());}jobListeners.forEach(jobListener -> jobListener.onJobExecuted(jobExecutionResult, null));return jobExecutionResult;} catch (Throwable t) {Throwable strippedException = ExceptionUtils.stripExecutionException(t);jobListeners.forEach(jobListener -> {jobListener.onJobExecuted(null, strippedException);});ExceptionUtils.rethrowException(strippedException);return null;}
}

1.3 通过StreamExecutionEnvironment调用executeAsync(StreamGraph streamGraph)方法。
1.3.1 通过getPipelineExecutor()方法获取PipelineExecutor为LocalExecutor。
1.3.2 LocalExecutor根据提供的工作流图,并执行。获取JobClient,允许与正在执行的作业进行交互。例如:取消作业或获取保存点。
1.3.3 JobListener监听JobClient。

public JobClient executeAsync(StreamGraph streamGraph) throws Exception {checkNotNull(streamGraph, "StreamGraph cannot be null.");final PipelineExecutor executor = getPipelineExecutor();CompletableFuture<JobClient> jobClientFuture =executor.execute(streamGraph, configuration, userClassloader);try {JobClient jobClient = jobClientFuture.get();jobListeners.forEach(jobListener -> jobListener.onJobSubmitted(jobClient, null));collectIterators.forEach(iterator -> iterator.setJobClient(jobClient));collectIterators.clear();return jobClient;} catch (ExecutionException executionException) {final Throwable strippedException =ExceptionUtils.stripExecutionException(executionException);jobListeners.forEach(jobListener -> jobListener.onJobSubmitted(null, strippedException));throw new FlinkException(String.format("Failed to execute job '%s'.", streamGraph.getJobName()),strippedException);}
}

LocalExecutor


实现了PipelineExecutor,负责执行StreamGraph,即用户提交的作业。

  1. 将StreamGraph通过getJobGraph(Pipeline pipeline, Configuration configuration, ClassLoader userCodeClassloader)生成为JobGraph。
  2. 通过submitJob(JobGraph jobGraph, ClassLoader userCodeClassloader)方法创建一个MiniCluster并提交一个任务(Job)。
public CompletableFuture<JobClient> execute(Pipeline pipeline, Configuration configuration, ClassLoader userCodeClassloader)throws Exception {checkNotNull(pipeline);checkNotNull(configuration);Configuration effectiveConfig = new Configuration();effectiveConfig.addAll(this.configuration);effectiveConfig.addAll(configuration);// we only support attached execution with the local executor.checkState(configuration.getBoolean(DeploymentOptions.ATTACHED));final JobGraph jobGraph = getJobGraph(pipeline, effectiveConfig, userCodeClassloader);return PerJobMiniClusterFactory.createWithFactory(effectiveConfig, miniClusterFactory).submitJob(jobGraph, userCodeClassloader);
}

MiniCluster


本地执行Job任务

启动MiniCluster


1.1 创建workingDirectory,WorkingDirectory:该类管理进程或实例的工作目录,当已经被实例化后,该类确保指定的工作目录已存在。
1.2 创建metricRegistry,MetricRegistry:该类跟踪所有已注册的指标,是MetricGroups和MetricReporters之间的连接。
1.3 创建commonRpcService,RpcService:rpc服务用于启动并连接到RpcEndpoint。连接到rpc服务器将返回一个RpcGateway,可用于调用远程过程。
1.4 taskManagerRpcServiceFactory = commonRpcService
1.5 创建metricQueryServiceRpcService,RpcService
1.6 将metricQueryServiceRpcService设置到metricRegistry的用于初始化MetricQueryService。
1.7 创建processMetricGroup,ProcessMetricGroup,并设置metricRegistry。
1.8 创建ioExecutor,ExecutorService,线程池用于任务执行。
1.9 创建haServicesFactory,HighAvailabilityServicesFactory,创建高可用服务工厂。
1.20 创建haServicesFactory,通过高可用工厂创建高可用服务,并将当前注入到ioExecutor。HighAvailabilityServices:高可用服务可以访问所有支持高可用的组件(服务),这些服务提供了高可用的存储和服务注册,以及分布式计算和领导者选举。

ResourceManager  领导者选举并获取领导者信息
JobManager 领导者选举并获取领导者信息
Persistence 用户检查点元数据
Registering 最新完成的检查点
Persistence BLOB(二进制大对象)存储
Registry  标记作业状态
Naming RPC站点

1.21 创建blobServer并启动,BlobServer:BLOB服务器负责监听传入的请求,并生成线程来处理这些请求。此外,它还负责创建目录结构来存储BLOB或临时缓存它们。
1.22 创建heartbeatServices,HeartbeatServices:提供心跳所需的所有服务。这包括创建心跳接收器和心跳发送器。
1.23 创建delegationTokenManager,传入了commonRpcService.getScheduledExecutor()和ioExecutor。
DelegationTokenManager:Flink集群代理所有的Token管理器。代理Token启动后,此管理器将确保长时间运行的应用程序在访问安全服务时可以不中断地运行。它必须联系所有配置的安全服务,以获取要分发给应用程序其余部分的委托令牌。
1.24 创建blobCacheService传入workingDirectory.getBlobStorageDirectory(),haServices.createBlobStore(),InetSocketAddress的地址。
BlobCacheService:存储为永久或临时BLOB,并提供对BLOB服务的访问
1.25 startTaskManagers()启动TaskManager服务
1.26 resourceManagerLeaderRetriever,从高可用服务中获取资源管理领导者(选举和获取领导者),在后续启动
1.27 dispatcherLeaderRetriever,从高可用服务中获取调度领导者(选举和获取领导者),在后续启动
1.28 clusterRestEndpointLeaderRetrievalService,从高可用服务中获取集群空闲站点领导者服务(选举和获取领导者),在后续启动

public void start() throws Exception {synchronized (lock) {checkState(!running, "MiniCluster is already running");LOG.info("Starting Flink Mini Cluster");LOG.debug("Using configuration {}", miniClusterConfiguration);final Configuration configuration = miniClusterConfiguration.getConfiguration();final boolean useSingleRpcService =miniClusterConfiguration.getRpcServiceSharing() == RpcServiceSharing.SHARED;try {//管理进程或实例的工作目录workingDirectory =WorkingDirectory.create(ClusterEntrypointUtils.generateWorkingDirectoryFile(configuration,Optional.of(PROCESS_WORKING_DIR_BASE),"minicluster_" + ResourceID.generate()));initializeIOFormatClasses(configuration);rpcSystem = rpcSystemSupplier.get();LOG.info("Starting Metrics Registry");//跟踪所有已注册的指标,是MetricGroups和MetricReporters之间的连接metricRegistry =createMetricRegistry(configuration,rpcSystem.deref().getMaximumMessageSizeInBytes(configuration));// bring up all the RPC servicesLOG.info("Starting RPC Service(s)");final RpcServiceFactory dispatcherResourceManagerComponentRpcServiceFactory;final RpcService metricQueryServiceRpcService;if (useSingleRpcService) {// we always need the 'commonRpcService' for auxiliary calls//rpc服务用于启动并连接到RpcEndpoint。连接到rpc服务器将返回一个RpcGateway,可用于调用远程过程commonRpcService = createLocalRpcService(configuration, rpcSystem.deref());final CommonRpcServiceFactory commonRpcServiceFactory =new CommonRpcServiceFactory(commonRpcService);taskManagerRpcServiceFactory = commonRpcServiceFactory;dispatcherResourceManagerComponentRpcServiceFactory = commonRpcServiceFactory;metricQueryServiceRpcService =MetricUtils.startLocalMetricsRpcService(configuration, rpcSystem.deref());} else {// start a new service per component, possibly with custom bind addressesfinal String jobManagerExternalAddress =miniClusterConfiguration.getJobManagerExternalAddress();final String taskManagerExternalAddress =miniClusterConfiguration.getTaskManagerExternalAddress();final String jobManagerExternalPortRange =miniClusterConfiguration.getJobManagerExternalPortRange();final String taskManagerExternalPortRange =miniClusterConfiguration.getTaskManagerExternalPortRange();final String jobManagerBindAddress =miniClusterConfiguration.getJobManagerBindAddress();final String taskManagerBindAddress =miniClusterConfiguration.getTaskManagerBindAddress();dispatcherResourceManagerComponentRpcServiceFactory =new DedicatedRpcServiceFactory(configuration,jobManagerExternalAddress,jobManagerExternalPortRange,jobManagerBindAddress,rpcSystem.deref());taskManagerRpcServiceFactory =new DedicatedRpcServiceFactory(configuration,taskManagerExternalAddress,taskManagerExternalPortRange,taskManagerBindAddress,rpcSystem.deref());// we always need the 'commonRpcService' for auxiliary calls// bind to the JobManager address with port 0commonRpcService =createRemoteRpcService(configuration, jobManagerBindAddress, 0, rpcSystem.deref());metricQueryServiceRpcService =MetricUtils.startRemoteMetricsRpcService(configuration,commonRpcService.getAddress(),null,rpcSystem.deref());}metricRegistry.startQueryService(metricQueryServiceRpcService, null);processMetricGroup =MetricUtils.instantiateProcessMetricGroup(metricRegistry,RpcUtils.getHostname(commonRpcService),ConfigurationUtils.getSystemResourceMetricsProbingInterval(configuration));//创建线程池,执行对应的任务ioExecutor =Executors.newFixedThreadPool(ClusterEntrypointUtils.getPoolSize(configuration),new ExecutorThreadFactory("mini-cluster-io"));//高可用服务工厂haServicesFactory = createHighAvailabilityServicesFactory(configuration);//高可用服务haServices = createHighAvailabilityServices(configuration, ioExecutor);//BLOB(二进制大对象)存储服务创建并启用blobServer =BlobUtils.createBlobServer(configuration,Reference.borrowed(workingDirectory.getBlobStorageDirectory()),haServices.createBlobStore());blobServer.start();//监控所有服务心跳检测heartbeatServices = HeartbeatServices.fromConfiguration(configuration);//代理Tokne管理器delegationTokenManager =KerberosDelegationTokenManagerFactory.create(getClass().getClassLoader(),configuration,commonRpcService.getScheduledExecutor(),ioExecutor);//BLOB缓存服务:提供永久和临时的存储,并提供对BLOB服务的访问blobCacheService =BlobUtils.createBlobCacheService(configuration,Reference.borrowed(workingDirectory.getBlobStorageDirectory()),haServices.createBlobStore(),new InetSocketAddress(InetAddress.getLocalHost(), blobServer.getPort()));startTaskManagers();MetricQueryServiceRetriever metricQueryServiceRetriever =new RpcMetricQueryServiceRetriever(metricRegistry.getMetricQueryServiceRpcService());setupDispatcherResourceManagerComponents(configuration,dispatcherResourceManagerComponentRpcServiceFactory,metricQueryServiceRetriever);//从高可用服务中获取资源管理领导者(选举和获取领导者)resourceManagerLeaderRetriever = haServices.getResourceManagerLeaderRetriever();//从高可用服务中获取调度领导者(选举和获取领导者)dispatcherLeaderRetriever = haServices.getDispatcherLeaderRetriever();//从高可用服务中获取集群空闲站点领导者服务(选举和获取领导者)clusterRestEndpointLeaderRetrievalService =haServices.getClusterRestEndpointLeaderRetriever();//创建调度网关回收器dispatcherGatewayRetriever =new RpcGatewayRetriever<>(commonRpcService,DispatcherGateway.class,DispatcherId::fromUuid,new ExponentialBackoffRetryStrategy(21, Duration.ofMillis(5L), Duration.ofMillis(20L)));//创建资源管理网关回收器resourceManagerGatewayRetriever =new RpcGatewayRetriever<>(commonRpcService,ResourceManagerGateway.class,ResourceManagerId::fromUuid,new ExponentialBackoffRetryStrategy(21, Duration.ofMillis(5L), Duration.ofMillis(20L)));webMonitorLeaderRetriever = new LeaderRetriever();//资源管理领导者启用resourceManagerLeaderRetriever.start(resourceManagerGatewayRetriever);//调度领导者启用          dispatcherLeaderRetriever.start(dispatcherGatewayRetriever);//集群空闲站点领导者启用      clusterRestEndpointLeaderRetrievalService.start(webMonitorLeaderRetriever);} catch (Exception e) {// cleanup everythingtry {close();} catch (Exception ee) {e.addSuppressed(ee);}throw e;}// create a new termination futureterminationFuture = new CompletableFuture<>();// now officially mark this as runningrunning = true;LOG.info("Flink Mini Cluster started successfully");}
}

TaskManager


MiniCluster中的start(),调用下列方法

  1. 根据配置的TaskManager的个数启动,默认是1。
  2. 创建TaskExecutor注入RpcService(任务管理Rcp服务),haServices(高可用服务), heartbeatServices(心跳检测服务),metricRegistry(metric注册),blobCacheService(BLOB缓存服务),workingDirectory(工作目录),fatalErrorHandler(失败异常)。
  3. 启动TaskExecutor,并添加到taskManagers数组中。
 private void startTaskManagers() throws Exception {final int numTaskManagers = miniClusterConfiguration.getNumTaskManagers();for (int i = 0; i < numTaskManagers; i++) {startTaskManager();}
}public void startTaskManager() throws Exception {synchronized (lock) {final Configuration configuration = miniClusterConfiguration.getConfiguration();final TaskExecutor taskExecutor =TaskManagerRunner.startTaskManager(configuration,new ResourceID(UUID.randomUUID().toString()),taskManagerRpcServiceFactory.createRpcService(),haServices,heartbeatServices,metricRegistry,blobCacheService,useLocalCommunication(),ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES,workingDirectory.createSubWorkingDirectory("tm_" + taskManagers.size()),taskManagerTerminatingFatalErrorHandlerFactory.create(taskManagers.size()));taskExecutor.start();taskManagers.add(taskExecutor);}
}

TaskExecutor


任务执行器,负责多个Task任务执行。

提交Task(submitTask)

@Override
public CompletableFuture<Acknowledge> submitTask(TaskDeploymentDescriptor tdd, JobMasterId jobMasterId, Time timeout) {try {final JobID jobId = tdd.getJobId();final ExecutionAttemptID executionAttemptID = tdd.getExecutionAttemptId();final JobTable.Connection jobManagerConnection =jobTable.getConnection(jobId).orElseThrow(() -> {final String message ="Could not submit task because there is no JobManager "+ "associated for the job "+ jobId+ '.';log.debug(message);return new TaskSubmissionException(message);});if (!Objects.equals(jobManagerConnection.getJobMasterId(), jobMasterId)) {final String message ="Rejecting the task submission because the job manager leader id "+ jobMasterId+ " does not match the expected job manager leader id "+ jobManagerConnection.getJobMasterId()+ '.';log.debug(message);throw new TaskSubmissionException(message);}if (!taskSlotTable.tryMarkSlotActive(jobId, tdd.getAllocationId())) {final String message ="No task slot allocated for job ID "+ jobId+ " and allocation ID "+ tdd.getAllocationId()+ '.';log.debug(message);throw new TaskSubmissionException(message);}// re-integrate offloaded data:try {tdd.loadBigData(taskExecutorBlobService.getPermanentBlobService());} catch (IOException | ClassNotFoundException e) {throw new TaskSubmissionException("Could not re-integrate offloaded TaskDeploymentDescriptor data.", e);}// deserialize the pre-serialized informationfinal JobInformation jobInformation;final TaskInformation taskInformation;try {jobInformation =tdd.getSerializedJobInformation().deserializeValue(getClass().getClassLoader());taskInformation =tdd.getSerializedTaskInformation().deserializeValue(getClass().getClassLoader());} catch (IOException | ClassNotFoundException e) {throw new TaskSubmissionException("Could not deserialize the job or task information.", e);}if (!jobId.equals(jobInformation.getJobId())) {throw new TaskSubmissionException("Inconsistent job ID information inside TaskDeploymentDescriptor ("+ tdd.getJobId()+ " vs. "+ jobInformation.getJobId()+ ")");}TaskManagerJobMetricGroup jobGroup =taskManagerMetricGroup.addJob(jobInformation.getJobId(), jobInformation.getJobName());// note that a pre-existing job group can NOT be closed concurrently - this is done by// the same TM thread in removeJobMetricsGroupTaskMetricGroup taskMetricGroup =jobGroup.addTask(tdd.getExecutionAttemptId(), taskInformation.getTaskName());InputSplitProvider inputSplitProvider =new RpcInputSplitProvider(jobManagerConnection.getJobManagerGateway(),taskInformation.getJobVertexId(),tdd.getExecutionAttemptId(),taskManagerConfiguration.getRpcTimeout());final TaskOperatorEventGateway taskOperatorEventGateway =new RpcTaskOperatorEventGateway(jobManagerConnection.getJobManagerGateway(),executionAttemptID,(t) -> runAsync(() -> failTask(executionAttemptID, t)));TaskManagerActions taskManagerActions = jobManagerConnection.getTaskManagerActions();CheckpointResponder checkpointResponder = jobManagerConnection.getCheckpointResponder();GlobalAggregateManager aggregateManager =jobManagerConnection.getGlobalAggregateManager();LibraryCacheManager.ClassLoaderHandle classLoaderHandle =jobManagerConnection.getClassLoaderHandle();PartitionProducerStateChecker partitionStateChecker =jobManagerConnection.getPartitionStateChecker();final TaskLocalStateStore localStateStore =localStateStoresManager.localStateStoreForSubtask(jobId,tdd.getAllocationId(),taskInformation.getJobVertexId(),tdd.getSubtaskIndex(),taskManagerConfiguration.getConfiguration(),jobInformation.getJobConfiguration());// TODO: Pass config value from user program and do overriding here.final StateChangelogStorage<?> changelogStorage;try {changelogStorage =changelogStoragesManager.stateChangelogStorageForJob(jobId,taskManagerConfiguration.getConfiguration(),jobGroup,localStateStore.getLocalRecoveryConfig());} catch (IOException e) {throw new TaskSubmissionException(e);}final JobManagerTaskRestore taskRestore = tdd.getTaskRestore();final TaskStateManager taskStateManager =new TaskStateManagerImpl(jobId,tdd.getExecutionAttemptId(),localStateStore,changelogStorage,changelogStoragesManager,taskRestore,checkpointResponder);MemoryManager memoryManager;try {memoryManager = taskSlotTable.getTaskMemoryManager(tdd.getAllocationId());} catch (SlotNotFoundException e) {throw new TaskSubmissionException("Could not submit task.", e);}Task task =new Task(jobInformation,taskInformation,tdd.getExecutionAttemptId(),tdd.getAllocationId(),tdd.getProducedPartitions(),tdd.getInputGates(),memoryManager,taskExecutorServices.getIOManager(),taskExecutorServices.getShuffleEnvironment(),taskExecutorServices.getKvStateService(),taskExecutorServices.getBroadcastVariableManager(),taskExecutorServices.getTaskEventDispatcher(),externalResourceInfoProvider,taskStateManager,taskManagerActions,inputSplitProvider,checkpointResponder,taskOperatorEventGateway,aggregateManager,classLoaderHandle,fileCache,taskManagerConfiguration,taskMetricGroup,partitionStateChecker,getRpcService().getScheduledExecutor());taskMetricGroup.gauge(MetricNames.IS_BACK_PRESSURED, task::isBackPressured);log.info("Received task {} ({}), deploy into slot with allocation id {}.",task.getTaskInfo().getTaskNameWithSubtasks(),tdd.getExecutionAttemptId(),tdd.getAllocationId());boolean taskAdded;try {taskAdded = taskSlotTable.addTask(task);} catch (SlotNotFoundException | SlotNotActiveException e) {throw new TaskSubmissionException("Could not submit task.", e);}if (taskAdded) {task.startTaskThread();setupResultPartitionBookkeeping(tdd.getJobId(), tdd.getProducedPartitions(), task.getTerminationFuture());return CompletableFuture.completedFuture(Acknowledge.get());} else {final String message ="TaskManager already contains a task for id " + task.getExecutionId() + '.';log.debug(message);throw new TaskSubmissionException(message);}} catch (TaskSubmissionException e) {return FutureUtils.completedExceptionally(e);}
}

StreamGraph

生成执行图

二、使用步骤

1.引入库

代码如下(示例):

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
import  ssl
ssl._create_default_https_context = ssl._create_unverified_context

2.读入数据

代码如下(示例):

data = pd.read_csv('https://labfile.oss.aliyuncs.com/courses/1283/adult.data.csv')
print(data.head())

该处使用的url网络请求的数据。


总结

提示:这里对文章进行总结:

例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。

相关文章:

Flink启动任务

Flink 以本地运行作为解读&#xff0c;版本1.16.0 文章目录 Flink前言StreamExecutionEnvironmentLocalExecutorMiniCluster启动MiniCluster TaskManagerTaskExecutor提交Task(submitTask) StreamGraph二、使用步骤1.引入库2.读入数据 总结 前言 提示&#xff1a;这里可以添加…...

「低延迟+快速集成:Amazon IVS如何重塑实时互动视频体验?」

引言&#xff1a;实时视频的爆发与开发痛点 随着直播电商、在线教育、云游戏的兴起&#xff0c;实时视频互动成为用户体验的核心。但自建视频服务面临高成本、高延迟、运维复杂等挑战。Amazon IVS&#xff08;Interactive Video Service&#xff09;作为亚马逊云科技推出的全托…...

Web开发-JS应用NodeJS原型链污染文件系统Express模块数据库通讯

知识点&#xff1a; 1、安全开发-NodeJS-开发环境&功能实现 2、安全开发-NodeJS-安全漏洞&案例分析 3、安全开发-NodeJS-特有漏洞 node.js就是专门运行javascript的一个应用程序&#xff0c;区别于以往用浏览器解析原生js代码&#xff0c;node.js本身就可以解析执行js代…...

描述@keyframes规则在 CSS 动画中的原理及作用,如何创建一个简单的动画

大白话描述keyframes规则在 CSS 动画中的原理及作用&#xff0c;如何创建一个简单的动画&#xff1f; 嘿&#xff0c;朋友&#xff01;咱来聊聊 CSS 里超酷的 keyframes 规则。这玩意儿就像是动画的剧本&#xff0c;能让网页元素动起来&#xff0c;就像给它们施了魔法一样&…...

国产达梦(DM)数据库的安装(Linux系统)

目录 一、安装前的准备工作 1.1 导包 1.2 创建用户和组 1.3 修改文件打开最大数 1.4 目录规划 1.5 修改目录权限 二、安装DM8 2.1 挂载镜像 2.2 命令行安装 2.3 配置环境变量 2.4 启动图形化界面 三、配置实例 四、注册服务 五、启动 停止 查看状态 六、数据库客…...

AI日报 - 2025年3月24日

&#x1f31f; 今日概览&#xff08;60秒速览&#xff09; ▎&#x1f916; AGI突破 | Lyra生物序列建模架构效率惊人 在100生物任务中达最优&#xff0c;推理速度提升高达12万倍 ▎&#x1f4bc; 商业动向 | OpenAI用户破4亿&#xff0c;Meta与Reliance探讨AI合作 生态扩展与全…...

git的底层原理

git的底层原理 三段话总结git&#xff0c; 1. 工作原理&#xff1a;git管理是一个DAG有向无环图&#xff0c;HEAD指针指向branch或直接指向commit&#xff0c;branch指向commit&#xff0c;commit指向tree&#xff0c;tree指向别的tree或直接指向blob。 2. git所管理的一个目录…...

【Spring】Spring框架介绍

在 Java 企业级应用开发领域&#xff0c;Spring 框架凭借强大功能、高度灵活性与卓越扩展性&#xff0c;成为众多开发者构建大型应用系统的首选。接下来为大家深入剖析 Spring 框架的核心特性、架构设计及实际项目应用。​ 一、Spring 框架简介​ Spring 框架由 Rod Johnson …...

MATLAB+Arduino利用板上的按键控制板上Led灯

几年不使用&#xff0c;之前的知识都忘掉了。需要逐步捡起来。 1 熟悉按键的使用 2熟悉灯的控制 1 电路 我们将通过 MATLAB 的 Arduino 支持包与 Arduino 板通信&#xff0c;读取按键状态并控制 LED 灯的亮灭。 按键&#xff1a;连接到 Arduino 的数字引脚&#xff08;例如…...

AI比人脑更强,因为被植入思维模型【21】冯诺依曼思维模型

定义 冯诺依曼思维模型是一种基于数理逻辑和系统分析的思维方式&#xff0c;它将复杂的问题或系统分解为若干个基本的组成部分&#xff0c;通过建立数学模型和逻辑规则来描述和分析这些部分之间的关系&#xff0c;进而实现对整个系统的理解和优化。该模型强调从整体到局部、再…...

【QA】Qt中有哪些命令模式的运用?

在 C/Qt 中&#xff0c;命令模式&#xff08;Command Pattern&#xff09;的实现通常用于封装操作请求、支持撤销/重做&#xff08;Undo/Redo&#xff09;或解耦调用者与接收者。以下是几种常见的实现方式及示例&#xff1a; 1. Qt 的 QUndoCommand 和 QUndoStack&#xff08;内…...

【连续自然数的和,双指针找区间】

对一个给定的正整数 MM&#xff0c;求出所有的连续的正整数段&#xff08;每一段至少有两个数&#xff09;&#xff0c;这些连续的自然数段中的全部数之和为 MM。 例子&#xff1a;19981999200020012002100001998199920002001200210000&#xff0c;所以从 19981998 到 2002200…...

Cocos Creator Shader入门实战(五):材质的了解、使用和动态构建

引擎&#xff1a;3.8.5 您好&#xff0c;我是鹤九日&#xff01; 回顾 前面的几篇文章&#xff0c;讲述的主要是Cocos引擎对Shader使用的一些固定规则&#xff0c;这里汇总下&#xff1a; 一、Shader实现基础是OpenGL ES可编程渲染管线&#xff0c;开发者只需关注顶点着色器和…...

vue设置自定义logo跟标题

准备 Logo 图片 将自定义的 Logo 图片&#xff08;如 logo.png&#xff09;放置在项目的 public文件夹下。 使用环境变量设置 Logo 和标题&#xff08;可选&#xff09; 创建或修改 .env 文件 在项目根目录下创建或修改 .env 文件&#xff0c;添加以下内容&#xff1a; VITE_A…...

Linux 账号和权限管理命令选项解释

用户账号文件 配置文件 /etc/passwd&#xff1a;用于保存用户 输出如下&#xff1a; root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin 每一行代表一个用户&…...

尝试在软考65天前开始成为软件设计师-计算机网络

OSI/RM 七层模型 层次名功能主要协议7应用层实现具体应用功能 FTP(文件传输)、HTTP、Telnet、 POP3(邮件)SMTP(邮件) ------- DHCP、TFTP(小文件)、 SNMP、 DNS(域名) 6表示层数据格式,加密,压缩.....5会话层建立,管理&终止对话4传输层端到端连接TCP,UDP3网络层分组传输&a…...

VMware主机换到高配电脑,高版本系统的问题

原来主机是i3 ,windows7系统&#xff0c;vmware 14.0,虚机系统是ubuntu 14.04。目标新机是i7 14700KF,windows11系统。原以为安装虚拟机&#xff0c;将磁盘文件&#xff0c;虚拟机配置文件拷贝过去可以直接用。 新目标主机先安装了vmware 15&#xff0c;运行原理虚机&#xff0…...

2025年3月 CCF GESP C++ 二级 真题解析

1. 单选题(每题2分&#xff0c;共30分) 第1题 试题&#xff1a;2025年春节有两件轰动全球的事件&#xff0c;一个是DeepSeek横空出世&#xff0c;另一个是贺岁片《哪吒2》票房惊人&#xff0c;入了全球票房榜。下面关于DeepSeek与《哪吒2》的描述成立的是( )。 A. 《哪吒2》是一…...

Nginx请求头Hos头攻击

HTTP请求头中的Host字段用于指定客户端请求的目标主机名&#xff08;域名/IP&#xff09;。当Nginx作为反向代理时&#xff0c;可利用该字段进行访问控制&#xff0c;防止非法域名或IP直接访问服务。 解决方法&#xff1a;添加判断请求头&#xff0c;如果不是指定请求头&#…...

2025年03月10日人慧前端面试(外包滴滴)

目录 普通函数和箭头函数的区别loader 和 plugin 的区别webpack 怎么实现分包&#xff0c;为什么要分包webpack 的构建流程变量提升react 开发中遇到过什么问题什么是闭包vue 开发中遇到过什么问题vue中的 dep 和 watcher 的依赖收集是什么阶段什么是原型链react setState 是同…...

【Linux内核系列】:动静态库详解

&#x1f525; 本文专栏&#xff1a;Linux &#x1f338;作者主页&#xff1a;努力努力再努力wz &#x1f4aa; 今日博客励志语录&#xff1a; 有些鸟儿是注定是关不住的&#xff0c;因为它们的每一片羽翼都沾满了自由的光辉 ★★★ 本文前置知识&#xff1a; 编译与链接的过程…...

maptalks图层交互 - 模拟 Tooltip

maptalks图层交互 - 模拟 Tooltip 图层交互-模拟tooltip官方文档 <!DOCTYPE html> <html><meta charsetUTF-8 /><meta nameviewport contentwidthdevice-width, initial-scale1 /><title>图层交互 - 模拟 Tooltip</title><style typet…...

windows环境下NER Python项目环境配置(内含真的从头安的perl配置)

注意 本文是基于完整项目的环境配置&#xff0c;即本身可运行项目你拿来用 其中有一些其他问题&#xff0c;知道的忽略即可 导入pycharm基本包怎么下就不说了&#xff08;这个都问&#xff1f;给你一拳o(&#xff40;ω*)o&#xff09; 看perl跳转第5条 1.predict报错多个设备…...

IDEA批量替换项目下所有文件中的特定内容

文章目录 1. 问题引入2. 批量替换项目下所有文件中的特定内容2.1 右键项目的根目录&#xff0c;点击在文件中替换2.2 输入要替换的内容 3. 解决替换一整行文本后出现空行的问题4. 增加筛选条件提高匹配的精确度 更多 IDEA 的使用技巧可以查看 IDEA 专栏&#xff1a; IDEA 1. 问…...

【计算机网络】网络编程

文章目录 1. 客户端/服务器2. TCP/UDP协议3. 网络编程套接字-socket3.1 API的使用3.1 DatagramScoket类3.1 DatagramScoket类 4. 通过UDP实现回显服务器程序4.1 服务器代码4.2 客户端代码4.3 代码执行过程4.4 通过UDP实现翻译客户端 5. 通过TCP实现回显服务器5.1 服务器代码5.2…...

Django 中@login_required 配置详解

在 Django 中对 login_required 进行配置&#xff0c;主要涉及全局配置和视图函数局部配置两方面&#xff0c;下面为你详细介绍配置方法。 全局配置 全局配置主要是设定默认的登录 URL&#xff0c;也就是当未登录用户尝试访问被 login_required 装饰的视图时&#xff0c;会被…...

【408--复习笔记】数据结构

【408--复习笔记】数据结构 1.绪论2.线性表3.栈、队列、数组4.串5.树与二叉树6.图7.查找8.排序 1.绪论 2.线性表 3.栈、队列、数组 4.串 5.树与二叉树 6.图 7.查找 8.排序...

Android <queries>声明的作用和配置方法

在Android应用中使用resolveActivity方法会提示在清单文件中添加标签&#xff0c;下面我们就看下声明的作用和配置方法&#xff1a; 一、queries 声明的作用 在Android 11及更高版本中&#xff0c;声明被引入以控制应用之间的交互。通过在AndroidManifest.xml中添加标签&…...

C++多线程编程:从创建到管理的终极指南

在高性能计算时代,掌握多线程编程是提升程序效率的必修课!本文将手把手教你如何用C++11标准库轻松创建和管理线程,告别单线程的“龟速”,让代码跑出多核CPU的性能! 一、多线程为何重要? 充分利用多核CPU:现代计算机普遍支持多核并行,多线程可让程序性能指数级提升。提升…...

【蓝桥杯】4535勇闯魔堡(多源BFS + 二分)

思路 k有一个范围&#xff08;0到怪物攻击的最大值&#xff09;&#xff0c;求满足要求的k的最小值。很明显的二分套路。 关键是check函数怎么写&#xff0c;我们需要找到一条从第一行到最后一行的路径&#xff0c;每一次可以从上下左右四个方向前进&#xff0c;那么我么可以用…...