博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第 37 章 Hypertable
阅读量:6955 次
发布时间:2019-06-27

本文共 10194 字,大约阅读时间需要 33 分钟。

目录

37.1. Hypertable 安装
37.1.1. Hypertable standalone 单机安装
37.1.2. Hypertable on HDFS(hadoop) 安装
37.1.3. MapR
37.1.4. Ceph
37.1.5. 检验安装
37.2. Code examples
37.2.1. PHP
37.3. HQL
37.3.1. namespace 命名空间管理
37.3.2. Table 表
37.4. FAQ
37.4.1. 切换 DFS Broker

http://hypertable.org/

37.1. Hypertable 安装

37.1.1. Hypertable standalone 单机安装

过程 37.1. Hypertable standalone 安装过程

  1. 安装 Hypertable 软件包

    # cd /usr/local/src/# wget http://cdn.hypertable.com/packages/0.9.7.0/hypertable-0.9.7.0-linux-x86_64.rpm
  2. 安装 Hypertable, 我个人比较喜欢用yum localinstall他会解决软件之间的依赖关系

    # yum localinstall hypertable-0.9.7.0-linux-x86_64.rpm

    相关的软件会自动安装

    Dependencies Resolved==================================================================================================================== Package                       Arch          Version                  Repository                               Size====================================================================================================================Installing: hypertable                    x86_64        0.9.7.0-1                /hypertable-0.9.7.0-linux-x86_64        288 MInstalling for dependencies: mailcap                       noarch        2.1.31-2.el6             base                                     27 k perl-Bit-Vector               x86_64        7.1-2.el6                base                                    169 k perl-Carp-Clan                noarch        6.03-2.el6               base                                     25 k perl-Compress-Raw-Zlib        x86_64        1:2.020-127.el6          base                                     68 k perl-Compress-Zlib            x86_64        2.020-127.el6            base                                     43 k perl-HTML-Parser              x86_64        3.64-2.el6               base                                    109 k perl-HTML-Tagset              noarch        3.20-4.el6               base                                     17 k perl-IO-Compress-Base         x86_64        2.020-127.el6            base                                     67 k perl-IO-Compress-Zlib         x86_64        2.020-127.el6            base                                    134 k perl-IO-String                noarch        1.08-9.el6               base                                     15 k perl-URI                      noarch        1.40-2.el6               base                                    117 k perl-libwww-perl              noarch        5.833-2.el6              base                                    387 kTransaction Summary====================================================================================================================Install      13 Package(s)
  3. Hypertable 默认安装在 /opt/hypertable/0.9.7.0

    备份配置文件,

    # cd /opt/hypertable/0.9.7.0/conf# cp hypertable.cfg hypertable.cfg.original
  4. FHS-IZE 安装

    # bin/fhsize.shSetting up /var/opt/hypertableSetting up /etc/opt/hypertablefshize /opt/hypertable/0.9.7.0:  success
  5. 设计 "CURRENT" 连接

    # cd /opt/hypertable# ln -s 0.9.7.0 current
  6. 安装 notification-hook.sh 脚本.

    # cp conf/notification-hook.tmpl conf/notification-hook.sh# chmod o+x conf/notification-hook.sh

    测试 notification-hook.sh脚本 .

    /opt/hypertable/current/conf/notification-hook.sh "Test Message" "This is a test."
  7. 启动 hypertable

    # /opt/hypertable/current/bin/start-all-servers.sh localDFS broker: available file descriptors: 1024Started DFS Broker (local)Started HyperspaceStarted Hypertable.Master/proc/sys/vm/swappiness = 60Started Hypertable.RangeServerStarted ThriftBroker
    # /opt/hypertable/current/bin/ht shellWelcome to the hypertable command interpreter.For information about Hypertable, visit http://hypertable.comType 'help' for a list of commands, or 'help shell' for alist of shell meta commands.hypertable>
  8. 测试安装是否有效

    # /opt/hypertable/current/bin/ht shellWelcome to the hypertable command interpreter.For information about Hypertable, visit http://hypertable.comType 'help' for a list of commands, or 'help shell' for alist of shell meta commands.hypertable> helpUSE ................ Sets the current namespaceCREATE NAMESPACE ... Creates a new namespaceDROP NAMESPACE ..... Removes a namespaceEXISTS TABLE ....... Check if table existsCREATE TABLE ....... Creates a tableDELETE ............. Deletes all or part of a row from a tableDESCRIBE TABLE ..... Displays a table's schemaDROP TABLE ......... Removes a tableRENAME TABLE ....... Renames a tableDUMP TABLE ......... Create efficient backup fileALTER TABLE ........ Add/remove column family from existing tableINSERT ............. Inserts data into a tableLOAD DATA INFILE ... Loads data from a TSV input file into a tableSELECT ............. Selects (and display) cells from a tableSHOW CREATE TABLE .. Displays CREATE TABLE command used to create tableSHOW TABLES ........ Displays only the list of tables in the current namespaceGET LISTING ........ Displays the list of tables and namespace in the current namespaceStatements must be terminated with ';'.  For more information ona specific statement, type 'help 
    ', where
    is fromthe preceding list.hypertable>quit
  9. 停止 hypertable

    运行下列命令停止 Hypertable

    $ /opt/hypertable/current/bin/stop-servers.sh

37.1.2. Hypertable on HDFS(hadoop) 安装

Hadoop - HDFS 安装指南

过程 37.2. Hypertable on HDFS

  1. 创建工作目录

    $ hadoop fs -mkdir /hypertable$ hadoop fs -chmod 777 /hypertable
  2. 安装 Java 运行环境

    yum install java-1.7.0-openjdkyum localinstall http://ftp.cuhk.edu.hk/pub/packages/apache.org/hadoop/common/hadoop-1.1.2/hadoop-1.1.2-1.x86_64.rpm
  3. 修改 jrun bug

    cp /opt/hypertable/current/bin/jrun /opt/hypertable/current/bin/jrun.oldvim /opt/hypertable/current/bin/jrun#HT_JAR=`ls -1 /opt/hypertable/doug/current/lib/java/*.jar | grep "hypertable-[^-]*.jar" | awk 'BEGIN {FS="/"} {print $NF}'`HT_JAR=`ls -1 /opt/hypertable/current/lib/java/*.jar | grep "hypertable-[^-]*.jar" | awk 'BEGIN {FS="/"} {print $NF}'`
    export JAVA_HOME=/usr export HADOOP_HOME=/usr export HYPERTABLE_HOME=/opt/hypertable/current
  4. hypertable.cfg

    # cat conf/hypertable.cfg## hypertable.cfg## HDFS Broker#HdfsBroker.Hadoop.ConfDir=/etc/hadoop/confHdfsBroker.Hadoop.ConfDir=/etc/hadoop# Ceph BrokerCephBroker.MonAddr=192.168.6.2:6789# Local BrokerDfsBroker.Local.Root=fs/local# DFS Broker - for clientsDfsBroker.Port=38030# HyperspaceHyperspace.Replica.Host=localhostHyperspace.Replica.Port=38040Hyperspace.Replica.Dir=hyperspace# Hypertable.Master#Hypertable.Master.Host=localhostHypertable.Master.Port=38050# Hypertable.RangeServerHypertable.RangeServer.Port=38060Hyperspace.KeepAlive.Interval=30000Hyperspace.Lease.Interval=1000000Hyperspace.GracePeriod=200000# ThriftBrokerThriftBroker.Port=38080

    Hadoop 配置文件 /etc/hadoop/core-site.xml

    # cat /etc/hadoop/core-site.xml
    fs.default.name
    hdfs://namenode.example.com:9000
    hadoop.tmp.dir
    /var/tmp/hadoop

    Hadoop 配置文件 /etc/hadoop/hdfs-site.xml

    # cat /etc/hadoop/hdfs-site.xml
    dfs.name.dir
    /var/hadoop/name1
    dfs.data.dir
    /var/hadoop/hdfs/data1
    dfs.replication
    2
  5. 启动 dfsbroker

    # /opt/hypertable/current/bin/set-hadoop-distro.sh cdh4Hypertable successfully configured for Hadoop cdh4
    # /opt/hypertable/current/bin/start-dfsbroker.sh hadoopDFS broker: available file descriptors: 1024Started DFS Broker (hadoop)

    查看启动日志

    # tail -f /opt/hypertable/current/log/DfsBroker.hadoop.loglog4j:WARN No appenders could be found for logger (org.apache.hadoop.conf.Configuration).log4j:WARN Please initialize the log4j system properly.HdfsBroker.dfs.client.read.shortcircuit=falseHdfsBroker.dfs.replication=2HdfsBroker.Server.fs.default.name=hdfs://namenode.example.com:9000Apr 23, 2013 6:43:18 PM org.hypertable.AsyncComm.IOHandler DeliverEventINFO: [/192.168.6.25:53556 ; Tue Apr 23 18:43:18 HKT 2013] Connection EstablishedApr 23, 2013 6:43:18 PM org.hypertable.DfsBroker.hadoop.ConnectionHandler handleINFO: [/192.168.6.25:53556 ; Tue Apr 23 18:43:18 HKT 2013] Disconnect - COMM broken connection : Closing all open handles from /192.168.6.25:53556Closed 0 input streams and 0 output streams for client connection /192.168.6.25:53556

37.1.3. MapR

37.1.4. Ceph

修改 CephBroker.MonAddr 对应的服务器与端口号即可

# cat hypertable.cfg## hypertable.cfg## HDFS BrokerHdfsBroker.Hadoop.ConfDir=/etc/hadoop/conf# Ceph BrokerCephBroker.MonAddr=192.168.6.2:6789# Local BrokerDfsBroker.Local.Root=fs/local# DFS Broker - for clientsDfsBroker.Port=38030# HyperspaceHyperspace.Replica.Host=localhostHyperspace.Replica.Port=38040Hyperspace.Replica.Dir=hyperspace# Hypertable.MasterHypertable.Master.Port=38050# Hypertable.RangeServerHypertable.RangeServer.Port=38060Hyperspace.KeepAlive.Interval=30000Hyperspace.Lease.Interval=1000000Hyperspace.GracePeriod=200000# ThriftBrokerThriftBroker.Port=38080

启动 dfsbroker

# /opt/hypertable/current/bin/start-dfsbroker.sh ceph

37.1.5. 检验安装

创建一个表

# echo "USE '/'; CREATE TABLE foo ( c1, c2 ); GET LISTING;" \>     | /opt/hypertable/current/bin/ht shell --batchfoosys	(namespace)tmp	(namespace)

插入一些数据

# echo "USE '/'; INSERT INTO foo VALUES('001', 'c1', 'very'), \>     ('000', 'c1', 'Hypertable'), ('001', 'c2', 'easy'), ('000', 'c2', 'is');" \>     | /opt/hypertable/current/bin/ht shell --batch

查询数据

# echo "USE '/'; SELECT * FROM foo;" \>     | /opt/hypertable/current/bin/ht shell --batch000	c1	Hypertable000	c2	is001	c1	very001	c2	easy

如果你想清楚所有表运行下面命令

$ /opt/hypertable/current/bin/stop-servers.sh$ /opt/hypertable/current/bin/clean-database.sh

原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

你可能感兴趣的文章
使用Vitamio打造自己的Android万能播放器(3)——本地播放(主界面、播放列表)...
查看>>
在网页div,table,p,span,body,等很多元素中输入内容.
查看>>
采用oracle存储过程读取excel文件更新表
查看>>
JRuby 1.7.0 发布:默认使用Rudy1.9 模式,并可使用InvokeDynamic
查看>>
详解PHP的SQL注入(转)
查看>>
HTML5实践 -- CSS3 Media Queries
查看>>
44个独具创意的404错误页面
查看>>
身份证信息查询系统
查看>>
jqueryMobile框架页面与页面切换
查看>>
对PostgreSQL中tablespace 与 database, table的理解
查看>>
图像编辑之一键特效(Lomo,反转负冲,柔光)
查看>>
linux modprobe命令参数及用法详解--linux加载模块命令
查看>>
从SQLSERVER/MYSQL数据库中随机取一条或者N条记录
查看>>
flex中dispatchEvent的用法(自定义事件) .
查看>>
html网页编码问题
查看>>
【Java】环境变量的配置
查看>>
排序算法——快速排序(转)
查看>>
上海交通大学2003年数学分析考研试题
查看>>
Qt搭建多线程Server
查看>>
Android应用公布的准备——生成渠道包
查看>>