HBASE-3606 Create an package integration project (Eric Yang via Ryan)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1081964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Rawson 2011-03-15 22:20:08 +00:00
parent 6e3c8eed74
commit 4e50338bb6
22 changed files with 1361 additions and 2 deletions

View File

@ -137,6 +137,7 @@ Release 0.91.0 - Unreleased
0.91
HBASE-3257 Coprocessors: Extend server side API to include HLog operations
(Mingjie Lai via Andrew Purtell)
HBASE-3606 Create an package integration project (Eric Yang via Ryan)
Release 0.90.2 - Unreleased

89
pom.xml
View File

@ -343,6 +343,15 @@
<descriptor>src/assembly/all.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>tarball</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Run with -Dmaven.test.skip.exec=true to build -tests.jar without running tests (this is needed for upstream projects whose tests need this jar simply for compilation)-->
@ -351,6 +360,7 @@
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>test-jar</goal>
</goals>
@ -379,7 +389,7 @@
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<phase>prepare-package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
@ -530,6 +540,15 @@
<thrift.version>0.5.0</thrift.version><!-- newer version available -->
<zookeeper.version>3.3.2</zookeeper.version>
<package.prefix>/usr</package.prefix>
<package.conf.dir>/etc/hbase</package.conf.dir>
<package.log.dir>/var/log/hbase</package.log.dir>
<package.pid.dir>/var/run/hbase</package.pid.dir>
<package.release>1</package.release>
<!-- also must update this when we bump version -->
<package.version>0.91.0</package.version>
<final.name>${artifactId}-${version}</final.name>
<!-- For flaky tests exclusion -->
<test.exclude></test.exclude>
<test.exclude.pattern>**/${test.exclude}.java</test.exclude.pattern>
@ -841,7 +860,73 @@
$ mvn -s /my/path/settings.xml deploy
-->
<profiles>
<profile>
<id>rpm</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>build-rpm</id>
<phase>package</phase>
<configuration>
<target>
<ant antfile="${basedir}/src/packages/build.xml">
<target name="package-rpm"/>
<target name="package-conf-pseudo-rpm"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deb</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>build-deb</id>
<phase>package</phase>
<configuration>
<target>
<property name="artifactId" value="${artifactId}" />
<ant antfile="${basedir}/src/packages/build.xml">
<target name="package-deb"/>
<target name="package-conf-pseudo-deb"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>0.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<!-- See http://jira.codehaus.org/browse/MSITE-443 why the settings need to be here and not in pluginManagement. -->
<reporting>
<plugins>

View File

@ -50,6 +50,14 @@
<directory>target/site</directory>
<outputDirectory>docs</outputDirectory>
</fileSet>
<fileSet>
<directory>src/packages</directory>
<outputDirectory>sbin</outputDirectory>
<fileMode>755</fileMode>
<includes>
<include>update-hbase-env.sh</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>

149
src/packages/build.xml Normal file
View File

@ -0,0 +1,149 @@
<?xml version="1.0"?>
<!--
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.
-->
<project name="hbase packaging">
<target name="package-deb">
<taskdef name="deb"
classname="org.vafer.jdeb.ant.DebAntTask">
</taskdef>
<mkdir dir="${project.build.directory}/deb/hbase.control" />
<copy todir="${project.build.directory}/deb/hbase.control">
<fileset dir="${basedir}/src/packages/deb/hbase.control">
<exclude name="control" />
</fileset>
</copy>
<copy file="src/packages/deb/hbase.control/control" todir="${basedir}/target/deb/hbase.control">
<filterchain>
<replacetokens>
<token key="version" value="${package.version}" />
</replacetokens>
</filterchain>
</copy>
<deb destfile="${project.build.directory}/${artifactId}_${package.version}-${package.release}_${os.arch}.deb" control="${basedir}/target/deb/hbase.control">
<data src="${project.build.directory}/${final.name}.tar.gz">
<mapper type="prefix" strip="1" prefix="${package.prefix}/share/hbase" />
<exclude name="${final.name}/conf" />
<exclude name="${final.name}/conf/*" />
<exclude name="${final.name}/lib/zookeeper*" />
<exclude name="${final.name}/lib/hadoop-core*" />
<include name="**" />
</data>
<tarfileset dir="${basedir}/src/packages" filemode="755" prefix="${package.prefix}/share/hbase/sbin">
<exclude name=".svn" />
<include name="*.sh" />
</tarfileset>
<tarfileset dir="${basedir}/src/packages/deb/init.d" filemode="755" prefix="${package.prefix}/share/hbase/sbin">
<exclude name=".svn" />
<include name="**" />
</tarfileset>
<tarfileset dir="${basedir}/conf" filemode="644" prefix="${package.conf.dir}">
<exclude name="hbase-site.xml" />
<exclude name=".svn" />
<include name="**" />
</tarfileset>
</deb>
</target>
<target name="package-conf-pseudo-deb">
<taskdef name="deb"
classname="org.vafer.jdeb.ant.DebAntTask">
</taskdef>
<mkdir dir="${project.build.directory}/deb/conf-pseudo.control" />
<copy todir="${project.build.directory}/deb/conf-pseudo.control">
<fileset dir="${basedir}/src/packages/deb/conf-pseudo.control">
<exclude name="control" />
</fileset>
</copy>
<copy file="src/packages/deb/conf-pseudo.control/control" todir="${basedir}/target/deb/conf-pseudo.control">
<filterchain>
<replacetokens>
<token key="version" value="${package.version}" />
</replacetokens>
</filterchain>
</copy>
<deb destfile="${project.build.directory}/${artifactId}-conf-pseudo_${package.version}-${package.release}_${os.arch}.deb" control="${basedir}/target/deb/conf-pseudo.control">
<tarfileset dir="${basedir}/src/packages/conf-pseudo" filemode="644" prefix="${package.conf.dir}">
<exclude name=".svn" />
<include name="**" />
</tarfileset>
</deb>
</target>
<target name="package-rpm">
<delete dir="${project.build.directory}/rpm/hbase/buildroot" />
<mkdir dir="${project.build.directory}/rpm/hbase/SOURCES" />
<mkdir dir="${project.build.directory}/rpm/hbase/BUILD" />
<mkdir dir="${project.build.directory}/rpm/hbase/RPMS" />
<mkdir dir="${project.build.directory}/rpm/hbase/buildroot" />
<copy file="${project.build.directory}/${final.name}.tar.gz" todir="${project.build.directory}/rpm/hbase/SOURCES" />
<copy file="src/packages/rpm/spec/hbase.spec" todir="target/rpm/hbase/SPECS">
<filterchain>
<replacetokens>
<token key="final.name" value="${final.name}" />
<token key="version" value="${package.version}" />
<token key="package.name" value="${final.name}.tar.gz" />
<token key="package.release" value="${package.release}" />
<token key="package.build.dir" value="${project.build.directory}/rpm/hbase/BUILD" />
<token key="package.prefix" value="${package.prefix}" />
<token key="package.conf.dir" value="${package.conf.dir}" />
<token key="package.log.dir" value="${package.log.dir}" />
<token key="package.pid.dir" value="${package.pid.dir}" />
</replacetokens>
</filterchain>
</copy>
<rpm specFile="hbase.spec" command="-bb" topDir="${project.build.directory}/rpm/hbase" cleanBuildDir="true" failOnError="true"/>
<copy todir="${project.build.directory}" flatten="true">
<fileset dir="${project.build.directory}/rpm/hbase/RPMS">
<include name="**/*.rpm" />
</fileset>
</copy>
<delete dir="${project.build.directory}/rpm" />
</target>
<target name="package-conf-pseudo-rpm">
<delete dir="${project.build.directory}/rpm/hbase/buildroot" />
<mkdir dir="${project.build.directory}/rpm/hbase/SOURCES" />
<mkdir dir="${project.build.directory}/rpm/hbase/BUILD" />
<mkdir dir="${project.build.directory}/rpm/hbase/RPMS" />
<mkdir dir="${project.build.directory}/rpm/hbase/buildroot" />
<copy file="${project.build.directory}/${final.name}.tar.gz" todir="${project.build.directory}/rpm/hbase/SOURCES" />
<copy file="src/packages/rpm/spec/conf-pseudo.spec" todir="target/rpm/hbase/SPECS">
<filterchain>
<replacetokens>
<token key="final.name" value="${final.name}" />
<token key="version" value="${package.version}" />
<token key="package.name" value="${final.name}.tar.gz" />
<token key="package.release" value="${package.release}" />
<token key="package.build.dir" value="${project.build.directory}/rpm/hbase/BUILD" />
<token key="package.prefix" value="${package.prefix}" />
<token key="package.conf.dir" value="${package.conf.dir}" />
<token key="package.log.dir" value="${package.log.dir}" />
<token key="package.pid.dir" value="${package.pid.dir}" />
</replacetokens>
</filterchain>
</copy>
<rpm specFile="conf-pseudo.spec" command="-bb" topDir="${project.build.directory}/rpm/hbase" cleanBuildDir="true" failOnError="true"/>
<copy todir="${project.build.directory}" flatten="true">
<fileset dir="${project.build.directory}/rpm/hbase/RPMS">
<include name="**/*.rpm" />
</fileset>
</copy>
<delete dir="${project.build.directory}/rpm" />
</target>
</project>

View File

@ -0,0 +1,68 @@
<?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>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>The mode the cluster will be in. Possible values are
false: standalone and pseudo-distributed setups with managed Zookeeper
true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
</description>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
<description>Property from ZooKeeper's config zoo.cfg.
The port at which the clients will connect.
</description>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count.
</description>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
<description>Comma separated list of servers in the ZooKeeper Quorum.
For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
By default this is set to localhost for local and pseudo-distributed modes
of operation. For a fully-distributed setup, this should be set to a full
list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh
this is the list of servers which we will start/stop ZooKeeper on.
</description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/var/lib/zookeeper/data</value>
<description>Property from ZooKeeper's config zoo.cfg.
The directory where the snapshot is stored.
</description>
</property>
</configuration>

View File

@ -0,0 +1 @@
/etc/hbase/hbase-site.xml

View File

@ -0,0 +1,9 @@
Package: hbase-conf-pseudo
Version: @version@
Section: misc
Priority: optional
Architecture: all
Depends: openjdk-6-jre-headless, hadoop, zookeeper, hbase
Maintainer: Apache Software Foundation <dev@hbase.apache.org>
Description: HBase pseudo cluster configuration for single node cluster testing.
Distribution: development

View File

@ -0,0 +1,26 @@
#!/bin/sh
# 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.
/etc/init.d/hadoop-namenode start 2>/dev/null >/dev/null
/etc/init.d/hadoop-datanode start 2>/dev/null >/dev/null
su - hdfs -c "hadoop fs -mkdir /hbase" 2>/dev/null >/dev/null
su - hdfs -c "hadoop fs -chown hbase /hbase" 2>/dev/null >/dev/null
/etc/init.d/hbase-master start 2>/dev/null >/dev/null
/etc/init.d/hbase-regionserver start 2>/dev/null >/dev/null
ln -sf ../init.d/hbase-master /etc/rc2.d/S94hbase-master
ln -sf ../init.d/hbase-regionserver /etc/rc6.d/S94hbase-regionserver

View File

@ -0,0 +1,21 @@
#!/bin/sh
# 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.
/etc/init.d/hbase-regionserver stop 2>/dev/null >/dev/null
/etc/init.d/hbase-master stop 2>/dev/null >/dev/null
rm -f /etc/rc2.d/S94hbase-master
rm -f /etc/rc2.d/S94hbase-regionserver

View File

@ -0,0 +1,5 @@
/etc/hbase/hadoop-metrics.properties
/etc/hbase/hbase-env.sh
/etc/hbase/hbase-site.xml
/etc/hbase/log4j.properties
/etc/hbase/regionservers

View File

@ -0,0 +1,9 @@
Package: hbase
Version: @version@
Section: misc
Priority: optional
Architecture: all
Depends: openjdk-6-jre-headless, hadoop, zookeeper
Maintainer: Apache Software Foundation <dev@hbase.apache.org>
Description: HBase is the Hadoop database. Use it when you need random, realtime read/write access to your Big Data. This project's goal is the hosting of very large tables -- billions of rows X millions of columns -- atop clusters of commodity hardware.
Distribution: development

View File

@ -0,0 +1,24 @@
#!/bin/sh
# 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.
bash /usr/share/hbase/sbin/update-hbase-env.sh \
--prefix=/usr \
--bin-dir=/usr/bin \
--conf-dir=/etc/hbase \
--log-dir=/var/log/hbase \
--pid-dir=/var/run/hbase

View File

@ -0,0 +1,20 @@
#!/bin/sh
# 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.
/usr/sbin/userdel hbase 2> /dev/null >/dev/null
exit 0

View File

@ -0,0 +1,21 @@
#!/bin/sh
# 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.
getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -r hadoop
/usr/sbin/useradd --comment "HBase" --shell /bin/bash -M -r --groups hadoop --home /usr/share/hbase hbase 2> /dev/null || :

View File

@ -0,0 +1,27 @@
#!/bin/sh
# 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.
/etc/init.d/hbase-master stop 2>/dev/null >/dev/null
/etc/init.d/hbase-regionserver stop 2>/dev/null >/dev/null
bash /usr/share/hbase/sbin/update-hbase-env.sh \
--prefix=/usr \
--bin-dir=/usr/bin \
--conf-dir=/etc/hbase \
--log-dir=/var/log/hbase \
--pid-dir=/var/run/hbase \
--uninstal

View File

@ -0,0 +1,142 @@
#! /bin/sh
# 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.
### BEGIN INIT INFO
# Provides: hbase-master
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Apache HBase Master
### END INIT INFO
set -e
# /etc/init.d/hbase-master: start and stop the Apache HBase Master daemon
test -x /usr/bin/hbase || exit 0
( /usr/bin/hbase 2>&1 | grep -q hbase ) 2>/dev/null || exit 0
umask 022
if test -f /etc/default/hbase-env.sh; then
. /etc/default/hbase-env.sh
fi
. /lib/lsb/init-functions
# Are we running from init?
run_by_init() {
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
}
check_for_no_start() {
# forget it if we're trying to start, and /etc/hbase/hbase-master_not_to_be_run exists
if [ -e /etc/hbase/hbase-master_not_to_be_run ]; then
if [ "$1" = log_end_msg ]; then
log_end_msg 0
fi
if ! run_by_init; then
log_action_msg "Apache HBase Master server not in use (/etc/hbase/hbase-master_not_to_be_run)"
fi
exit 0
fi
}
check_privsep_dir() {
# Create the PrivSep empty dir if necessary
if [ ! -d ${HBASE_PID_DIR} ]; then
mkdir -p ${HBASE_PID_DIR}
chown root:hadoop ${HBASE_PID_DIR}
chmod 0775 ${HBASE_PID_DIR}
fi
}
export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin"
case "$1" in
start)
check_privsep_dir
check_for_no_start
log_daemon_msg "Starting Apache HBase Master server" "hbase-master"
if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start master; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping Apache HBase Master server" "hbase-master"
if start-stop-daemon --stop --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid; then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart)
check_privsep_dir
log_daemon_msg "Restarting Apache HBase Master server" "hbase-master"
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid
check_for_no_start log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start master; then
log_end_msg 0
else
log_end_msg 1
fi
;;
try-restart)
check_privsep_dir
log_daemon_msg "Restarting Apache HBase Master server" "hbase-master"
set +e
start-stop-daemon --stop --quiet --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid
RET="$?"
set -e
case $RET in
0)
# old daemon stopped
check_for_no_start log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start master; then
log_end_msg 0
else
log_end_msg 1
fi
;;
1)
# daemon not running
log_progress_msg "(not running)"
log_end_msg 0
;;
*)
# failed to stop
log_progress_msg "(failed to stop)"
log_end_msg 1
;;
esac
;;
status)
status_of_proc -p ${HBASE_PID_DIR}/hbase-hbase-master.pid ${JAVA_HOME}/bin/java hbase-master && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/hbase-master {start|stop|restart|try-restart|status}"
exit 1
esac
exit 0

View File

@ -0,0 +1,142 @@
#! /bin/sh
# 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.
### BEGIN INIT INFO
# Provides: hbase-regionserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Apache HBase Region Server
### END INIT INFO
set -e
# /etc/init.d/hbase-regionserver: start and stop the Apache HBase Region Server daemon
test -x /usr/bin/hbase || exit 0
( /usr/bin/hbase 2>&1 | grep -q hbase ) 2>/dev/null || exit 0
umask 022
if test -f /etc/default/hbase-env.sh; then
. /etc/default/hbase-env.sh
fi
. /lib/lsb/init-functions
# Are we running from init?
run_by_init() {
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
}
check_for_no_start() {
# forget it if we're trying to start, and /etc/hbase/hbase-regionserver_not_to_be_run exists
if [ -e /etc/hbase/hbase-regionserver_not_to_be_run ]; then
if [ "$1" = log_end_msg ]; then
log_end_msg 0
fi
if ! run_by_init; then
log_action_msg "Apache HBase Region Server server not in use (/etc/hbase/hbase-regionserver_not_to_be_run)"
fi
exit 0
fi
}
check_privsep_dir() {
# Create the PrivSep empty dir if necessary
if [ ! -d ${HBASE_PID_DIR} ]; then
mkdir -p ${HBASE_PID_DIR}
chown root:hadoop ${HBASE_PID_DIR}
chmod 0775 ${HBASE_PID_DIR}
fi
}
export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin"
case "$1" in
start)
check_privsep_dir
check_for_no_start
log_daemon_msg "Starting Apache HBase Region Server server" "hbase-regionserver"
if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start regionserver; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping Apache HBase Region Server server" "hbase-regionserver"
if start-stop-daemon --stop --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid; then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart)
check_privsep_dir
log_daemon_msg "Restarting Apache HBase Region Server server" "hbase-regionserver"
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid
check_for_no_start log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start regionserver; then
log_end_msg 0
else
log_end_msg 1
fi
;;
try-restart)
check_privsep_dir
log_daemon_msg "Restarting Apache HBase Region Server server" "hbase-regionserver"
set +e
start-stop-daemon --stop --quiet --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid
RET="$?"
set -e
case $RET in
0)
# old daemon stopped
check_for_no_start log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start regionserver; then
log_end_msg 0
else
log_end_msg 1
fi
;;
1)
# daemon not running
log_progress_msg "(not running)"
log_end_msg 0
;;
*)
# failed to stop
log_progress_msg "(failed to stop)"
log_end_msg 1
;;
esac
;;
status)
status_of_proc -p ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid ${JAVA_HOME}/bin/java hbase-regionserver && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/hbase-regionserver {start|stop|restart|try-restart|status}"
exit 1
esac
exit 0

View File

@ -0,0 +1,84 @@
#!/bin/bash
# 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.
#
# Starts a HBase master
#
# chkconfig: 2345 95 10
# description: HBase master
source /etc/rc.d/init.d/functions
source /etc/default/hbase-env.sh
RETVAL=0
PIDFILE="${HBASE_PID_DIR}/hbase-hbase-master.pid"
desc="HBase master daemon"
start() {
echo -n $"Starting $desc (hbase-master): "
daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" start master
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/hbase-master
return $RETVAL
}
stop() {
echo -n $"Stopping $desc (hbase-master): "
daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" stop master
RETVAL=$?
sleep 5
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hbase-master $PIDFILE
}
restart() {
stop
start
}
checkstatus(){
status -p $PIDFILE ${JAVA_HOME}/bin/java
RETVAL=$?
}
condrestart(){
[ -e /var/lock/subsys/hbase-master ] && restart || :
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
checkstatus
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $RETVAL

View File

@ -0,0 +1,84 @@
#!/bin/bash
# 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.
#
# Starts a HBase region server
#
# chkconfig: 2345 96 10
# description: HBase region server
source /etc/rc.d/init.d/functions
source /etc/default/hbase-env.sh
RETVAL=0
PIDFILE="${HBASE_PID_DIR}/hbase-hbase-regionserver.pid"
desc="HBase regionserver daemon"
start() {
echo -n $"Starting $desc (hbase-regionserver): "
daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" start regionserver
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/hbase-regionserver
return $RETVAL
}
stop() {
echo -n $"Stopping $desc (hbase-regionserver): "
daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" stop regionserver
RETVAL=$?
sleep 5
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hbase-regionserver $PIDFILE
}
restart() {
stop
start
}
checkstatus(){
status -p $PIDFILE ${JAVA_HOME}/bin/java
RETVAL=$?
}
condrestart(){
[ -e /var/lock/subsys/hbase-regionserver ] && restart || :
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
checkstatus
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $RETVAL

View File

@ -0,0 +1,103 @@
# 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.
#
# RPM Spec file for HBase version @version@
#
%define name hbase-conf-pseudo
%define version @version@
%define release @package.release@
# Installation Locations
%define _source @package.name@
%define _final_name @final.name@
%define _prefix @package.prefix@
%define _bin_dir %{_prefix}/bin
%define _conf_dir @package.conf.dir@
%define _include_dir %{_prefix}/include
%define _lib_dir %{_prefix}/lib
%define _lib64_dir %{_prefix}/lib64
%define _libexec_dir %{_prefix}/libexec
%define _log_dir @package.log.dir@
%define _man_dir %{_prefix}/man
%define _pid_dir @package.pid.dir@
%define _sbin_dir %{_prefix}/sbin
%define _share_dir %{_prefix}/share/hbase
%define _src_dir %{_prefix}/src
%define _var_dir %{_prefix}/var/lib
# Build time settings
%define _build_dir @package.build.dir@
%define _final_name @final.name@
%define debug_package %{nil}
Summary: Default HBase configuration templates
License: Apache License, Version 2.0
URL: http://hbase.apache.org/
Vendor: Apache Software Foundation
Group: Development/Libraries
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{_source}
Prefix: %{_prefix}
Prefix: %{_conf_dir}
Prefix: %{_log_dir}
Prefix: %{_pid_dir}
Buildroot: %{_build_dir}
Requires: hbase == %{version}, sh-utils, textutils, /usr/sbin/useradd, /usr/sbin/usermod, /sbin/chkconfig, /sbin/service, jdk >= 1.6
AutoReqProv: no
Provides: hbase-conf-pseudo
%description
Installation of this RPM will setup your machine to run in pseudo-distributed mode where each HBase daemon runs in a separate Java process.
%prep
%setup -n %{_final_name}
%build
if [ -d ${RPM_BUILD_DIR}%{_conf_dir} ]; then
rm -rf ${RPM_BUILD_DIR}%{_conf_dir}
fi
mkdir -p ${RPM_BUILD_DIR}%{_conf_dir}
mkdir -p ${RPM_BUILD_DIR}%{_share_dir}/src/packages/conf-pseudo
cp -f ${RPM_BUILD_DIR}/%{_final_name}/src/packages/conf-pseudo/hbase-site.xml ${RPM_BUILD_DIR}%{_share_dir}/src/packages/conf-pseudo/hbase-site.xml
rm -rf ${RPM_BUILD_DIR}/%{_final_name}
%preun
/sbin/chkconfig --del hbase-master
/sbin/chkconfig --del hbase-regionserver
/etc/init.d/hbase-master stop 2>/dev/null >/dev/null
/etc/init.d/hbase-regionserver stop 2>/dev/null >/dev/null
exit 0
%post
cp -f ${RPM_INSTALL_PREFIX0}/share/hbase/src/packages/conf-pseudo/*.xml ${RPM_INSTALL_PREFIX1} 2>/dev/null >/dev/null
/etc/init.d/hadoop-namenode start 2>/dev/null >/dev/null
/etc/init.d/hadoop-datanode start 2>/dev/null >/dev/null
su - hdfs -c "hadoop fs -mkdir /hbase" 2>/dev/null >/dev/null
su - hdfs -c "hadoop fs -chown hbase /hbase" 2>/dev/null >/dev/null
/etc/init.d/hbase-master start 2>/dev/null >/dev/null
/etc/init.d/hbase-regionserver start 2>/dev/null >/dev/null
/sbin/chkconfig hbase-master --add
/sbin/chkconfig hbase-regionserver --add
/sbin/chkconfig hbase-master on
/sbin/chkconfig hbase-regionserver on
%files
%defattr(-,root,root)
%config %{_share_dir}/src/packages/conf-pseudo/hbase-site.xml

View File

@ -0,0 +1,137 @@
# 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.
#
# RPM Spec file for HBase version @version@
#
%define name hbase
%define version @version@
%define release @package.release@
# Installation Locations
%define _source @package.name@
%define _final_name @final.name@
%define _prefix @package.prefix@
%define _bin_dir %{_prefix}/bin
%define _conf_dir @package.conf.dir@
%define _include_dir %{_prefix}/include
%define _lib_dir %{_prefix}/lib
%define _lib64_dir %{_prefix}/lib64
%define _libexec_dir %{_prefix}/libexec
%define _log_dir @package.log.dir@
%define _man_dir %{_prefix}/man
%define _pid_dir @package.pid.dir@
%define _sbin_dir %{_prefix}/sbin
%define _share_dir %{_prefix}/share/hbase
%define _src_dir %{_prefix}/src
%define _var_dir %{_prefix}/var/lib
# Build time settings
%define _build_dir @package.build.dir@
%define _final_name @final.name@
%define debug_package %{nil}
Summary: Default HBase configuration templates
License: Apache License, Version 2.0
URL: http://hbase.apache.org/
Vendor: Apache Software Foundation
Group: Development/Libraries
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{_source}
Prefix: %{_prefix}
Prefix: %{_conf_dir}
Prefix: %{_log_dir}
Prefix: %{_pid_dir}
Buildroot: %{_build_dir}
Requires: sh-utils, textutils, /usr/sbin/useradd, /usr/sbin/usermod, /sbin/chkconfig, /sbin/service, jdk >= 1.6, hadoop
AutoReqProv: no
Provides: hbase
%description
Installation of this RPM will setup your machine to run in pseudo-distributed mode where each HBase daemon runs in a separate Java process.
%prep
%setup -n %{_final_name}
%build
if [ -d ${RPM_BUILD_DIR}%{_prefix} ]; then
rm -rf ${RPM_BUILD_DIR}%{_prefix}
fi
if [ -d ${RPM_BUILD_DIR}%{_log_dir} ]; then
rm -rf ${RPM_BUILD_DIR}%{_log_dir}
fi
if [ -d ${RPM_BUILD_DIR}%{_conf_dir} ]; then
rm -rf ${RPM_BUILD_DIR}%{_conf_dir}
fi
if [ -d ${RPM_BUILD_DIR}%{_pid_dir} ]; then
rm -rf ${RPM_BUILD_DIR}%{_pid_dir}
fi
mkdir -p ${RPM_BUILD_DIR}%{_conf_dir}
mkdir -p ${RPM_BUILD_DIR}%{_bin_dir}
mkdir -p ${RPM_BUILD_DIR}%{_include_dir}
mkdir -p ${RPM_BUILD_DIR}%{_lib_dir}
mkdir -p ${RPM_BUILD_DIR}%{_libexec_dir}
mkdir -p ${RPM_BUILD_DIR}%{_log_dir}
mkdir -p ${RPM_BUILD_DIR}%{_conf_dir}
mkdir -p ${RPM_BUILD_DIR}%{_man_dir}
mkdir -p ${RPM_BUILD_DIR}%{_pid_dir}
mkdir -p ${RPM_BUILD_DIR}%{_sbin_dir}
mkdir -p ${RPM_BUILD_DIR}%{_share_dir}
mkdir -p ${RPM_BUILD_DIR}%{_src_dir}
cp ${RPM_BUILD_DIR}/%{_final_name}/src/packages/update-hbase-env.sh ${RPM_BUILD_DIR}/%{_final_name}/sbin/update-hbase-env.sh
cp ${RPM_BUILD_DIR}/%{_final_name}/src/packages/rpm/init.d/hbase-master ${RPM_BUILD_DIR}/%{_final_name}/sbin/hbase-master
cp ${RPM_BUILD_DIR}/%{_final_name}/src/packages/rpm/init.d/hbase-regionserver ${RPM_BUILD_DIR}/%{_final_name}/sbin/hbase-regionserver
chmod 0755 ${RPM_BUILD_DIR}/%{_final_name}/sbin/*
rm -f ${RPM_BUILD_DIR}/%{_final_name}/lib/hadoop-core*
rm -f ${RPM_BUILD_DIR}/%{_final_name}/lib/zookeeper*
mv -f ${RPM_BUILD_DIR}/%{_final_name}/conf/* ${RPM_BUILD_DIR}%{_conf_dir}
mv -f ${RPM_BUILD_DIR}/%{_final_name}/* ${RPM_BUILD_DIR}%{_share_dir}
rm -rf ${RPM_BUILD_DIR}/%{_final_name}
%preun
${RPM_INSTALL_PREFIX0}/share/hbase/sbin/update-hbase-env.sh \
--prefix=${RPM_INSTALL_PREFIX0} \
--bin-dir=${RPM_INSTALL_PREFIX0}/bin \
--conf-dir=${RPM_INSTALL_PREFIX1} \
--log-dir=${RPM_INSTALL_PREFIX2} \
--pid-dir=${RPM_INSTALL_PREFIX3} \
--uninstall
%pre
getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -r hadoop
/usr/sbin/useradd --comment "HBase" --shell /bin/bash -M -r --groups hadoop --home %{_share_dir} hbase 2> /dev/null || :
%post
${RPM_INSTALL_PREFIX0}/share/hbase/sbin/update-hbase-env.sh \
--prefix=${RPM_INSTALL_PREFIX0} \
--bin-dir=${RPM_INSTALL_PREFIX0}/bin \
--conf-dir=${RPM_INSTALL_PREFIX1} \
--log-dir=${RPM_INSTALL_PREFIX2} \
--pid-dir=${RPM_INSTALL_PREFIX3}
%files
%defattr(-,root,root)
%{_prefix}
%config %{_conf_dir}

View File

@ -0,0 +1,193 @@
#!/bin/sh
# 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.
# This script configures hbase-env.sh and symlinkis directories for
# relocating RPM locations.
usage() {
echo "
usage: $0 <parameters>
Required parameters:
--prefix=PREFIX path to install into
Optional parameters:
--arch=i386 OS Architecture
--bin-dir=PREFIX/bin Executable directory
--conf-dir=/etc/hbase Configuration directory
--log-dir=/var/log/hbase Log directory
--pid-dir=/var/run PID file location
"
exit 1
}
OPTS=$(getopt \
-n $0 \
-o '' \
-l 'arch:' \
-l 'prefix:' \
-l 'bin-dir:' \
-l 'conf-dir:' \
-l 'lib-dir:' \
-l 'log-dir:' \
-l 'pid-dir:' \
-l 'uninstall' \
-- "$@")
if [ $? != 0 ] ; then
usage
fi
eval set -- "${OPTS}"
while true ; do
case "$1" in
--arch)
ARCH=$2 ; shift 2
;;
--prefix)
PREFIX=$2 ; shift 2
;;
--bin-dir)
BIN_DIR=$2 ; shift 2
;;
--log-dir)
LOG_DIR=$2 ; shift 2
;;
--lib-dir)
LIB_DIR=$2 ; shift 2
;;
--conf-dir)
CONF_DIR=$2 ; shift 2
;;
--pid-dir)
PID_DIR=$2 ; shift 2
;;
--uninstall)
UNINSTALL=1; shift
;;
--)
shift ; break
;;
*)
echo "Unknown option: $1"
usage
exit 1
;;
esac
done
for var in PREFIX; do
if [ -z "$(eval "echo \$$var")" ]; then
echo Missing param: $var
usage
fi
done
ARCH=${ARCH:-i386}
BIN_DIR=${BIN_DIR:-$PREFIX/share/hbase/bin}
CONF_DIR=${CONF_DIR:-$PREFIX/conf}
LIB_DIR=${LIB_DIR:-$PREFIX/lib}
LOG_DIR=${LOG_DIR:-$PREFIX/var/log}
PID_DIR=${PID_DIR:-$PREFIX/var/run}
UNINSTALL=${UNINSTALL:-0}
if [ "${ARCH}" != "i386" ]; then
LIB_DIR=${LIB_DIR}64
fi
. /etc/default/hadoop-env.sh
. /etc/default/zookeeper-env.sh
if [ "${UNINSTALL}" -eq "1" ]; then
# Remove symlinks
if [ "${BIN_DIR}" != "${PREFIX}/share/hbase/bin" ]; then
for var in `ls ${PREFIX}/share/hbase/bin`; do
rm -f ${BIN_DIR}/${var}
done
fi
if [ -f /etc/default/hbase-env.sh ]; then
rm -f /etc/default/hbase-env.sh
fi
if [ "${CONF_DIR}" != "${PREFIX}/share/hbase/conf" ]; then
rm -f ${PREFIX}/share/hbase/conf
fi
rm -f ${PREFIX}/share/hbase/sbin/hbase-master
rm -f ${PREFIX}/share/hbase/sbin/hbase-regionserver
rm -f /etc/init.d/hbase-master
rm -f /etc/init.d/hbase-regionserver
else
# Create symlinks
if [ "${BIN_DIR}" != "${PREFIX}/share/hbase/bin" ]; then
for var in `ls ${PREFIX}/share/hbase/bin`; do
ln -sf ${PREFIX}/share/hbase/bin/${var} ${BIN_DIR}/${var}
done
fi
if [ "${CONF_DIR}" != "${PREFIX}/share/hbase/conf" ]; then
ln -sf ${CONF_DIR} ${PREFIX}/share/hbase/conf
fi
chmod 755 ${PREFIX}/share/hbase/sbin/*
ln -sf ${PREFIX}/share/hbase/sbin/hbase-master /etc/init.d/hbase-master
ln -sf ${PREFIX}/share/hbase/sbin/hbase-regionserver /etc/init.d/hbase-regionserver
ln -sf ${CONF_DIR}/hbase-env.sh /etc/default/hbase-env.sh
ln -sf ${CONF_DIR}/hbase-env.sh /etc/profile.d/hbase-env.sh
if [ -d ${HADOOP_HOME} ]; then
HADOOP_JARS=`ls ${HADOOP_HOME}/*.jar | tr '\n' ':'`
fi
if [ -d ${ZOOKEEPER_HOME}/share/zookeeper ]; then
ZOOKEEPER_JARS=`ls ${ZOOKEEPER_HOME}/share/zookeeper/*.jar | tr '\n' ':'`
fi
mkdir -p ${PID_DIR}
mkdir -p ${LOG_DIR}
chown hbase ${PID_DIR}
chown hbase ${LOG_DIR}
TFILE="/tmp/$(basename $0).$$.tmp"
grep -v "^export HBASE_HOME" ${CONF_DIR}/hbase-env.sh | \
grep -v "^export HBASE_CONF_DIR" | \
grep -v "^export HBASE_CLASSPATH" | \
grep -v "^export HBASE_MANAGES_ZK" | \
grep -v "^export HBASE_IDENT_STRING" | \
grep -v "^export HBASE_PID_DIR" | \
grep -v "^export HBASE_LOG_DIR" | \
grep -v "^export JAVA_HOME" > ${TFILE}
if [ -z "${JAVA_HOME}" ]; then
if [ -e /etc/lsb-release ]; then
JAVA_HOME=`update-alternatives --config java | grep java | cut -f2 -d':' | cut -f2 -d' ' | sed -e 's/\/bin\/java//'`
else
JAVA_HOME=/usr/java/default
fi
fi
if [ "${JAVA_HOME}xxx" != "xxx" ]; then
echo "export JAVA_HOME=${JAVA_HOME}" >> ${TFILE}
fi
echo "export HBASE_IDENT_STRING=\`whoami\`" >> ${TFILE}
echo "export HBASE_HOME=${PREFIX}/share/hbase" >> ${TFILE}
echo "export HBASE_CONF_DIR=${CONF_DIR}" >> ${TFILE}
echo "export HBASE_CLASSPATH=${CONF_DIR}:${HADOOP_CONF_DIR}:${HADOOP_JARS}:${ZOOKEEPER_JARS}" >> ${TFILE}
echo "export HBASE_MANAGES_ZK=false" >> ${TFILE}
echo "export HBASE_PID_DIR=${PID_DIR}" >> ${TFILE}
echo "export HBASE_LOG_DIR=${LOG_DIR}" >> ${TFILE}
cp ${TFILE} ${CONF_DIR}/hbase-env.sh
rm -f ${TFILE}
fi