【 Hypertable 有几种安装方式,入下表:
1. 单机:安装于单机,采用本地文件系统
2. Hadoop:分布式安装,在Hadoop之上(HDFS)
3. MapR:分布式安装,在MapR之上
4. ThriftBroker:在应用服务器上安装ThriftBroker 】
ThriftBroker only
(http://hypertable.com/documentation/installation/thriftbroker/)
Thrift is acommunication framework for building cross-language services. Itcombines a software stack with a code generation engine that can generateservice bindings for all popular high-level languages. Hypertableincludes a Thrift service called the ThriftBroker which is the preferredinterface to Hypertable. It provides a way for programs written innearly any language to access a Hypertable database. TheThriftBroker should run locally on all machines running application programsthat need access to Hypertable. This document describes how toinstall the ThriftBroker on an application server machine and configure itto point to a Hypertable cluster or standalone Hypertable instance.
Thrift是一个通讯框架,能够生成跨语言的服务,它有一个代码生成层,能够为几乎所有流行的高级语言生成服务绑定。Hypertable包含一个Thrift服务,叫做ThriftBroker,这是一个Hypertable特定的接口,它提供了一个访问Hypertable数据库的方法,而不管用什么语言实现。ThriftBroker应该与那些需要访问Hypertable的应用程序在一台机器上运行。本文描述了如何在应用服务器上安装ThriftBroker,并且使它能够访问集群部署或单机部署的Hypertable实例。
Table of Contents
STEP 1 - Install ThriftBroker Package
STEP 4 - Install HypertableConfiguration File
STEP 5 - Starting and StoppingThriftBroker
STEP 6 - Automating ThriftBroker withCapistrano
Prerequisites
先决条件
Before you getstarted with the installation, there are some general system requirements thatneed to be satisfied before proceeding. These requirements are describedin the following list.
- root access - If you plan to install the ThriftBroker package in the standard location (/opt/hypertable) you will need root access to create and populate that directory. You can either carry out the steps below while logged in as the root user or you need to have sudo priveleges. If you do not have root access, you can install the .tar.bz2 package anywhere you like.
- firewall - The Hypertable processes (including the ThriftBroker) use TCP and UDP to communicate with one another and with client applications. Firewalls can block this traffic and prevent the ThriftBroker from operating properly. Any firewall that blocks traffic between the ThriftBroker and the Hypertable machine(s) should be disabled or the appropriate ports should be opened up to allow Hypertable communication. See Hypertable Firewall Requirements for instructions on how to do this.
- VERSION - This document assumes that the variable $VERSION contains the version number of the ThriftBroker being installed (e.g. 0.9.5.5)
在开始安装以前,有一些基本的要求,如下:
- root用户权限 – 如果你想将ThriftBroker安装到标准位置(/opt/hypertable),你需要root账户获得该目录的创建和控制权限。你可以采用root账户登录或使用sudo权限来进行下面的安装步骤。如果你没有root权限,你能将这个.tar.bz2包安装到你喜欢的其它位置。
- 防火墙 – Hypertable进程间(包括ThriftBroker)以及与客户应用间采用TCP和UDP通讯。防火墙可能阻止这种通讯,使Hypertable不能正常工作。任何阻止这种通讯或关闭特定端口的防火墙都不应该打开,Hypertable必需通过特定的端口通讯。关于如何做请参阅“Hypertable Firewall Requirements”(http://hypertable.com/documentation/misc/firewall_requirements/)。
- 版本 -.本文假定环境变量$VERSION包含安装的ThriftBroker的版本号(例如0.9.5.5)。
STEP1 - Install ThriftBroker Package
步骤1– 安装ThriftBroker
The ThriftBroker is installed via binarypackages which can be found on the Hypertable Download page. For theThriftBroker installation, choose one of the thriftbroker-only packages. The packages come bundled with nearly all of the dependent sharedlibraries. The nice thing about this approach is that just two packages arerequired for linux, a 64-bit linux package and a 32-bit linux package. The onlyrequirement is that your system is built with glibc 2.4+ (released on March 6th2006) which provides stack smashing protection. The ThriftBrokercomes with a program launch script, ht, that sets up LD_LIBRARY_PATH (orDYLD_LIBRARY_PATH) to point to the lib/ directory of the installation so thatthe dependent libraries can be found by the dynamic linker.
To begin the package installation, switch tothe directory containing the package file and then issue the command listedbelow for your operating system.
ThriftBroker可以通过二进制包来安装,该包可以从Hypertable网站的Download页下载。对ThriftBroker安装来说,选择一个仅有ThriftBroker的包。这些包包含了几乎所有依赖的共享库。采用这种方法安装,在Linux上只需要两个包:64位Linux包和32位Linux包。唯一的要求是你的系统构建于glibc2.4(2006年3月6日发布)及以上,该版中,提供了栈(溢出)保护。ThriftBroker带着一个启动脚本ht,它创建了LD_LIBRARY_PATH (或 DYLD_LIBRARY_PATH),指向安装目录的lib/目录,则动态链接器能找到依赖的库。
安装包时,切换到包含安装包的目录,根据操作系统的不同,使用以下命令。
Redhat, CentOS, or SUSE Installation
$ sudo rpm -ivh --replacepkgs --nomd5 package.rpm
Debian or Ubuntu Installation
$ sudo dpkg --install package.deb
Bzipped Archive Installation
$ sudo tar xjvf package.tar.bz2
Mac installation
Double-click the package.dmg file and follow theinstructions
The Redhat, Debian, and Mac packages willinstall the ThriftBroker under a directory by the name of/opt/hypertable/$VERSION by default. You will need to change theownership of the installation files and directories to the owner that you planto launch the services as. For example:
在RedHat,Debian和Mac下,缺省情况时会将ThriftBroker安装到/opt/hypertable/$VERSION下,你需要更改安装目录和文件的所有者,变为你打算采用的启动服务的用户,例如
sudo chown -R john:staff /opt/hypertable/$VERSION
STEP 2 - FHS-izeInstallation
步骤2– FHS-ize安装
See Filesystem Hierarchy Standard for an introduction to FHS. Create the directories /etc/opt/hypertableand /var/opt/hypertable and change ownership to the user account underwhich the binaries will be run. For example:
FHS的介绍参阅“Filesystem Hierarchy Standard”(http://hypertable.com/documentation/misc/filesystem_hierarchy_standard_fhs/)。在机架的所有机器上创建两个目录/etc/opt/hypertable和 /var/opt/hypertable,修改其所有者为运行者账户,例如:
$ sudo mkdir /etc/opt/hypertable /var/opt/hypertable
$ sudo chown john:staff /etc/opt/hypertable/var/opt/hypertable
Then FHS-ize the installation with thefollowing command:
然后,采用如下命令FHS-ize安装过程:
$ /opt/hypertable/$VERSION/bin/fhsize.sh
STEP 3 - Set "current" Link
步骤3-设置”current”链接
To make the latest version of theThriftBroker referenceable from a well-known location, we recommend setting a"current" link to point to the latest installation. Afterinstallation, make a symlink from /opt/hypertable/current to point to thelatest installed version.
为使ThriftBroker能从一个公开的位置得到最新的版本,建议设置一个”current”,指向最新版Hypertable的安装位置。安装完成后,建立一个符号链接从/opt/hypertable/current指向最新版的安装。
$ cd /opt/hypertable
$ ln -s $VERSION current
STEP4 - Install Hypertable Configuration File
步骤4– 安装Hypertable配置文件
In order for the ThriftBroker to communicatewith the Hypertable cluster, you will need to install the hypertable.cfg filethat was configured for your Hypertable cluster. Assuming that youinstalled Hypertable on a machine called hypertable-master (either thestandalone machine, or the cluster installation machine running a HypertableMaster), you can copy the configuration file from that machine into yourThriftBroker-only installation as follows.
为了ThriftBroker能够与Hypertable集群通讯,你需要安装你的Hypertable集群的配置文件hypertable.cfg。假设你已经在一台叫”hypertable-master”的机器上安装了Hypertable(无论其是单机还是集群中Master),拷贝该配置文件到你安装ThriftBroker的机器上,命令如下:
$ scphypertable-master:/opt/hypertable/current/conf/hypertable.cfg /opt/hypertable/current/conf/
STEP5 - Starting and Stopping ThriftBroker
步骤5– 启停ThriftBroker
The ThriftBroker installation includesscripts that can be used to start and stop the ThriftBroker. Thefollowing example shows how to run the start-thriftbroker.sh script to launchthe ThriftBroker.
ThriftBroker安装中包括启停ThriftBroker的脚本,下面是用start-thriftbroker.sh启动ThriftBroker的例子:
$ /opt/hypertable/current/bin/start-thriftbroker.sh
Started ThriftBroker
The following example shows how to stop theThriftBroker.
下面的例子显示了如何停止ThriftBroker。
/opt/hypertable/current/bin/stop-servers.sh
Killing ThriftBroker.pid 50744
Shutdown thrift broker complete
STEP6 - Automating ThriftBroker with Capistrano
步骤6– 用Capistrano来自动化ThriftBroker
The Capistrano remote task automation tool can be used to administer a Hypertablecluster. Included in the Hypertable distribution is a Capistrano recipefile (Capfile) that defines tasks and roles for starting and stopping theHypertable processes and performing other administrative operations. Oneof the roles defined in the default Capfile is the thriftbroker role. This role is intended for hosts that run ThriftBrokers only.
NOTE: ThriftBrokers are startedautomatically on all of the hosts in the slave role in order tosupport MapReduce, so it is not necessary to add the Hypertable RangeServerhosts to the thriftbroker role.
Once the thriftbroker role has beenconfigured with the appropriate hosts, ThriftBrokers can be started on those hostswith the following command.
Capistrano远程任务自动管理工具能够用来管理Hypertable。Hypertable发行包中包含了一个Capistrano运行配置文件(Capfile),其中定义了启停Hypertable进程和其他管理操作的任务及其角色。缺省的Capfile中定义的一个角色就是thriftbroker角色,该角色的目的就是充当ThriftBroker的主机。
注:为支持MapReduce,所有slave角色上的ThriftBroker会自动启动,所以没有必要将Hypertable RangeServer的宿主机加入到thriftbroker角色中。
一旦thriftbroker角色与它的宿主被正确配置,ThriftBroker就能用如下命令在宿主中启动:
$ cap start_thriftbrokers
The ThriftBrokers running on the hosts in thethriftbroker role can be stopped with this command:
在宿主中运行的thriftbroker角色能用如下的命令停止:
$ cap stop_thriftbrokers