Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hadoop-deployer committed Nov 27, 2012
1 parent ed6d7b6 commit ec586f3
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cdh4/config_hive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# coding=utf-8
# Author: [email protected]
# Data: 2012-11

# HBase的众多服务端口的前缀,最多2位数,建议2位数
HIVE_PORT_PREFIX=$PORT_PREFIX

# 把Hive安装到一台机器上
HIVE_NODE="host1"

79 changes: 79 additions & 0 deletions cdh4/install_hive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env bash
# coding=utf-8
# Author: [email protected]
# Data: 2012-11

DIR=$(cd $(dirname $0);pwd)
. $DIR/support/PUB.sh

# $0 host
deploy()
{
echo ">> deploy $1";
ssh $USER@$1 "
cd $D;
. support/PUB.sh;
. support/deploy_hive_env.sh;
echo \">>deploy hive\";
tar -xzf tars/\$HIVE_TAR -C $HOME;
ln -sf ./\$HIVE_VERSION \$HOME/hive;
"

ssh $USER@$1 "
cd $D;
. support/PUB.sh;
. support/profile_hive.sh;
profile;
"

ssh $USER@$1 "
cd $D;
. support/PUB.sh;
. support/deploy_hive_env.sh;
echo \">> conf hive\";
cp -f support/hive_conf/* \$HIVE_CONF_DIR;
HIVESITE=\"\$HIVE_CONF_DIR/hive-site.xml\";
xml_set \$HIVESITE fs.default.name \$FS_DEFAULT_NAME
xml_set \$HIVESITE mapred.job.tracker \$MAPRED_JOB_TRACKER
xml_set \$HIVESITE hive.metastore.local \$HIVE_METASTORE_LOCAL
xml_set \$HIVESITE javax.jdo.option.ConnectionURL \$JAVAX_JDO_OPTION_CONNECTIONURL
xml_set \$HIVESITE hive.metastore.warehouse.dir \$HIVE_METASTORE_WAREHOUSE_DIR
xml_set \$HIVESITE javax.jdo.option.ConnectionUserName \$MYSQL_USERNAME
xml_set \$HIVESITE javax.jdo.option.ConnectionPassword \$MYSQL_PASSWORD
xml_set \$HIVESITE hive.exec.compress.intermediate \$HIVE_EXEC_COMPRESS_INTERMEDIATE
xml_set \$HIVESITE mapred.compress.map.output \$MAPRED_COMPRESS_MAP_OUTPUT
xml_set \$HIVESITE mapred.output.compression.type \$MAPRED_OUTPUT_COMPRESSION_TYPE
xml_set \$HIVESITE hive.input.format \$HIVE_INPUT_FORMAT
quorum=\`echo \$ZK_NODES|sed \"s/ /,/g\"\`;
xml_set \$HIVESITE hbase.zookeeper.quorum \"\$quorum\"
xml_set \$HIVESITE hbase.zookeeper.property.clientPort \${ZK_PORT_PREFIX}181
"
}

# main
#==========
cd $DIR

show_head;

file_die logs/install_hive_ok "hive is installed"
notfile_die logs/install_hadoop_ok "must install hadoop first"

. ./config_hive.sh

download

s=$HIVE_NODE
same_to $s $DIR
[ -f "logs/install_hive_ok_${s}" ] && continue
deploy $s;
touch "logs/install_hive_ok_${s}"

touch logs/install_hive_ok

echo ">> OK"
cd $OLD_DIR

27 changes: 27 additions & 0 deletions cdh4/support/deploy_hive_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# coding=utf-8
# Author: [email protected]
# Data: 2012-09

if [ -z $DEPLOYER_HOME ]; then
die "deployer is not installed or install fail"
fi
. $DEPLOYER_HOME/support/PUB.sh

#hive-0.9.0-cdh4.1.1.tar.gz
HIVE_TAR=`find_tar "hbase-.*-cdh4.*"`
HIVE_VERSION=${HBASE_TAR%.tar.gz} ||:;

##### conf file #####
# hive-site
HIVE_METASTORE_LOCAL="true"
METASTORE="hive_metastore"
JAVAX_JDO_OPTION_CONNECTIONURL="jdbc:mysql://localhost:3306/$METASTORE?createDatabaseIfNotExist=true"
HIVE_METASTORE_WAREHOUSE_DIR="/warehouse"
MYSQL_USERNAME="root"
MYSQL_PASSWORD="root"
HIVE_EXEC_COMPRESS_INTERMEDIATE="true"
MAPRED_COMPRESS_MAP_OUTPUT="true"
MAPRED_OUTPUT_COMPRESSION_TYPE="BLOCK"
HIVE_INPUT_FORMAT="org.apache.hadoop.hive.ql.io.HiveInputFormat"

Empty file.
Empty file.
9 changes: 9 additions & 0 deletions cdh4/support/hive_conf/database-init
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

mysql -u $1 --password=$2 -h localhost <<END
CREATE DATABASE IF NOT EXISTS $3;
GRANT ALL PRIVILEGES ON *.* TO '$1'@'%' IDENTIFIED BY '$2' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO '$1'@'localhost' IDENTIFIED BY '$2' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO '$1'@'127.0.0.1' IDENTIFIED BY '$2' WITH GRANT OPTION;
FLUSH PRIVILEGES;
END
71 changes: 71 additions & 0 deletions cdh4/support/hive_conf/hive-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

<property>
<name>fs.default.name</name>
<value>fs.default.name</value>
</property>

<property>
<name>mapred.job.tracker</name>
<value>mapred.job.tracker</value>
</property>

<property>
<name>hive.metastore.local</name>
<value>hive.metastore.local</value>
</property>

<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>javax.jdo.option.ConnectionURL</value>
</property>

<property>
<name>hive.metastore.warehouse.dir</name>
<value>hive.metastore.warehouse.dir</value>
</property>

<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>javax.jdo.option.ConnectionUserName</value>
</property>

<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>javax.jdo.option.ConnectionPassword</value>
</property>

<property>
<name>hive.exec.compress.intermediate</name>
<value>hive.exec.compress.intermediate</value>
</property>

<property>
<name>mapred.compress.map.output</name>
<value>mapred.compress.map.output</value>
</property>

<property>
<name>mapred.output.compression.type</name>
<value>mapred.output.compression.type</value>
</property>

<property>
<name>hive.input.format</name>
<value>hive.input.format</value>
</property>

<property>
<name>hbase.zookeeper.quorum</name>
<value>hbase.zookeeper.quorum</value>
</property>

<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>hbase.zookeeper.property.clientPort</value>
</property>

</configuration>

0 comments on commit ec586f3

Please sign in to comment.