Maven

Maven 是专门用于构建和管理Java相关项目的工具。

1、安装Java并配置Java环境

2、安装eclipse

3、安装maven并配置环境

4、eclipse配置maven

①修改settings.xml
在安装所在文件夹\apache-maven-3.6.0下面,新建\repository文件夹,作为Maven本地仓库。在文件settings.xml里添加 <localRepository>C:\eclipse\apache-maven-3.6.0\repository</localRepository>。

②配置Maven的installation和User Settings
【Preferences】→【Maven】→【Installations】配置Maven安装路径,【User Settings】配置settings.xml的路径。
③添加pom.xml依赖
依赖(Maven Repository: hadoop)所在网址:https://mvnrepository.com/tags/hadoop ,找到对应版本的三个依赖(如下),拷贝至pom.xml的<project>与</project>之间,保存之后自动生成Maven Dependencies。
<dependencies>
  <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <version>2.7.3</version>
  </dependency>
  <dependency>  
      <groupId>org.apache.hadoop</groupId>  
      <artifactId>hadoop-client</artifactId>  
      <version>2.7.3</version>  
  </dependency> 
  <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>2.7.3</version>
  </dependency>
</dependencies>

5、Linux的shell命令

常用的linux的shell命令:
cd /aa          转到/aa目录
pws            显示当前目录
ll /aa           显示/aa目录
mkdir /aa       新建/aa目录
rm /aa/out.txt   删除/aa目录下的out.txt文件
cat /aa/out.txt   查看/aa目录下的out.txt文件的内容
vi /aa/out.txt    编辑/aa目录下的out.txt文件的内容
ifconfig         查看IP地址
ip addr         查看IP地址

6、hdfs的shell命令

hdfs的shell命令,有三种形式,用前面两个。
hdfs dfs    √
hadoop fs  √
hadoop dfs  ×
常用的hdfs的shell命令:
hdfs dfs -ls /  查看hdfs根目录下文件和目录
hdfs dfs -ls -R /      查看hdfs根目录下包括子目录在内的所有文件和目录
hdfs dfs -mkdir /aa/bb  在hdfs的/aa目录下新建/bb目录
hdfs dfs -rm -r /aa/bb   删除hdfs的/aa目录下的/bb目录
hdfs dfs -rm /aa/out.txt  删除hdfs的/aa目录下的out.txt文件
hdfs dfs -put anaconda-ks.cfg /aa        把本地文件上传到hdfs 
hdfs dfs -copyFromLocal a.txt /          把本地文件上传到hdfs
hdfs dfs -get /bb.txt bbcopy.txt          从hdfs下载文件到本地
hdfs dfs -copyToLocal /bb.txt bbcopy.txt   从hdfs下载文件到本地
posted @ 2019-05-26 18:35  斯德哥尔摩情人  阅读(91)  评论(0编辑  收藏  举报