1. 程式人生 > >大資料常見錯誤解決方案(轉載)

大資料常見錯誤解決方案(轉載)

1、用./bin/spark-shell啟動spark時遇到異常:java.net.BindException: Can't assign requested address: Service 'sparkDriver' failed after 16 retries!

解決方法:add export SPARK_LOCAL_IP="127.0.0.1" to spark-env.sh

2、java Kafka producer error:ERROR kafka.utils.Utils$ - fetching topic metadata for topics [Set(words_topic)] from broker [ArrayBuffer(id:0,host: xxxxxx,port:9092)] failed

解決方法:Set 'advertised.host.name' on server.properties of Kafka broker to server's realIP(same to producer's 'metadata.broker.list' property)

3、java.net.NoRouteToHostException: No route to host

解決方法:zookeeper的IP要配對

4、Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)   java.net.UnknownHostException: linux-pic4.site:

解決方法:add your hostname to /etc/hosts: 127.0.0.1 localhost linux-pic4.site

5、org.apache.spark.SparkException: A master URL must be set in your configuration

解決方法:SparkConf sparkConf = new SparkConf().setAppName("JavaDirectKafkaWordCount").setMaster("local");

6、Failed to locate the winutils binary in the hadoop binary path

解決方法:先安裝好hadoop

7、啟動spark時: Failed to get database default, returning NoSuchObjectException

解決方法:1)Copy winutils.exe from here(https://github.com/steveloughran/winutils/tree/master/hadoop-2.6.0/bin) to some folder say, C:\Hadoop\bin. Set HADOOP_HOME to C:\Hadoop.2)Open admin command prompt. Run C:\Hadoop\bin\winutils.exe chmod 777 /tmp/hive

8、org.apache.spark.SparkException: Only one SparkContext may be running in this JVM (see SPARK-2243). To ignore this error, set spark.driver.allowMultipleContexts = true.

解決方法:Use this constructor JavaStreamingContext(sparkContext: JavaSparkContext, batchDuration: Duration)  替代  new JavaStreamingContext(sparkConf, Durations.seconds(5));

9、Reconnect due to socket error: java.nio.channels.ClosedChannelException

解決方法:kafka伺服器broker ip寫對

10、java.lang.IllegalArgumentException: requirement failed: No output operations registered, so nothing to execute

解決方法:tranformation最後一步產生的那個RDD必須有相應Action操作,例如massages.print()等

11、經驗:spark中資料寫入ElasticSearch的操作必須在action中以RDD為單位執行

12、 Problem binding to [0.0.0.0:50010] java.net.BindException: Address already in use;

解決方法:master和slave配置成同一個IP導致的,要配成不同IP

13、CALL TO LOCALHOST/127.0.0.1:9000

解決方法:host配置正確,/etc/sysconfig/network    /etc/hosts    /etc/sysconfig/network-scripts/ifcfg-eth0

13、開啟namenode:50070頁面,Datanode Infomation只顯示一個節點

解決方法:SSH配置錯誤導致,主機名一定要嚴格匹配,重新配置ssh免密碼登入

14、經驗:搭建叢集時要首先配置好主機名,並重啟機器讓配置的主機名生效

15、INFO hdfs.DFSClient: Exception in createBlockOutputStream  java.net.NoRouteToHostException: No route to host

解決方法:如果主從節點能相互ping通,那就關掉防火牆 service iptables stop

16、經驗:不要隨意格式化HDFS,這會帶來資料版本不一致等諸多問題,格式化前要清空資料資料夾

17、namenode1: ssh: connect to host namenode1 port 22: Connection refused

解決方法:sshd被關閉或沒安裝導致,which sshd檢查是否安裝,若已經安裝,則sshd restart,並ssh 本機hostname,檢查是否連線成功

18、Log aggregation has not completed or is not enabled.

解決方法:在yarn-site.xml中增加相應配置,以支援日誌聚合

19、failed to launch org.apache.spark.deploy.history.History Server full log in

解決方法:正確配置spark-defaults.xml,spark-en.sh中SPARK_HISTORY_OPTS屬性

20、Exception in thread "main" org.apache.spark.SparkException: Yarn application has already ended! It might have been killed or unable to launch application master.

解決方法:yarn-lient模式出現的異常,暫時無解

21、hadoop的檔案不能下載以及YARN中Tracking UI不能訪問歷史日誌

解決方法:windows系統不能解析域名所致,把hosts檔案hostname複製到windows的hosts中

22、經驗:HDFS檔案路徑寫法為:hdfs://master:9000/檔案路徑,這裡的master是namenode的hostname,9000是hdfs埠號。

23、Yarn JobHistory Error: Failed redirect for container

解決方法:將 http://:19888/jobhistory/logs  配置到yarn-site.xml中,重啟yarn和JobHistoryServer

24、通過hadoop UI訪問hdfs資料夾時,出現提示 Permission denied: user=dr.who

解決方法:namonode節點終端執行:hdfs dfs -chmod -R 755 /

25、經驗:Spark的Driver只有在Action時才會收到結果
26、經驗:Spark需要全域性聚合變數時應當使用累加器(Accumulator)
27、經驗:Kafka以topic與consumer group劃分關係,一個topic的訊息會被訂閱它的消費者組全部消費,如果希望某個consumer使用topic的全部訊息,可將該組只設一個消費者,每個組的消費者數目不能大於topic的partition總數,否則多出的consumer將無消可費

28、java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;

解決方法:統一ES版本,儘量避免直接在spark中建立ES client

29、eturned Bad Request(400) - failed to parse;Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes; Bailing out..

解決方法:寫入ES的資料格式糾正

30、java.util.concurrent.TimeoutException: Cannot receive any reply in 120 seconds

解決方法:確保所有節點之間能夠免密碼登入

31、叢集模式下,spark無法向elasticsearch寫入資料

解決方法:採用這種寫入方式(帶上es配置的Map引數)results.foreachRDD(javaRDD -> {JavaEsSpark.saveToEs(javaRDD, esSchema, cfg);return null;});

32、經驗:所有自定義類要實現serializable介面,否則在叢集中無法生效
33、經驗:resources資原始檔讀取要在Spark Driver端進行,以區域性變數方式傳給閉包函式

34、通過nio讀取資原始檔時,java.nio.file.FileSystemNotFoundException  at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171)

解決方法:打成jar包後URI發生變化所致,形如jar:file:/C:/path/to/my/project.jar!/my-folder,要採用以下解析方式,

final Map env = new HashMap<>();
final String[] array = uri.toString().split("!");
final FileSystem fs = FileSystems.newFileSystem(URI.create(array[0]), env);
final Path path = fs.getPath(array[1]);
35、經驗:DStream流轉化只產生臨時流物件,如果要繼續使用,需要一個引用指向該臨時流物件
36、經驗:提交到yarn cluster的作業不能直接print到控制檯,要用log4j輸出到日誌檔案中

37、java.io.NotSerializableException: org.apache.log4j.Logger

解決方法:序列化類中不能包含不可序列化物件,you have to prevent logger instance from default serializabtion process, either make it transient or static. Making it static final is preferred option due to many reason because if you make it transient than after deserialization logger instance will be null and any logger.debug() call will result in NullPointerException in Java because neither constructor not instance initializer block is called during deserialization. By making it static and final you ensure that its thread-safe and all instance of Customer class can share same logger instance, By the way this error is also one of the reason Why Logger should be declared static and final in Java program. 

38、log4j:WARN Unsupported encoding

解決方法:1.把UTF改成小寫utf-8    2.設定編碼那行有空格

39、MapperParsingException[Malformed content, must start with an object

解決方法:採用介面JavaEsSpark.saveJsonToEs,因為saveToEs只能處理物件不能處理字串

40、 ERROR ApplicationMaster: SparkContext did not initialize after waiting for 100000 ms. Please check earlier log output for errors. Failing the application

解決方法:資源不能分配過大,或者沒有把.setMaster("local[*]")去掉

41、WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)

解決方法:配置檔案broker編號要寫對,命令中的IP寫真實IP

42、 User class threw exception: org.apache.spark.SparkException: org.apache.spark.SparkException: Couldn't find leaders for Set([mywaf,7], [mywaf,1])

解決方法:正確配置kafka,並重新建立topic

43、在ES介面發現有節點shard分片不顯示

解決方法:該節點磁碟容量不足,清理磁碟增加容量

44、The method updateStateByKey(Function2,Optional,Optional>, int) in the type JavaPairDStream is not applicable for the arguments (Function2,Optional,Optional>, int)

解決方法:Spark use com.google.common.base.Optional not jdk default package java.util.Optional

45、NativeCrc32.nativeComputeChunkedSumsByteArray

解決方法:配置eclipse的hadoop-home,bin和system32資料夾中加入64位的2.6版本的hadoop.dll

46、經驗:Spark Streaming包含三種計算模式:nonstate 、stateful 、window

47、Yarn的RM單點故障

解決方法:通過三節點zookeeper叢集和yarn-site.xml配置檔案完成Yarn HA

48、經驗:kafka可通過配置檔案使用自帶的zookeeper叢集

49、經驗:Spark一切操作歸根結底是對RDD的操作

50、如何保證kafka訊息佇列的強有序

解決方法:把需要強有序的topic只設置一個partition

51、linux批量多機互信

解決方法:pub祕鑰配成一個

52、org.apache.spark.SparkException: Failed to get broadcast_790_piece0 of broadcast_790

解決方法:去除spark-defaults.conf中spark.cleaner.ttl配置

53、Yarn HA環境下,通過web訪問history日誌被跳轉到8088而無法顯示

解決方法:恢復Yarn Http預設埠8088

54、but got no response. Marking as slave lost

解決方法:使用yarn client提交作業遇到這種情況,暫時無解

55、Using config: /work/poa/zookeeper-3.4.6/bin/../conf/zoo.cfg  Error contacting service. It is probably not running.

解決方法:配置檔案不正確,例如hostname不匹配等

56、經驗:部署Spark任務,不用拷貝整個架包,只需拷貝被修改的檔案,然後在目標伺服器上編譯打包。

57、Spark setAppName doesn't appear in Hadoop running applications UI

解決方法:set it in the command line for spark-submit "--name BetterName"

58、如何監控Sprak Streaming作業是否掛掉

解決方法:通過監控Driver埠或者根據yarn指令寫Linux定時指令碼監控

59、kafka內外網問題

解決方法:kafka機器雙網絡卡,配置檔案server.properties中advertised.host.name不要寫IP,用域名形式,外網的生產者和內網的消費者各自解析成自己所需的IP。

60、經驗:kafka的log.dirs不要設定成/tmp下的目錄,貌似tmp目錄有檔案數和磁碟容量限制

61、kafka搬機器後,在新的叢集,topic被自動建立,且只有一臺broker負載

解決方法:server.properties中加上delete.topic.enable=true和auto.create.topics.enable=false,刪除舊的topic,重新建立topic,重啟kafka

62、安裝sbt,執行sbt命令卡在Getting org.scala-sbt sbt 0.13.6 ...

解決方法:sbt takes some time to download its jars when it is run first time,不要退出,直至sbt處理完

63、經驗:ES的分片類似kafka的partition

64、kafka出現OOM異常

解決方法:進入kafka broker啟動指令碼中,在export KAFKA_HEAP_OPTS="-Xmx24G -Xms1G"調大JVM堆記憶體引數

65、linux伺服器磁碟爆滿,檢查超過指定大小的檔案

解決方法:find / -type f -size +10G  

66、spark-direct kafka streaming限速

解決方法:spark.streaming.kafka.maxRatePerPartition,配置每秒每個kafka分割槽讀取速率

67、org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: Found unrecoverable error returned Not Found(404) - [EngineClosedException CurrentState[CLOSED]

解決方法:在kopf外掛中對該索引先close再open即可。造成原因可能是Index建立時有shard壞掉。

68、Job aborted due to stage failure: Task not serializable:

解決方法:Serializable the class;Declare the instance only within the lambda function passed in map;Make the NotSerializable object as a static and create it once per machine;Call rdd.forEachPartition and create the NotSerializable object in there

69、Pipeline write will fail on this Pipeline because it contains a stage which does not implement Writable

解決方法:this cannot be done as of Spark 1.6,需升級spark版本

70、IDEA從git匯入scala專案,通篇提示變數never used

解決方法:將src資料夾mark directory as sources root

71、Run configuration in IntelliJ result in "Cannot start compilation: the output path is not specified for module "xxx". Specify the output path in Configure Project.

解決方法:In the default intellij options, "Make" was checked as "Before Launch". Unchecking it fixed the issue.

72、UDFRegistration$$anonfun$register$26$$anonfun$apply$2 cannot be cast to scala.Function1

解決方法:聚合函式不能用UDF,而應該定義UDAF

73、SPARK SQL replacement for mysql GROUP_CONCAT aggregate function

解決方法:自定義UDAF

74、在intellij idea的maven專案中,無法New scala檔案

解決方法:pom.xml加入scala-tools外掛相關配置,下載並更新

75、Error:scala: Error: org.jetbrains.jps.incremental.scala.remote.ServerException

解決方法:修改pom.xml配置檔案,把scala換到最新版本

76、HADOOP 磁碟滿的各節點平衡

解決方法:執行指令hdfs balancer -Threshold 3 或者 執行 start-balancer.sh 指令碼格式:$Hadoop_home/bin/start-balancer.sh -threshold,引數3是比例引數,表示3%,也就是平各個DataNode直接磁碟使用率偏差在3%以內

77、經驗:sparkSQL UDAF中update函式的第二個引數 input: Row 對應的並非DataFrame的行,而是被inputSchema投影了的行

78、Error: No TypeTag available for String  sqlContext.udf.register()

解決方法:scala版本不一致,統一所有scala版本

79、How to add a constant column in a Spark DataFrame?

解決方法:The second argument for DataFrame.withColumn should be a Column so you have to use a literal:   df.withColumn('new_column', lit(10))

80、Error:scalac:Error:object VolatileDoubleRef does not have a member create

解決方法:scala版本不一致,統一開發環境和系統的scala版本

81、java.lang.NoSuchMethodError: scala.collection.immutable.HashSet$.empty()Lscala/collection/immutable/HashSet

解決方法:統一scala和spark的scala版本

82、maven專案打包去除不要的依賴,防止目標jar容量過大

解決方法:在中加入provided標明該依賴不放進目標jar,並用maven shaded方式打包

83、maven打包scala和java的混合專案

解決方法:使用指令 mvn clean scala:compile compile package

84、sparkSQL的udf無法註冊UDAF聚合函式

解決方法:把UDAF自定義類的object關鍵字改成class宣告

85、經驗:執行時刪除hadoop資料目錄會導致依賴HDFS的JOB失效

86、[IllegalArgumentException[Document contains at least one immense term in field=XXX

解決方法:在ES中建立索引時對長文字欄位要分詞

87、maven shade打包資原始檔沒有打進去

解決方法:把resources資料夾放到src/main/下面,與scala或java資料夾並排

88、經驗:spark Graph根據邊集合構建圖,頂點集合只是指定圖中哪些頂點有效

89、ES寫query用到正則匹配時,Determinizing automaton would result in more than 10000 states.

解決方法:正則表示式的字串太長,複雜度過高,正則匹配要精練,不要列舉式匹配

90、java.lang.StackOverflowError   at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:53)

解決方法:sql語句的where條件過長,字串棧溢位

91、org.apache.spark.shuffle.MetadataFetchFailedException:  Missing an output location for shuffle 0

解決方法:加大executor記憶體,減少executor個數,加大executor併發度

92、ExecutorLostFailure (executor 3 exited caused by one of the running tasks) Reason: Container killed by YARN for exceeding memory limits. 61.0 GB of 61 GB physical memory used

解決方法:移除RDD快取操作,增加該JOB的spark.storage.memoryFraction係數值,增加該job的spark.yarn.executor.memoryOverhead值

93、EsRejectedExecutionException[rejected execution (queue capacity 1000) on org.elasticsearch.search.action.SearchServiceTransportAction

解決方法:減少spark併發數,降低對ES的併發讀取

94、經驗:單個spark任務的excutor核數不宜設定過高,否則會導致其他JOB延遲

95、經驗:資料傾斜只發生在shuffle過程,可能觸發shuffle操作的運算元有:distinct  groupByKey  reduceByKey  aggregateByKey  join  cogroup  repartition等

96、如何定位spark的資料傾斜

解決方法:在Spark Web UI看一下當前stage各個task分配的資料量以及執行時間,根據stage劃分原理定位程式碼中shuffle類運算元

97、如何解決spark資料傾斜

解決方法:1)過濾少數導致傾斜的key(僅限於拋棄的Key對作業影響很小),2)提高shuffle操作並行度(提升效果有限),3)兩階段聚合(區域性聚合+全域性聚合),先對相同的key加字首變成多個key,區域性shuffle後再去掉字首,再次進行全域性shuffle(僅適用於聚合類的shuffle操作,效果明顯,對於join類的shuffle操作無效),4)將reduce join轉為map join,將小表進行廣播,對大表map操作,遍歷小表資料(僅適用於大小表或RDD情況),5)使用隨機字首和擴容RDD進行join,對其中一個RDD每條資料打上n以內的隨機字首,用flatMap運算元對另一個RDD進行n倍擴容並擴容後的每條資料依次打上0~n的字首,最後將兩個改造key後的RDD進行join(能大幅緩解join型別資料傾斜,需要消耗鉅額記憶體)

98、經驗:shuffle write就是在一個stage結束計算之後,為了下一個stage可以執行shuffle類的運算元,而將每個task處理的資料按key進行分類,將相同key都寫入同一個磁碟檔案中,而每一個磁碟檔案都只屬於下游stage的一個task,在將資料寫入磁碟之前,會先將資料寫入記憶體快取中,下一個stage的task有多少個,當前stage的每個task就要建立多少份磁碟檔案。

99、java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0

解決方法:元字元記得轉義

100、spark彈性資源分配

解決方法:配置spark shuffle service,開啟spark.dynamicAllocation.enabled

101、經驗:kafka的comsumer groupID對於spark direct streaming無效

102、啟動hadoop yarn,發現只啟動了ResourceManager,沒有啟動NodeManager

解決方法:yarn-site.xml配置有問題,檢查並規範各項配置

103、如何檢視hadoop系統日誌

解決方法:Hadoop 2.x中YARN系統的服務日誌包括ResourceManager日誌和各個NodeManager日誌,它們的日誌位置如下:ResourceManager日誌存放位置是Hadoop安裝目錄下的logs目錄下的yarn-*-resourcemanager-*.log,NodeManager日誌存放位置是各個NodeManager節點上hadoop安裝目錄下的logs目錄下的yarn-*-nodemanager-*.log

104、經驗:小於128M的小檔案都會佔據一個128M的BLOCK,合併或者刪除小檔案節省磁碟空間

105、how to remove Non DFS Used

解決方法:1)清除hadoop資料目錄中使用者快取檔案:cd /data/hadoop/storage/tmp/nm-local-dir/usercache;du -h;rm -rf `find  -type f -size +10M`;  2)清理Linux檔案系統中的垃圾資料

106、經驗:Non DFS Used指的是非HDFS的所有檔案

107、linux profile配置檔案隔離

解決方法:cd /etc/profile.d;在這裡新建相應配置指令碼

108、The reference to entity "autoReconnect" must end with the ';' delimiter

解決方法:把&替換成&

109、Service hiveserver not found

解決方法:Try to run bin/hive --service hiveserver2 instead of hive --service hiveserver for this version of apache hive

110、Failed to execute spark task, with exception 'org.apache.hadoop.hive.ql.metadata.HiveException(Failed to create spark client.)'

解決方法:不要預編譯的spark,重新編譯spark,並保證與hive pom中的版本一致

111、java.lang.NoSuchFieldError: SPARK_RPC_SERVER_ADDRESS  at org.apache.hive.spark.client.rpc.RpcConfiguration.(RpcConfiguration.java:45)

解決方法:hive spark版本要匹配,同時必須是沒有-phive引數編譯的spark

112、javax.jdo.JDOFatalInternalException: Error creating transactional connection factory

解決方法:把mysql connector加入hive的lib中

113、org.apache.hadoop.hive.ql.metadata.HiveException(Failed to create spark client  FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.spark.SparkTask

解決方法:原因有多種,去hive.log檢視日誌進一步定位問題

114、Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream

解決方法:編譯spark用了hadoop-provided引數,導致缺少hadoop相關包

115、linux 輸入錯誤命令 按刪除鍵顯示^H

解決方法:執行指令 stty erase ^H

116、經驗:通過hive原始檔pom.xml檢視適配的spark版本,只要打版本保持一致就行,例如spark1.6.0和1.6.2都能匹配

117、經驗:開啟Hive命令列客戶端,觀察輸出日誌是否有列印“SLF4J: Found binding in [jar:file:/work/poa/hive-2.1.0-bin/lib/spark-assembly-1.6.2-hadoop2.6.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]”來判斷hive有沒有繫結spark

118、啟動yarn,發現只啟動了部分Nodemanager

解決方法:未啟動的節點缺少yarn相關包,要保持所有節點jar包一致

119、Error: Could not find or load main class org.apache.hive.beeline.BeeLine

解決方法:重新編譯Hive,並帶上引數-Phive-thriftserver

120、經驗:編譯spark,hive on spark就不要加-Phive引數,若需sparkSQL支援hive語法則要加-Phive引數

121、User class threw exception: org.apache.spark.sql.AnalysisException: path hdfs://XXXXXX already exists.;

解決方法:df.write.format("parquet").mode("append").save("path.parquet")

122、check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1

解決方法:用新版mysql-connector

123、org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate

解決方法:vim core-site.xml,hadoop.proxyuser.root.hosts,value = *,hadoop.proxyuser.root.groups,value = *,restart yarn

124、java.lang.NoSuchMethodError: org.apache.parquet.schema.Types$MessageTypeBuilder.addFields([Lorg/apache/parquet/schema/Type;)Lorg/apache/parquet/schema/Types$BaseGroupBuilder;

解決方法:版本衝突所致,統一hive和spark中parquet元件版本

125、經驗:可以通過hive-site.xml修改spark.executor.instances、spark.executor.cores、spark.executor.memory等配置來優化hive on spark執行效能,不過最好配成動態資源分配。

126、WARN SparkContext: Dynamic Allocation and num executors both set, thus dynamic allocation disabled.

解決方法:如果要使用動態資源分配,就不要設定執行器個數

127、Invalid configuration property node.environment: is malformed (for class io.airlift.node.NodeConfig.environment)

解決方法:the node.environment property (in the node.properties file) is set but fails to match the following regular expression: [a-z0-9][_a-z0-9]*. 重新規範命名

128、com.facebook.presto.server.PrestoServerNo factory for connector hive-XXXXXX

解決方法:在hive.properties中 connector.name寫錯了,應該為指定的版本,以便於presto使用對應的介面卡,修改為:connector.name=hive-hadoop2

129、org.apache.spark.SparkException: Task failed while writing rows  Caused by: org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: null

解決方法:ES負載過高,修復ES

130、經驗:如果maven下載很慢,很可能是被天朝的GFW牆了,可以在maven安裝目錄的setting.conf配置檔案mirrors標籤下加入國內映象抵制**黨的網路封鎖,例如:

        nexus-aliyun

        *

        Nexus aliyun

        http://maven.aliyun.com/nexus/content/groups/public

131、RROR ApplicationMaster: Uncaught exception: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

解決方法:pom.xml檔案中標籤下加入

META-INF/*.SF

META-INF/*.DSA

META-INF/*.RSA

132、scala.MatchError: Buffer(10.113.80.29, None) (of class scala.collection.convert.Wrappers$JListWrapper)

解決方法:清除ES中跟scala資料型別不相容的髒資料

133、HDFS誤刪檔案如何恢復解決方法:core-site檔案中加入

     fs.trash.interval

     2880

     HDFS垃圾箱設定,可以恢復誤刪除,配置的值為分鐘數,0為禁用

恢復檔案執行 hdfs dfs -mv  /user/root/.Trash/Current/誤刪檔案    /原路徑

134、改了linux定時腳本里邊部分任務順序,導致有些任務未執行,而有些重複執行

解決方法:Linux指令碼修改後實時生效,務必在指令碼全部執行完再修改,以免產生副作用

135、經驗:spark兩個分割槽方法coalesce和repartition,前者窄依賴,分割槽後資料不均勻,後者寬依賴,引發shuffle操作,分割槽後資料均勻

136、org.apache.spark.SparkException: Task failed while writing rows   scala.MatchError: Buffer(10.113.80.29, None) (of class scala.collection.convert.Wrappers$JListWrapper)

解決方法:ES資料在sparksql型別轉化時不相容,可通過EsSpark.esJsonRDD以字串形式取ES資料,再把rdd轉換成dataframe

137、Container exited with a non-zero exit code 143  Killed by external signal

解決方法:分配的資源不夠,加大記憶體或者調整程式碼,儘量避免類似JsonObject這樣的大物件過度消耗記憶體,或者Include below properties in yarn-site.xml and restart VM,

   yarn.nodemanager.vmem-check-enabled

   false

   Whether virtual memory limits will be enforced for containers

   yarn.nodemanager.vmem-pmem-ratio

   4

   Ratio between virtual memory to physical memory when setting memory limits for containers

138、對已有jar手動生成maven依賴

解決方法:mvn install:install-file -Dfile=spark-assembly-1.6.2-hadoop2.6.0.jar -DgroupId=org.apache.repack -DartifactId=spark-assembly-1.6.2-hadoop2.6.0 -Dversion=2.6 -Dpackaging=jar

139、FAILED: SemanticException [Error 10006]: Line 1:122 Partition not found ''2016-08-01''

解決方法:hive版本太新,hive自身bug,把hive版本從2.1.0降到1.2.1

140、ParseException line 1:17 mismatched input 'hdfs' expecting StringLiteral near 'inpath' in load statement

解決方法:去掉以hdfs開頭的IP埠號字首,直接寫HDFS中的絕對路徑,並用單引號括起來

141、[ERROR] Terminal initialization failed; falling back to unsupported  java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected解決方案:export HADOOP_USER_CLASSPATH_FIRST=true

142、crontab中啟動的shell指令碼不能正常執行,但是使用手動執行沒有問題

解決方法:在指令碼第一行寫上source /etc/profile,因為cront程序不會自動載入使用者目錄下的.profile檔案

143、SparkListenerBus has already stopped! Dropping event SparkListenerStageCompleted

解決方法:叢集資源不夠,確保真實剩餘記憶體大於spark job申請的記憶體

144、PrestoException: ROW comparison not supported for fields with null elements

解決方法:把 !=null 換成 is not null

145、啟動presto伺服器,部分節點啟動不成功

解決方法:JVM所分配的記憶體,必須小於真實剩餘記憶體

146、經驗:presto程序一旦啟動,JVM server會一直佔用記憶體

147、Error injecting constructor, java.lang.IllegalArgumentException: query.max-memory-per-node set to 20GB, but only 10213706957B of useable heap available

解決方法:Presto will claim 0.40 * max heap size for the system pool, so your query.max-memory-per-node must not exceed this. You can increase the heap or decrease query.max-memory-per-node.

148、failed: Encountered too many errors talking to a worker node. The node may have crashed or be under too much load. failed java.util.concurrent.CancellationException: Task was cancelled

解決方法:such exceptions caused by timeout limits,延長等待時間,在work節點config配置中set exchange.http-client.request-timeout=50s

149、大資料ETL視覺化有哪些主流方案

解決方法:可以考慮的技術棧有ELK(elasticsearch+logstash+kibana)或者HPA(hive+presto+airpal)

150、經驗:presto叢集沒必要採用on yarn模式,因為hadoop依賴HDFS,如果部分機器磁碟很小,HADOOP會很尷尬,而presto是純記憶體計算,不依賴磁碟,獨立安裝可以跨越多個叢集,可以說有記憶體的地方就可以有presto