本文共 10194 字,大约阅读时间需要 33 分钟。
目录
http://hypertable.org/
过程 37.1. Hypertable standalone 安装过程
安装 Hypertable 软件包
# cd /usr/local/src/# wget http://cdn.hypertable.com/packages/0.9.7.0/hypertable-0.9.7.0-linux-x86_64.rpm
安装 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)
Hypertable 默认安装在 /opt/hypertable/0.9.7.0
备份配置文件,
# cd /opt/hypertable/0.9.7.0/conf# cp hypertable.cfg hypertable.cfg.original
FHS-IZE 安装
# bin/fhsize.shSetting up /var/opt/hypertableSetting up /etc/opt/hypertablefshize /opt/hypertable/0.9.7.0: success
设计 "CURRENT" 连接
# cd /opt/hypertable# ln -s 0.9.7.0 current
安装 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."
启动 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>
测试安装是否有效
# /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
停止 hypertable
运行下列命令停止 Hypertable
$ /opt/hypertable/current/bin/stop-servers.sh
Hadoop - HDFS 安装指南
过程 37.2. Hypertable on HDFS
创建工作目录
$ hadoop fs -mkdir /hypertable$ hadoop fs -chmod 777 /hypertable
安装 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
修改 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
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.xmlfs.default.name hdfs://namenode.example.com:9000 hadoop.tmp.dir /var/tmp/hadoop
Hadoop 配置文件 /etc/hadoop/hdfs-site.xml
# cat /etc/hadoop/hdfs-site.xmldfs.name.dir /var/hadoop/name1 dfs.data.dir /var/hadoop/hdfs/data1 dfs.replication 2
启动 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
修改 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
创建一个表
# 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