我是hadoop世界的新手。我已经在我的windows机器上安装了spark2.3.1,并在同一台机器上安装了cloudera-insidevm。我正在用sparkshell做一些Dataframe形式的数据转换。现在我想把这些数据放到hive中,hive在cloudera中使用spark。我在google上搜索了一下,并做了以下步骤。
1) 复制了/etc/hive/conf中的所有文件并粘贴到我的windows中的spark/conf。
2) 在windows spark/conf中打开“hive site.xml”并更改属性,如下所示。
<configuration>
<property>
<name>hive.metastore.uris</name>
<value>thrift://MyclouderaIP:9083</value>
</property>
<property>
3) 将主机条目放入windows系统c:\windows\system32\drivers\etc\hosts
示例:myclouderaip quickstart.cloudera
4) 在clouderavmopen“/etc/hive/conf/hdfs site.xml”中,更改如下属性
<property>
<name>dfs.client.use.datanode.hostname</name>
<value>true</value>
</property>
完成所有步骤后,我面临以下问题。
scala> val Main = sc.textFile("D:\\Windows\\CompanyData.txt")
scala> Main.collect
错误:
java.lang.IllegalArgumentException: Pathname /D:/Windows/CompanyData.txt from hdfs://quickstart.cloudera:8020/D:/Windows/CompanyData.txt is not a valid DFS filename.
at org.apache.hadoop.hdfs.DistributedFileSystem.getPathName(DistributedFileSystem.java:197)
at org.apache.hadoop.hdfs.DistributedFileSystem.access$000(DistributedFileSystem.java:106)
at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1305)
at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1301)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1317)
我已经从spark/conf中删除了“core site.xml”,它可以在windows中读取文本文件。但在插入记录时,它无法与cloudera通信。
scala> import org.apache.spark.sql.hive.HiveContext
scala> val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)
scala> sqlContext.sql("insert into TestTable select 1")
错误:
org.apache.hadoop.ipc.RemoteException(java.io.IOException):
File /user/hive/warehouse/TestTable/.hive-staging_hive_2018-10-17_00-03-48_369_2112774544260501723-1/-ext-10000/_temporary/0/_temporary/attempt_20181017000351_0000_m_000000_0/part-00000-8fcba81b-8a51-48a6-9c47-ac5f1c9dafdb-c000
could only be replicated to 0 nodes instead of minReplication (=1).
There are 1 datanode(s) running and 1 node(s) are excluded in this operation.
有人能帮帮我吗。
暂无答案!
目前还没有任何答案,快来回答吧!