windows下eclipse实现操作虚拟机ubantu中的hdfs hbase
1.首先打开虚拟机,查看虚拟机的ip地址
2.修改C:\Windows\System32\drivers\etc下的主机名与ip的映射文件
3.配置Map/reduce
配置成功后可以查看hdfs文件目录
4.修改、虚拟机的ip与主机名的映射文件
5启动hdfs,hbase服务
6.通过代码测试
package dao; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class exit {
public static void main(String[] args){
try{
String fileName = "/user/hadoop/hadoopfile";
Configuration configuration = new Configuration();
// conf.set("fs.defaultFS", "hdfs://192.168.189.137:9000");
configuration.set("hbase.zookeeper.quorum", "zyt");
configuration.set("hbase.zookeeper.property.clientPort", "2181");
configuration.set("hbase.rootdir", "hdfs://zyt:9000/hbase"); //设置响应时间
configuration.set("hbase.client.pause", "50");
configuration.set("hbase.rpc.timeout", "2000");
configuration.set("hbase.client.operation.timeout", "3000");
configuration.set("hbase.client.scanner.timeout.period", "10000"); configuration.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
FileSystem fs = FileSystem.get( configuration);
if(fs.exists(new Path(fileName))){
System.out.println("文件存在");
}else{
System.out.println("文件不存在");
} }catch (Exception e){
e.printStackTrace();
}
}
}
core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/local/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://zyt:9000</value>
</property>
</configuration>
hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/hadoop/tmp/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/hadoop/tmp/dfs/data</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/local/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://zyt:9000</value>
</property>
</configuration>
windows下eclipse实现操作虚拟机ubantu中的hdfs hbase的更多相关文章
- 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- ...
- windows下eclipse+hadoop2
windows下eclipse+hadoop2.4开发手册 1.解压下载的hadoop2.4,到任意盘符,例如D:\hadoop-2.4.0. 2.设置环境变量 ①新建系统变量,如下所示. ②将新建的 ...
- windows下Eclipse安装Perl插件教程
windows下Eclipse安装Perl插件教程 想用eclipse编写perl.网上看了很多资料.但EPIC插件的下载连接都失效了.无奈,只好自己动手写个教程记录一下. 准备工作: 安装好Ecli ...
- windows下eclipse远程连接hadoop集群开发mapreduce
转载请注明出处,谢谢 2017-10-22 17:14:09 之前都是用python开发maprduce程序的,今天试了在windows下通过eclipse java开发,在开发前先搭建开发环境.在 ...
- [b0007] windows 下 eclipse 开发 hdfs程序样例
目的: 学习使用hdfs 的java命令操作 相关: 进化: [b0010] windows 下 eclipse 开发 hdfs程序样例 (二) [b0011] windows 下 eclipse 开 ...
- [b0011] windows 下 eclipse 开发 hdfs程序样例 (三)
目的: 学习windows 开发hadoop程序的配置. [b0007] windows 下 eclipse 开发 hdfs程序样例 太麻烦 [b0010] windows 下 eclipse 开发 ...
- [b0010] windows 下 eclipse 开发 hdfs程序样例 (二)
目的: 学习windows 开发hadoop程序的配置 相关: [b0007] windows 下 eclipse 开发 hdfs程序样例 环境: 基于以下环境配置好后. [b0008] Window ...
- Windows下Eclipse提交MR程序到HadoopCluster
作者:Syn良子 出处:http://www.cnblogs.com/cssdongl 欢迎转载,转载请注明出处. 以前Eclipse上写好的MapReduce项目经常是打好包上传到Hadoop测试集 ...
- Windows下Eclipse连接hadoop
2015-3-27 参考: http://www.cnblogs.com/baixl/p/4154429.html http://blog.csdn.net/u010911997/article/de ...
随机推荐
- IDEA 设置 TOMCAT 虚拟路径
今天在使用 IDEA 配置 TOMCAT 虚拟路径时一直报错,最终解决方式整理如下: 一.使用 Tomcat 自己的虚拟路径 1.在 Tomcat9\conf 目录下找到 server.xml 文件, ...
- Guava Preconditions 工具参数前置校验
guava 提供 Preconditions 作为代码校验的工具类,用来简化开发中对代码的校验或预处理,在逻辑开始前进行合理性校验,避免参数传入过深导致的数据错误. 并且能够在不符合校验条件的地方, ...
- 通过Comparable来实现对自身的比较
import org.apache.commons.lang.builder.CompareToBuilder; import org.apache.commons.lang.builder.Equa ...
- 【20170506】贝业新兄弟IT总监李济宏:第三方家居物流的IT架构探索
5月6日,物流人的节日,这一天,全国的物流人汇聚中国上海嘉定,以“新时代.新物流”为主题的2017中国货运产业大会暨货运企业家高峰论坛如期召开,同时,首届嘉年华活动隆重开启,八大主题分享活动,精彩进行 ...
- mysql(5.7)配置文件示例
# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-con ...
- 基于expressjs老项目的翻新方案
刚开始接触这方面的项目时,对ES规范理解不深,查了一些资料,发现如果不改expressjs的代码,大概率是没法用到最新的async/await了,后续也就没有继续往这个方面想. 这两天突然想起这个问题 ...
- 【nodejs】初识 NodeJS(二)
上一节我们构建了一个基础的 http 服务器,我们可以接收 http 请求,但是我们得做点什么吧 – 不同的 http 请求,服务器应该有不同的响应. 路由模块 处理不同的 http 请求在我们的代码 ...
- C#编程高并发的几种处理方法
并发(英文Concurrency),其实是一个很泛的概念,字面意思就是“同时做多件事”,不过方式有所不同.在.NET的世界里面,处理高并发大致有以下几种方法: 1,异步编程 异步编程就是使用futur ...
- linux配置 数据库主从同步
数据库的读写分离能很大程度上减轻数据库的压力,读写分离的前提就是主从数据同步,然后在主库做增删改,从库做查询. 例如: 主库:192.168.0.1 从库:192.168.0.2 两个数据库都安装了M ...
- [转]解决Error: That port is already in use.
ubuntu系统下,运行一个django项目,即输入python manage.py runserver后,可能出现 Error: That port is already in use.的错误. 即 ...