首页 文章 精选 留言 我的

精选列表

搜索[加密工具],共10000篇文章
优秀的个人博客,低调大师

[Spark]Spark 应用程序部署工具spark-submit

1. 简介 Spark的bin目录中的spark-submit脚本用于启动集群上的应用程序。 可以通过统一的接口使用Spark所有支持的集群管理器,因此不必为每个集群管理器专门配置你的应用程序(It can use all of Spark’s supported cluster managers through a uniform interface so you don’t have to configure your application specially for each one)。 2. 语法 xiaosi@yoona:~/opt/spark-2.1.0-bin-hadoop2.7$ spark-submit --help Usage: spark-submit [options] <app jar | python file> [app arguments] Usage: spark-submit --kill [submission ID] --master [spark://...] Usage: spark-submit --status [submission ID] --master [spark://...] Usage: spark-submit run-example [options] example-class [example args] Options: --master MASTER_URL spark://host:port, mesos://host:port, yarn, or local. --deploy-mode DEPLOY_MODE Whether to launch the driver program locally ("client") or on one of the worker machines inside the cluster ("cluster") (Default: client). --class CLASS_NAME Your application's main class (for Java / Scala apps). --name NAME A name of your application. --jars JARS Comma-separated list of local jars to include on the driver and executor classpaths. --packages Comma-separated list of maven coordinates of jars to include on the driver and executor classpaths. Will search the local maven repo, then maven central and any additional remote repositories given by --repositories. The format for the coordinates should be groupId:artifactId:version. --exclude-packages Comma-separated list of groupId:artifactId, to exclude while resolving the dependencies provided in --packages to avoid dependency conflicts. --repositories Comma-separated list of additional remote repositories to search for the maven coordinates given with --packages. --py-files PY_FILES Comma-separated list of .zip, .egg, or .py files to place on the PYTHONPATH for Python apps. --files FILES Comma-separated list of files to be placed in the working directory of each executor. --conf PROP=VALUE Arbitrary Spark configuration property. --properties-file FILE Path to a file from which to load extra properties. If not specified, this will look for conf/spark-defaults.conf. --driver-memory MEM Memory for driver (e.g. 1000M, 2G) (Default: 1024M). --driver-java-options Extra Java options to pass to the driver. --driver-library-path Extra library path entries to pass to the driver. --driver-class-path Extra class path entries to pass to the driver. Note that jars added with --jars are automatically included in the classpath. --executor-memory MEM Memory per executor (e.g. 1000M, 2G) (Default: 1G). --proxy-user NAME User to impersonate when submitting the application. This argument does not work with --principal / --keytab. --help, -h Show this help message and exit. --verbose, -v Print additional debug output. --version, Print the version of current Spark. Spark standalone with cluster deploy mode only: --driver-cores NUM Cores for driver (Default: 1). Spark standalone or Mesos with cluster deploy mode only: --supervise If given, restarts the driver on failure. --kill SUBMISSION_ID If given, kills the driver specified. --status SUBMISSION_ID If given, requests the status of the driver specified. Spark standalone and Mesos only: --total-executor-cores NUM Total cores for all executors. Spark standalone and YARN only: --executor-cores NUM Number of cores per executor. (Default: 1 in YARN mode, or all available cores on the worker in standalone mode) YARN-only: --driver-cores NUM Number of cores used by the driver, only in cluster mode (Default: 1). --queue QUEUE_NAME The YARN queue to submit to (Default: "default"). --num-executors NUM Number of executors to launch (Default: 2). If dynamic allocation is enabled, the initial number of executors will be at least NUM. --archives ARCHIVES Comma separated list of archives to be extracted into the working directory of each executor. --principal PRINCIPAL Principal to be used to login to KDC, while running on secure HDFS. --keytab KEYTAB The full path to the file that contains the keytab for the principal specified above. This keytab will be copied to the node running the Application Master via the Secure Distributed Cache, for renewing the login tickets and the delegation tokens periodically. 3. 捆绑应用程序的依赖关系 如果你的代码依赖于其他项目,则需要将它们与应用程序一起打包,以便将代码分发到Spark集群上。为此,请创建一个包含代码及其依赖关系的程序集jar(或 Uber jar)。sbt和Maven都有装配插件。创建jar时,将Spark和Hadoop列出作为需要提供的依赖关系; 这些不需要捆绑,因为它们在运行时由集群管理器提供。一旦你有一个jar,你可以调用bin/ spark-submit脚本,如下所示,同时传递你的jar作为参数。 对于Python,您可以使用spark-submit的--py-files参数来添加.py,.zip或.egg文件以与应用程序一起分发。如果你依赖于多个Python文件,我们建议将它们打包成一个.zip或.egg文件。 4. 使用spark-submit启动应用程序 一旦用户应用程序打包成功后,可以使用bin/spark-submit脚本启动应用程序。此脚本负责设置Spark的 classpath 及其依赖关系,并且可以支持不同集群管理器和部署模式(Spark所支持的): ./bin/spark-submit \ --class <main-class> \ --master <master-url> \ --deploy-mode <deploy-mode> \ --conf <key>=<value> \ ... # other options <application-jar> \ [application-arguments] 一些常用的选项: --class 应用程序入口 (例如:com.sjf.open.spark.Java.JavaWordCount 包含包名的全路径名称) --master 集群的主URL (例如:spark://23.195.26.187:7077) --deploy-mode 部署driver运行的地方,client或者cluster application-jar 包含应用程序和所有依赖关系的jar路径。 URL必须在集群内部全局可见,例如,所有节点上存在的hdfs://路径或file://路径。 application-arguments 传递给主类main方法的参数(如果有的话) 如果你提交应用程序的机器远离工作节点机器(例如在笔记本电脑本地提交),则通常使用集群模式来最小化drivers和executors之间的网络延迟。 目前,对于Python应用程序而言,在独立模式上不支持集群模式。 对于Python应用程序,只需在<application-jar>位置传递一个.py文件来代替JAR,然后使用--py-files参数ca将Python .zip,.egg或.py文件添加到搜索路径。 有几个可用选项是特定用于集群管理器。例如,对于具有集群部署模式的Spark独立集群,可以指定--supervise参数以确保如果driver以非零退出而失败,则自动重新启动。如果要列举spark-submit所有可用选项,可以使用spark-submit --help命令来查看。以下是常见选项的几个示例: # 在本地运行 8 核 ./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master local[8] \ /path/to/examples.jar \ 100 # 以客户端部署模式在Spark独立集群上运行 ./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master spark://207.184.161.138:7077 \ --executor-memory 20G \ --total-executor-cores 100 \ /path/to/examples.jar \ 1000 # 在集群部署模式下使用supervise在Spark独立集群上运行 ./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master spark://207.184.161.138:7077 \ --deploy-mode cluster \ --supervise \ --executor-memory 20G \ --total-executor-cores 100 \ /path/to/examples.jar \ 1000 # 在 YARN 集群上运行 export HADOOP_CONF_DIR=XXX ./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master yarn \ --deploy-mode cluster \ # can be client for client mode --executor-memory 20G \ --num-executors 50 \ /path/to/examples.jar \ 1000 # 在 Spark 独立集群上运行Python程序 ./bin/spark-submit \ --master spark://207.184.161.138:7077 \ examples/src/main/python/pi.py \ 1000 # 在集群部署模式下使用supervise在Mesos集群上运行 ./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master mesos://207.184.161.138:7077 \ --deploy-mode cluster \ --supervise \ --executor-memory 20G \ --total-executor-cores 100 \ http://path/to/examples.jar \ 1000 5. Master Urls 传递给Spark的master url 可以采用如下格式: Master URL 描述 local 使用一个工作线程本地运行Spark local[K] 使用K个工作线程在本地运行Spark(理想情况下,将其设置为机器上的核数)。 local[*] 使用与计算机上的逻辑核数一样多的工作线程在本地运行Spark。 spark://HOST:PORT 连接到给定的Spark独立集群主机。 端口必须是主机配置可使用的端口,默认情况下为7077。 mesos://HOST:PORT 连接到给定的Mesos集群。 端口必须是主机配置可使用的端口,默认为5050。 或者,对于使用ZooKeeper的Mesos集群,请使用mesos://zk:// .... 要使用--deploy-mode cluster 提交。 yarn 以客户端模式还是以集群模式连接到YARN群集具体取决于--deploy-mode的值。 可以根据HADOOP_CONF_DIR或YARN_CONF_DIR变量找到集群位置 6. 从文件加载配置 spark-submit脚本可以从properties文件加载默认Spark配置选项,并将它们传递到应用程序。默认情况下,spark 从spark目录下的conf/spark-defaults.conf配置文件中读取配置选项。有关更多详细信息,请阅读加载默认配置。 以这种方式加载默认Spark配置可以避免在spark-submit上添加配置选项。例如,如果默认配置文件中设置了spark.master属性,则可以安全地从spark-submit中省略--master参数。一般来说,在SparkConf上显式设置的配置选项拥有最高优先级,然后是传递到spark-submit的配置选项,然后是默认配置文件中的配置选项。 如果不清楚配置选项来自哪里,可以通过使用--verbose选项运行spark-submit打印出细粒度的调试信息。 7. 高级依赖管理 使用spark-submit时,应用程序jar以及包含在-jars选项中的jar将自动传输到集群。在--jars之后提供的URL列表必须用逗号分隔。 该列表会包含在driver和 executor 的classpath中。 目录扩展不能与--jars一起使用。 Spark使用如下URL方案以不同策略传播传送jar: file : 绝对路径和file:/ URI 由driver 的HTTP文件服务器提供,每个executor从driver HTTP服务器拉取文件。 hdfs :, http :, https :, ftp: 正如你希望的一样,这些从URI拉取文件和JAR local: 以local:/开头的URI应该作为每个工作节点上的本地文件存在。 这意味着不会产生网络IO,适用于推送大文件/ JAR到每个工作线程或通过NFS,GlusterFS等方式共享这些大文件/jar。 请注意,JAR和文件被复制到执行器节点上每个SparkContext的工作目录(Note that JARs and files are copied to the working directory for each SparkContext on the executor nodes)。随着时间的推移,这可能会占用大量的空间,需要定时清理。使用YARN,清理会自动执行;使用Spark独立集群,可以使用spark.worker.cleanup.appDataTtl属性配置自动清理。 用户还可以通过用--packages提供逗号分隔的maven坐标列表来包含任何其他依赖项。使用此命令时将处理所有传递依赖性。可以使用配置选项--repositories以逗号分隔的方式添加其他存储库(或SBT中的解析器)。pyspark,spark-shell和spark-submit都可以使用这些命令来包含Spark Packages。 对于Python,等价的--py-files选项可用于将.egg,.zip和.py库分发给执行程序。

优秀的个人博客,低调大师

企业级的开源备份工具Bacula之安装

一、Bacula简介 Bacula是一款开源的跨平台企业级备份软件。它采用C/S架构,可以实现对数据备份、恢复及校验;支持完全备份、增量备份和差异备份;支持多种操作系统和文件系统(例如windows和linux系统);支持定时备份,无需人工干预;支持终端命令控制,更加灵活;支持正则表达式,可以对备份文件进行更严格的匹配;支持MD5和SHA1签名校验;支持压缩备份和断点续传功能。 1.1Bacula的组成 Bacula主要由以下六部份组成: BaculaDirector: 全局设置。负责备份的验证、运行、计划任务、备份和恢复的各种定义和执行操作。配置文件是bacula-dir.conf。以下简称主控端。 BaculaConsole: 终端管理控制台。通过该控制台连接BaculaDirector查看或执行系统的备份、恢复操作。配置文件是bconsole.conf。以下简称console端。 BaculaFile: 需要备份的机器。安装在需要备份数据的机器上的守护进程,在备份数据时,它负责把文件传出,在恢复数据时负责接收数据并执行恢复操作。配置文件为bacula-fd.conf。以下简称客户端。 BaculaStorage: 备份文件的存放介质。负责将数据备份到存储介质上,而在数据恢复时,负责将数据从存储介质中传送出去。其配置文件为bacula-sd.conf。以下简称介质端。 BaculaMonitor: 备份进程的监控。显示进程的备份或恢复时的状态信息。以下简称监控端。 Catalog:备份信息元数据。用于记录系统运行的状态信息。 1.2Bacula的恢复流程 通过上图可知,系统的恢复流程如下: 1、通过Console连接到Director端,开始恢复操作。 2、Director端从自己的Catalog中取出备份的记录信息,同时对存储端SD和客户端FD的任务进行协调。 3、客户端FD验证Director的操作许可,验证通过后连接到存储端SD。 4、客户端FD根据Director发出的请求去连接SD,将FD端的数据按恢复要求重新存储到SD端或FD端。 二、Bacula安装 2.1系统环境 CentOS7最小化安装 主机名 IP地址 系统版本 角色 bacula-test 192.168.17.100 Centos7 DIR、SD、Console 192.168.17.98 Windows10 FD 2.2系统更新 wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo yumclean yummakecache yumupdate 2.3禁用selinux vim/etc/selinux/config 2.4下载安装包 wgethttp://www.bacula.com.br/wp-content/uploads/2016/01/bacula-7.4.0.tar.gz-P/root tarzxvfbacula-7.4.0.tar.gz 2.5安装相关软件包 yuminstallgcc-c++readline-develzlib-devellzo-devellibacl-devel\ mt-stmtxpostfixlibssl-devmariadb-develmariadb-server 2.6编译安装 cdbacula ./configure--disable-conio--bindir=/usr/bin--sbindir=/usr/sbin\ --with-scriptdir=/usr/libexec/bacula/\ --with-working-dir=/var/spool/bacula/\ --with-logdir=/var/log--enable-smartalloc--with-mysql\ --with-hostname=192.168.17.100--sysconfdir=/etc/bacula--with-systemd make makeinstall makeinstall-autostart 完成后检查相关文件和目录是否存在。可以参考编译的参数查找对应的文件和目录,如下图所示。 2.7MYSQL数据库配置 数据库MariaDB通过yum的方式安装,版本是5.5.47,以下的数据库设置针对该版本,其它版本的数据库请对照修改。 vim/etc/my.cnf mysql_secure_installation mysql-uroot-p createdatabasebacula; setpasswordforbacula@'%'=password('password'); setpasswordforbacula@'localhost'=password('password'); grantallprivilegesonbacula.*to‘bacula’@’%’; grantallprivilegesonbacula.*to‘bacula’@’localhost’; selectuser,host,passwordfrommysql.user; /usr/libexec/bacula/grant_mysql_privileges-p /usr/libexec/bacula/create_mysql_database-p /usr/libexec/bacula/make_mysql_tables-p usebacula; showtables;

优秀的个人博客,低调大师

PDFsam Basic 6.0.0 发布,PDF 文档多功能处理工具

PDFsam Basic 是一款免费的、开源的、跨平台使用的 PDF 文档处理软件,可对 PDF 文件进行分割、合并、提取页面、混合和旋转等处理。 PDFsam Basic v6.0.0 现已发布,具体更新内容包括: Compression:输出压缩现在是一个 three-value 选项(Compress / Neutral / Uncompress),而不是简单的开/关切换。 将文件夹拖放到输出字段:将文件夹拖放到 PDF 输出字段中,会自动建议该文件夹内的输出文件路径。 更好地处理问题 PDF 文件:提高了读取包含格式错误的注释、无效色彩空间、损坏的字体字典、格式错误的元数据和无效的裁剪框的文件时的鲁棒性。 PDF 2.0 支持:现在可以正确读取和写入 PDF 2.0 中引入的 UTF-8 编码字符串。 合并修复:修复了目录合并中字体大小缩放不正确的问题,改进了对空目录条目的处理,并修复了处理具有某些书签结构的 PDF 时出现的卡顿问题。 辅助功能改进:在整个用户界面中添加了辅助文本、帮助文本和正确的标签与字段关联。 更新说明:https://github.com/torakiki/pdfsam/releases/tag/v6.0.0

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册