1.首先打开虚拟机,查看虚拟机的ip地址

2.修改C:\Windows\System32\drivers\etc下的主机名与ip的映射文件

3.配置Map/reduce

配置成功后可以查看hdfs文件目录

4.修改、虚拟机的ip与主机名的映射文件

5启动hdfs,hbase服务

6.通过代码测试

  1. package dao;
  2.  
  3. import org.apache.hadoop.conf.Configuration;
  4. import org.apache.hadoop.fs.FileSystem;
  5. import org.apache.hadoop.fs.Path;
  6. public class exit {
  7. public static void main(String[] args){
  8. try{
  9. String fileName = "/user/hadoop/hadoopfile";
  10. Configuration configuration = new Configuration();
  11. // conf.set("fs.defaultFS", "hdfs://192.168.189.137:9000");
  12. configuration.set("hbase.zookeeper.quorum", "zyt");
  13. configuration.set("hbase.zookeeper.property.clientPort", "2181");
  14. configuration.set("hbase.rootdir", "hdfs://zyt:9000/hbase");
  15.  
  16. //设置响应时间
  17. configuration.set("hbase.client.pause", "50");
  18. configuration.set("hbase.rpc.timeout", "2000");
  19. configuration.set("hbase.client.operation.timeout", "3000");
  20. configuration.set("hbase.client.scanner.timeout.period", "10000");
  21.  
  22. configuration.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
  23. FileSystem fs = FileSystem.get( configuration);
  24. if(fs.exists(new Path(fileName))){
  25. System.out.println("文件存在");
  26. }else{
  27. System.out.println("文件不存在");
  28. }
  29.  
  30. }catch (Exception e){
  31. e.printStackTrace();
  32. }
  33. }
  34. }

core-site.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7.  
  8. http://www.apache.org/licenses/LICENSE-2.0
  9.  
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License. See accompanying LICENSE file.
  15. -->
  16.  
  17. <!-- Put site-specific property overrides in this file. -->
  18.  
  19. <configuration>
  20. <property>
  21. <name>hadoop.tmp.dir</name>
  22. <value>file:/usr/local/hadoop/tmp</value>
  23. <description>Abase for other temporary directories.</description>
  24. </property>
  25. <property>
  26. <name>fs.defaultFS</name>
  27. <value>hdfs://zyt:9000</value>
  28. </property>
  29. </configuration>

hdfs-site.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7.  
  8. http://www.apache.org/licenses/LICENSE-2.0
  9.  
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License. See accompanying LICENSE file.
  15. -->
  16.  
  17. <!-- Put site-specific property overrides in this file. -->
  18.  
  19. <configuration>
  20. <property>
  21. <name>dfs.replication</name>
  22. <value>2</value>
  23. </property>
  24. <property>
  25. <name>dfs.namenode.name.dir</name>
  26. <value>file:/usr/local/hadoop/tmp/dfs/name</value>
  27. </property>
  28. <property>
  29. <name>dfs.datanode.data.dir</name>
  30. <value>file:/usr/local/hadoop/tmp/dfs/data</value>
  31. </property>
  32. <property>
  33. <name>dfs.permissions</name>
  34. <value>false</value>
  35. </property>
  36. </configuration>
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7.  
  8. http://www.apache.org/licenses/LICENSE-2.0
  9.  
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License. See accompanying LICENSE file.
  15. -->
  16.  
  17. <!-- Put site-specific property overrides in this file. -->
  18.  
  19. <configuration>
  20. <property>
  21. <name>hadoop.tmp.dir</name>
  22. <value>file:/usr/local/hadoop/tmp</value>
  23. <description>Abase for other temporary directories.</description>
  24. </property>
  25. <property>
  26. <name>fs.defaultFS</name>
  27. <value>hdfs://zyt:9000</value>
  28. </property>
  29. </configuration>

windows下eclipse实现操作虚拟机ubantu中的hdfs hbase的更多相关文章

  1. windows下Eclipse操作MapReduce例子报错:Failed to set permissions of path: \tmp\hadoop-Jerome\mapred\staging\

    windows下Eclipse操作MapReduce例子报错: 14/05/18 22:05:29 WARN util.NativeCodeLoader: Unable to load native- ...

  2. windows下eclipse+hadoop2

    windows下eclipse+hadoop2.4开发手册 1.解压下载的hadoop2.4,到任意盘符,例如D:\hadoop-2.4.0. 2.设置环境变量 ①新建系统变量,如下所示. ②将新建的 ...

  3. windows下Eclipse安装Perl插件教程

    windows下Eclipse安装Perl插件教程 想用eclipse编写perl.网上看了很多资料.但EPIC插件的下载连接都失效了.无奈,只好自己动手写个教程记录一下. 准备工作: 安装好Ecli ...

  4. windows下eclipse远程连接hadoop集群开发mapreduce

    转载请注明出处,谢谢 2017-10-22 17:14:09  之前都是用python开发maprduce程序的,今天试了在windows下通过eclipse java开发,在开发前先搭建开发环境.在 ...

  5. [b0007] windows 下 eclipse 开发 hdfs程序样例

    目的: 学习使用hdfs 的java命令操作 相关: 进化: [b0010] windows 下 eclipse 开发 hdfs程序样例 (二) [b0011] windows 下 eclipse 开 ...

  6. [b0011] windows 下 eclipse 开发 hdfs程序样例 (三)

    目的: 学习windows 开发hadoop程序的配置. [b0007] windows 下 eclipse 开发 hdfs程序样例 太麻烦 [b0010] windows 下 eclipse 开发 ...

  7. [b0010] windows 下 eclipse 开发 hdfs程序样例 (二)

    目的: 学习windows 开发hadoop程序的配置 相关: [b0007] windows 下 eclipse 开发 hdfs程序样例 环境: 基于以下环境配置好后. [b0008] Window ...

  8. Windows下Eclipse提交MR程序到HadoopCluster

    作者:Syn良子 出处:http://www.cnblogs.com/cssdongl 欢迎转载,转载请注明出处. 以前Eclipse上写好的MapReduce项目经常是打好包上传到Hadoop测试集 ...

  9. Windows下Eclipse连接hadoop

    2015-3-27 参考: http://www.cnblogs.com/baixl/p/4154429.html http://blog.csdn.net/u010911997/article/de ...

随机推荐

  1. 上海线下技术交流(AA制)

    标签: 上海线下技术交流会 作者:王清培(Plen wang) 沪江Java资深架构师 .营销云平台负责人 上海地区技术线下交流,本次聚会AA制,要的就是热爱技术,交流技术,不是凑热闹.特此留念. 活 ...

  2. DroneCI启用privileged

    https://www.aliyun.com/jiaocheng/123155.html?spm=5176.100033.2.5.EIV4p6 drone的服务需要配置DRONE_ADMIN环境变量, ...

  3. 一步步教你轻松学关联规则Apriori算法

    一步步教你轻松学关联规则Apriori算法 (白宁超 2018年10月22日09:51:05) 摘要:先验算法(Apriori Algorithm)是关联规则学习的经典算法之一,常常应用在商业等诸多领 ...

  4. 小程序学习笔记三:页面文件详解之视图层WXML、WXS、WXSS文件

      视图层:Pages主要有 wxml页面文件和模板文件.wxs脚本文件.wxss样式文件:component是抽取出来的业务单元,同样拥有wxml页面文件和模板文件.wxs脚本文件.wxss样式文件 ...

  5. tmunx error:invalid option: status-utf8 invalid option: utf8

    修改为:set-window-option -gq mouse off set-window-option -gq mode-mouse off set-option -gq status-utf8 ...

  6. error running git

    I ran xcode-select --install and everything worked for me.

  7. 每天一个linux命令:df

    1.命令简介 df (disk free) 其功能显示每个文件所在的文件系统的信息,默认是显示所有文件系统. 2.用法 df [选项]... [文件]... 3.选项   4.示例 示例1:显示磁盘使 ...

  8. android Glide简单使用

    版权声明:大家可以转载,请写明转载申明 https://blog.csdn.net/bzlj2912009596/article/details/81702367 今天,简单讲讲Android里Gli ...

  9. Python实现im2col和col2im函数

    今天来说说im2col和col2im函数,这是MATLAB中两个内置函数,经常用于数字图像处理中.其中im2col函数在<MATLAB中的im2col函数>一文中已经进行了简单的介绍. 一 ...

  10. node出现 Error: listen EACCES 0.0.0.0:8080错误

    Error: listen EACCES 0.0.0.0:8080 at Object._errnoException (util.js:1022:11) at _exceptionWithHostP ...