大数据

在Windows上部署HBase

时间:2015-7-27 20:08:55  作者:solgle  来源:www.solgle.com  查看:2804  评论:0
内容摘要:原本打算在自己系统上面装个虚拟机,再部署一个linux系统,可是因自己电脑bios不支持虚拟化(按理说可以升级bios),不过最好还是安装到linux上面。这里就把hbase部署到了window7上面,供测试调试学习之用。以下是部署hbase的一些小计。一:安装jre(Jav...
原本打算在自己系统上面装个虚拟机,再部署一个linux系统,可是因自己电脑bios不支持虚拟化(按理说可以升级bios),不过最好还是安装到linux上面。
这里就把hbase部署到了window7上面,供测试调试学习之用。
以下是部署hbase的一些小计。
 
一:安装jre(Java虚拟机,java允许环境)
 
http://www.java.com/zh_CN/download/
配置java环境变量
 
用鼠标右击“我的电脑”->属性->高级->环境变量
系统变量->新建->变量名:JAVA_HOME 变量值:D:\Program Files\Java\jdk1.6.0_10(JDK安装路径)
系统变量->编辑->变量名:Path 在变量值的最前面加上:%JAVA_HOME%\bin;(若已经有Path项,无须另外新建,直接在后面加,但需用 ; 与前面已有项分隔开)
系统变量->新建->变量名:CLASSPATH 变量值:
;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
 
 
二:安装cygwin(模拟unix环境)   
下载地址:http://www.cygwin.com/
 
系统变量新增:CYGWIN_HOME,值为安装目录
变量PATH最后添加值: %CYGWIN_HOME%\bin
 
完成安装后,启动cygwin,将可以这些Linux的命令了
 
 
三:建立java与cypwin的连接关系
 
Cypwin下面执行(根据个人路径有所不同,”\”为转义字符)
 
LN -s /cygdrive/C:\Program Files\ \(x86\)/Java/jre1.8.0_60  /usr/local/jre1.8.0_60
 
 
建立及查看是否建立成功
solgle@solgle-PC /usr/local
$ LN -s /cygdrive/c/Program\ Files\ \(x86\)/Java/jre1.8.0_60 /usr/local/jre1.8.0_60
 
solgle@solgle-PC /usr/local
$ ls
bin  etc  jre1.8.0_60  lib
 
solgle@solgle-PC /usr/local
$ cd jre1.8.0_60
 
solgle@solgle-PC /usr/local/jre1.8.0_60
$ ls
bin        LICENSE     THIRDPARTYLICENSEREADME.txt
COPYRIGHT  README.txt  THIRDPARTYLICENSEREADME-JAVAFX.txt
lib        release     Welcome.html
 
solgle@solgle-PC /usr/local/jre1.8.0_60
$ ./bin/java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
 
---说明建立成功了
 
四:安装cypwin下的ssh,处理ssh服务
 
用cypwin的setup.exe重新下载更新ssh组件
(选择要安装的程序,默认是不安装OpenSSH的,需要手动选择,在Net类别下选上)
OpenSSH和OpenSSL两项
 
solgle@solgle-PC ~
$ ssh-host-config
 
*** Info: Generating missing SSH host keys
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file
 
*** Info: StrictModes is set to 'yes' by default.
*** Info: This is the recommended setting, but it requires that the POSIX
*** Info: permissions of the user's home directory, the user's .ssh
*** Info: directory, and the user's ssh key files are tight so that
*** Info: only the user has write permissions.
*** Info: On the other hand, StrictModes don't work well with default
*** Info: Windows permissions of a home directory mounted with the
*** Info: 'noacl' option, and they don't work at all if the home
*** Info: directory is on a FAT or FAT32 partition.
*** Query: Should StrictModes be used? (yes/no) yes
 
*** Info: Privilege separation is set to 'sandbox' by default since
*** Info: OpenSSH 6.1.  This is unsupported by Cygwin and has to be set
*** Info: to 'yes' or 'no'.
*** Info: However, using privilege separation requires a non-privileged account
*** Info: called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges.  Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no) yes
*** Info: Updating /etc/sshd_config file
 
*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Query: Enter the value of CYGWIN for the daemon: [] ntsec
*** Info: On Windows Server 2003, Windows Vista, and above, the
*** Info: SYSTEM account cannot setuid to other users -- a capability
*** Info: sshd requires.  You need to have or to create a privileged
*** Info: account.  This script will help you do so.
 
*** Info: It's not possible to use the LocalSystem account for services
*** Info: that can change the user id without an explicit password
*** Info: (such as passwordless logins [e.g. public key authentication]
*** Info: via sshd) when having to create the user token from scratch.
*** Info: For more information on this requirement, see
*** Info: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1
 
*** Info: If you want to enable that functionality, it's required to create
*** Info: a new account with special privileges (unless such an account
*** Info: already exists). This account is then used to run these special
*** Info: servers.
 
*** Info: Note that creating a new user requires that the current account
*** Info: have Administrator privileges itself.
 
*** Info: No privileged account could be found.
 
*** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** Query: Do you want to use a different name? (yes/no) no
*** Query: Create new privileged user account 'solgle-PC\cyg_server' (Cygwin name: 'cyg_server')? (yes/no) yes
*** Info: Please enter a password for new user cyg_server.  Please be sure
*** Info: that this password matches the password rules given on your system.
*** Info: Entering no password will exit the configuration.
*** Query: Please enter the password:
*** Query: Reenter:
 
*** Info: User 'cyg_server' has been created with password '123.com'.
*** Info: If you change the password, please remember also to change the
*** Info: password for the installed services which use (or will soon use)
*** Info: the 'cyg_server' account.
 
 
*** Info: The sshd service has been installed under the 'cyg_server'
*** Info: account.  To start the service now, call `net start sshd' or
*** Info: `cygrunsrv -S sshd'.  Otherwise, it will start automatically
*** Info: after the next reboot.
 
*** Info: Host configuration finished. Have fun!
 
solgle@solgle-PC ~
$
 
 
--启动服务
solgle@solgle-PC ~
$ net start sshd
鈥鈥鈥猃鈃鈥鈥鈥‥5鈥
鈇鈥鈥鈥鈂
 
solgle@solgle-PC ~
$ ssh localhost
ssh: connect to host localhost port 22: Connection refused
 
solgle@solgle-PC ~
$
 
---配置ssh
solgle@solgle-PC ~
$ cd ~/.ssh
 
solgle@solgle-PC ~/.ssh
$ ls
id_rsa  id_rsa.pub
 
solgle@solgle-PC ~/.ssh
$ cat id_rsa.pub >>authorized_keys
 
solgle@solgle-PC ~/.ssh
$
 
--测试连接 (昨天不行,今天重启了电脑,登录了cyp_server用户再切换回管理员用户,现在可以连接了)
solgle@solgle-PC ~
$ ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is SHA256:h0AlMZPQPtflGe5L6bGeRb1olF2MrqSowJ1NL87yCMs.
Are you sure you want to continue connecting (yes/no)? yew
Please type 'yes' or 'no': yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
 
solgle@solgle-PC ~
$ ssh localhost
Last login: Thu Sep 10 00:56:05 2015 from ::1
 
solgle@solgle-PC ~
$
 
在Windows上部署HBase
 
 
五:下载及部署hbase
 
下载地址:http://mirror.bit.edu.cn/apache/hbase/
此处下载到文件:hbase-0.94.27.tar.gz 放到C:\cygwin64\usr\local目录下
 
solgle@solgle-PC /usr/local
$ ls
bin  etc  hbase-0.94.27.tar.gz  jre1.8.0_60  lib
 
solgle@solgle-PC /usr/local
$ tar -vxf hbase-0.94.27.tar.gz
hbase-0.94.27/
hbase-0.94.27/lib/
hbase-0.94.27/lib/commons-cli-1.2.jar
hbase-0.94.27/lib/jetty-6.1.26.jar
hbase-0.94.27/lib/slf4j-api-1.4.3.jar
… …
 
 
solgle@solgle-PC /usr/local
$ ls
bin  etc  hbase-0.94.27  hbase-0.94.27.tar.gz  jre1.8.0_60  lib
 
 
---配置hbase文件
vi ./conf/hbase-env.sh
###加上下面两行####、
 
export JAVA_HOME=/usr/local/jre1.8.0_60
export HBASE_CLASSPATH=/usr/local/hbase-0.94.27/lib/zookeeper-3.4.5.jar:/usr/local/hbase-0.94.27/lib/slf4j-api-1.4.3.jar:/usr/local/hbase-0.94.27/lib/slf4j-log4j12-1.4.3.jar
export HBASE_MANAGES_ZK=false    ---是否必须待定
 
 
---配置hbase-site.xml文件
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
 * Copyright 2010 The Apache Software Foundation
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
-->
<configuration>
<property>
<name>hbase.rootdir</name>
<value>/hbase_temp/data</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/tmp/hsperfdata_solgle</value>
</property>
  <property>
<name>hbase.zookeeper.quorum</name>
<value>solgle-PC</value>
</property>
<property>
         <name>dfs.replication</name>
         <value>1</value>
 </property>
 
</configuration>
 
 
----hbase启动和关闭
solgle@solgle-PC /usr/local/hbase-0.94.27/bin
$ ./start-hbase.sh
cygpath: cannot create short name of C:\cygwin64\usr\local\hbase-0.94.27\logs
cygpath: cannot create short name of C:\cygwin64\usr\local\hbase-0.94.27\logs
localhost: starting zookeeper, logging to /usr/local/hbase-0.94.27/bin/../logs/hbase-solgle-zookeeper-solgle-PC.out
starting master, logging to /usr/local/hbase-0.94.27/bin/../logs/hbase-solgle-master-solgle-PC.out
localhost: starting regionserver, logging to /usr/local/hbase-0.94.27/bin/../logs/hbase-solgle-regionserver-solgle-PC.out
 
solgle@solgle-PC /usr/local/hbase-0.94.27/bin
$ ./stop-hbase.sh
stopping hbase
 
solgle@solgle-PC /usr/local/hbase-0.94.27/bin
$ ./start-hbase.sh
localhost: zookeeper running as process 6140. Stop it first.
starting master, logging to /usr/local/hbase-0.94.27/bin/../logs/hbase-solgle-master-solgle-PC.out
localhost: starting regionserver, logging to /usr/local/hbase-0.94.27/bin/../logs/hbase-solgle-regionserver-solgle-PC.out
 
solgle@solgle-PC /usr/local/hbase-0.94.27/bin
$
 
 
hbase-site.xml参数详细说明
 
http://greatwqs.iteye.com/blog/1837178
 
 
 
 
----shell op
 
solgle@solgle-PC /usr/local/hbase-0.94.27/bin
$ ./hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.27, rfb434617716493eac82b55180b0bbd653beb90bf, Thu Mar 19 06:17:55 UTC 2015
 
list
list
TABLE
0 row(s) in 2.4070 seconds
 
 
标签:在windows上部署Hbase 

solgle.com 版权所有,欢迎分享!!!

上一篇:Hadoop发展简史
下一篇:Hadoop Shell命令
相关文章
    相关评论
       Copyright © 2013-2020 solgle.com,All rights reserved.[solgle.com] 公安机关备案号:51010802000219
    Email:solgle@solgle.com; weixin:cd1008610000 ICP:蜀ICP备14011070号-1