如何在Spark中关闭INFO日志记录?

我使用AWS EC2指南安装了Spark,我可以使用bin / pyspark脚本启动程序,以获得spark提示,也可以成功执行Quick Start quide.

但是,我不能为我的生活弄清楚如何在每个命令之后停止所有详细的INFO记录.

我已经在我的log4j.properties文件中的以下代码(注释掉,设置为OFF)中尝试了几乎所有可能的场景,我在启动应用程序的conf文件夹中以及每个节点上都没有做任何事情.执行每个语句后,我仍然会打印日志记录INFO语句.

我对这应该如何工作非常困惑.

#Set everything to be logged to the console log4j.rootCategory=INFO, console                                                                        
log4j.appender.console=org.apache.log4j.ConsoleAppender 
log4j.appender.console.target=System.err     
log4j.appender.console.layout=org.apache.log4j.PatternLayout 
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n

# Settings to quiet third party logs that are too verbose
log4j.logger.org.eclipse.jetty=WARN
log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO
log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO

当我使用SPARK_PRINT_LAUNCH_COMMAND时,这是我的完整类路径:

Spark Command:
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java
-cp :/root/spark-1.0.1-bin-hadoop2/conf:/root/spark-1.0.1-bin-hadoop2/conf:/root/spark-1.0.1-bin-hadoop2/lib/spark-assembly-1.0.1-hadoop2.2.0.jar:/root/spark-1.0.1-bin-hadoop2/lib/datanucleus-api-jdo-3.2.1.jar:/root/spark-1.0.1-bin-hadoop2/lib/datanucleus-core-3.2.2.jar:/root/spark-1.0.1-bin-hadoop2/lib/datanucleus-rdbms-3.2.1.jar
-XX:MaxPermSize=128m -Djava.library.path= -Xms512m -Xmx512m org.apache.spark.deploy.SparkSubmit spark-shell –class
org.apache.spark.repl.Main

spark-env.sh的内容:

#!/usr/bin/env bash

# This file is sourced when running various Spark programs.
# Copy it as spark-env.sh and edit that to configure Spark for your site.

# Options read when launching programs locally with 
# ./bin/run-example or ./bin/spark-submit
# - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
# - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
# - SPARK_PUBLIC_DNS, to set the public dns name of the driver program
# - SPARK_CLASSPATH=/root/spark-1.0.1-bin-hadoop2/conf/

# Options read by executors and drivers running inside the cluster
# - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
# - SPARK_PUBLIC_DNS, to set the public DNS name of the driver program
# - SPARK_CLASSPATH, default classpath entries to append
# - SPARK_LOCAL_DIRS, storage directories to use on this node for shuffle and RDD data
# - MESOS_NATIVE_LIBRARY, to point to your libmesos.so if you use Mesos

# Options read in YARN client mode
# - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
# - SPARK_EXECUTOR_INSTANCES, Number of workers to start (Default: 2)
# - SPARK_EXECUTOR_CORES, Number of cores for the workers (Default: 1).
# - SPARK_EXECUTOR_MEMORY, Memory per Worker (e.g. 1000M, 2G) (Default: 1G)
# - SPARK_DRIVER_MEMORY, Memory for Master (e.g. 1000M, 2G) (Default: 512 Mb)
# - SPARK_YARN_APP_NAME, The name of your application (Default: Spark)
# - SPARK_YARN_QUEUE, The hadoop queue to use for allocation requests (Default: ‘default’)
# - SPARK_YARN_DIST_FILES, Comma separated list of files to be distributed with the job.
# - SPARK_YARN_DIST_ARCHIVES, Comma separated list of archives to be distributed with the job.

# Options for the daemons used in the standalone deploy mode:
# - SPARK_MASTER_IP, to bind the master to a different IP address or hostname
# - SPARK_MASTER_PORT / SPARK_MASTER_WEBUI_PORT, to use non-default ports for the master
# - SPARK_MASTER_OPTS, to set config properties only for the master (e.g. "-Dx=y")
# - SPARK_WORKER_CORES, to set the number of cores to use on this machine
# - SPARK_WORKER_MEMORY, to set how much total memory workers have to give executors (e.g. 1000m, 2g)
# - SPARK_WORKER_PORT / SPARK_WORKER_WEBUI_PORT, to use non-default ports for the worker
# - SPARK_WORKER_INSTANCES, to set the number of worker processes per node
# - SPARK_WORKER_DIR, to set the working directory of worker processes
# - SPARK_WORKER_OPTS, to set config properties only for the worker (e.g. "-Dx=y")
# - SPARK_HISTORY_OPTS, to set config properties only for the history server (e.g. "-Dx=y")
# - SPARK_DAEMON_JAVA_OPTS, to set config properties for all daemons (e.g. "-Dx=y")
# - SPARK_PUBLIC_DNS, to set the public dns name of the master or workers

export SPARK_SUBMIT_CLASSPATH="$FWDIR/conf"

解决方法:

只需在spark目录中执行以下命令:

cp conf/log4j.properties.template conf/log4j.properties

编辑log4j.properties:

# Set everything to be logged to the console
log4j.rootCategory=INFO, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n

# Settings to quiet third party logs that are too verbose
log4j.logger.org.eclipse.jetty=WARN
log4j.logger.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO
log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO

在第一行替换:

log4j.rootCategory=INFO, console

通过:

log4j.rootCategory=WARN, console

保存并重新启动shell.它适用于OS X上的Spark 1.1.0和Spark 1.5.1.

原文地址:https://codeday.me/bug/20190915/1806117.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


hadoop搭建准备工作三台虚拟机:master、node1、node2检查时间是否同步:date检查java的jdk是否被安装好:java-version修改主机名三台分别执行vim/etc/hostname并将内容指定为对应的主机名 关闭防火墙:systemctlstopfirewalld   a.查看防火墙状态:systemctlstatu
文件的更名和移动:    获取文件详细信息       遇到的问题:不能直接在web上上传文件。   权限问题:修改后即可正常创建  参考:https://blog.csdn.net/weixin_44575660/article/details/118687993
目录一、背景1)小文件是如何产生的?2)文件块大小设置3)HDFS分块目的二、HDFS小文件问题处理方案1)HadoopArchive(HAR)2)Sequencefile3)CombineFileInputFormat4)开启JVM重用5)合并本地的小文件,上传到HDFS(appendToFile)6)合并HDFS的小文件,下载到本地(getmerge)三、HDFS小文件问题处理实战操
目录一、概述二、HadoopDataNode多目录磁盘配置1)配置hdfs-site.xml2)配置详解1、dfs.datanode.data.dir2、dfs.datanode.fsdataset.volume.choosing.policy3、dfs.datanode.available-space-volume-choosing-policy.balanced-space-preference-fraction4、dfs.datanode.available
平台搭建(伪分布式)伪分布式搭建在VM中搭建std-master修改配置文件centos7-cl1.vmdkstd-master.vmx-将配置文件中vm的版本号改成自己电脑对应的vm版本修改客户端的操作系统为centos764位打开虚拟机修改虚拟机网络cd/etc/sysconfigetwork-scripts
 一、HDFS概述 1.1、HDFS产出背景及定义 1.1.1、HDFS产生背景   随着数据量越来越大,在一个操作系统存不下所有的数据,那么就分配到更多的操作系统管理的磁盘中,但是不方便管理和维护,迫切需要一种系统来管理多台机器上的文件,这就是分布式文件管理系统。HDFS只是分布式
配置workers进入hadoop/etc/hadoop  编辑workers文件  然后分发给另外两个服务器     准备启动集群第一次需要初始化.  初始化完成后增加了data文件,  进入上面那个路径,就能看到当前服务器的版本号  启动HDFS  启动完毕102  
这周我对ssm框架进行了更深一步的开发,加入了多用户,并对除登录外的请求进行了拦截,这样用户在未登录的时候是访问不到资源的。并且对hadoop进行了初步的学习,包括虚拟机的安装等等。下周会对hadoop进行更深一步的学习,加油! 
前言通过在Hadoop1安装Hadoop,然后配置相应的配置文件,最后将Hadoop所有文件同步到其他Hadoop节点。一、集群规划#主机名‘master/hadoop1’‘slave01/hadoop2’‘slave02/hadoop3’#启动节点NamenodeNodemanagerNodemanager
1.先杀死进程(先进入到hadoop版本文件里,我的是/opt/module/hadoop-3.1.3/)sbin/stop-dfs.sh2.删除每个集群上的data以及logsrm-rfdata/logs/3.格式化hdfsnamenode-format4.再启动sbin/sart-dfs.sh
查看文件目录的健康信息执行如下的命令:hdfsfsck/user/hadoop-twq/cmd可以查看/user/hadoop-twq/cmd目录的健康信息:其中有一个比较重要的信息,就是Corruptblocks,表示损坏的数据块的数量查看文件中损坏的块(-list-corruptfileblocks)[hadoop-twq@master~]
titlecopyrightdatetagscategoriesHadoop2.8.0的环境搭建true2019-08-0912:12:44-0700LiunxHadoopLiunxHadoop此文为在centos7下安装Hadoop集群前期准备Hadoop下载Hadoop的下载本文下载的是2.8.0版本的Hadoop安装3个虚拟机并实现ssh免密码的登录
这是我的地图publicstaticclassMapClassextendsMapper<LongWritable,Text,Text,Text>{publicvoidmap(LongWritablekey,Textvalue,Contextcontext)throwsIOException,InterruptedException{String[]fields=value.toString().s
组件:Hadoop三大核心组件:HDFS(HadoopDistributedFileSystem):分布式文件系统,数据存放在这里,提供对应用程序数据的高吞吐量访问。YARN(YetAnotherResourceNegotiator):资源管理调度系统,分配比如硬盘内存等资源。用这些资源来运行程序的计算MapReduce:分布式运算框架
查看Hadoop安全模式hadoopdfsadmin-safemodegetSafemodeisOFF进入Hadoop安全模式root@centos:/$hadoopdfsadmin-safemodeenter SafemodeisON推出安全模式nange@ubuntu:/$hadoopdfsadmin-safemodeleave SafemodeisOFF
当我尝试运行sqoop命令时,我收到错误,说没有连接字符串的管理器我尝试运行的内容:sqoopexport--connect"jdbc:vertica://xxxxxxxx.com:5433/PPS_GIIA"--usernamexxxxx--passwordxxxxx--tableCountry-m1--export-dir/Eservices/SIPOC/SQLimport/part-m-0000--
好程序员大数据学习路线Hadoop学习干货分享,ApacheHadoop为可靠的,可扩展的分布式计算开发开源软件。ApacheHadoop软件库是一个框架,它允许使用简单的编程模型跨计算机群集分布式处理大型数据集(海量的数据)。包括这些模块:HadoopCommon:支持其他Hadoop模块的常用工具。Hadoop
我正在使用java,我正在尝试编写一个mapreduce,它将接收一个包含多个gz文件的文件夹.我一直在寻找,但我发现的所有教程都放弃了如何处理简单的文本文件,但没有找到解决我问题的任何东西.我在我的工作场所问过,但只提到scala,我并不熟悉.任何帮助,将不胜感激.解决方法:Hadoop检查
linux下开机自启:在/etc/init.d目录下新建文件elasticsearch并敲入shell脚本:#!/bin/sh#chkconfig:23458005#description:elasticsearchexportJAVA_HOME=/home/hadoop/jdk/jdk1.8.0_172exportJAVA_BIN=/home/hadoop/jdk/jdk1.8.0_172/binexportPATH=$PATH:$JAVA_HOME/bi
离线数据处理的主要工具Hive是必须极其熟练地掌握和精通的,但Hive背后是Hadoop的HDFS和M叩Reduce,需要会MapReduce编程么?从笔者的工作实践以及了解来看,这不是必须掌握的,但是数据开发人员必须掌握其概念、架构和工作原理,也就是说,不但要知其然,而且要知其所以然。1.起源