Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cgiraldo committed Aug 31, 2020
1 parent 6e29d7a commit 3a095d1
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion charts/hive-metastore/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ sources:
- https://github.com/apache/hive
- https://github.com/gradiant/charts
- https://github.com/big-data-europe/docker-hive
version: 0.1.1
version: 0.1.2
6 changes: 6 additions & 0 deletions charts/hive-metastore/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ data:
<value>thrift://{{ include "hiveMetastore.fullname" . }}:9083</value>
</property>
{{- end }}
{{- if not (index .Values.conf "hiveSite" "hive.metastore.warehouse.dir") }}
<property>
<name>hive.metastore.warehouse.dir</name>
<value>hdfs://{{ .Release.Name }}-hdfs:8020/user/hive/warehouse</value>
</property>
{{- end }}
{{- if index .Values.conf "hiveSite" }}
{{- range $key, $value := index .Values.conf "hiveSite" }}
<property><name>{{ $key }}</name><value>{{ $value }}</value></property>
Expand Down
4 changes: 3 additions & 1 deletion charts/hive-metastore/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ image:
resources: {}
conf:
hiveSite:
hive_metastore_uris: thrift://hive-metastore:9083
hive_metastore_uris: thrift://hive-metastore:9083
# if not set, default hive.metastore.warehouse.dir is default to: "hdfs://{{.Release.Name}}-hdfs:8020/user/hive/warehouse"
#hive.metastore.warehouse.dir:
2 changes: 1 addition & 1 deletion charts/hive/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ sources:
- https://github.com/apache/hive
- https://github.com/gradiant/charts
- https://github.com/big-data-europe/docker-hive
version: 0.1.3
version: 0.1.4
2 changes: 1 addition & 1 deletion charts/hive/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies:
- name: hive-metastore
alias: metastore
version: ~0.1.0
version: ~0.1.2
repository: file://../hive-metastore
condition: metastore.enabled
- name: hdfs
Expand Down
1 change: 1 addition & 0 deletions charts/hive/resources/config/hive-site.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
{{- if not (index .Values.conf "hiveSite" "hive.metastore.uris") }}
<property>
Expand Down
48 changes: 23 additions & 25 deletions charts/hive/resources/startup.sh
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
#!/bin/bash

: ${HADOOP_PREFIX:=/usr/local/hadoop}
#: ${HADOOP_PREFIX:=/usr/local/hadoop}

. $HADOOP_PREFIX/etc/hadoop/hadoop-env.sh
#. $HADOOP_PREFIX/etc/hadoop/hadoop-env.sh

# Directory to find config artifacts
CONFIG_DIR="/tmp/hadoop-config"
#CONFIG_DIR="/tmp/hadoop-config"

set -x

# Copy config files from volume mount
for f in slaves core-site.xml hdfs-site.xml mapred-site.xml yarn-site.xml; do
if [[ -e ${CONFIG_DIR}/$f ]]; then
cp ${CONFIG_DIR}/$f $HADOOP_HOME/etc/hadoop/$f
else
echo "ERROR: Could not find $f in $CONFIG_DIR"
exit 1
fi
done
#for f in slaves core-site.xml hdfs-site.xml mapred-site.xml yarn-site.xml; do
# if [[ -e ${CONFIG_DIR}/$f ]]; then
# cp ${CONFIG_DIR}/$f $HADOOP_HOME/etc/hadoop/$f
# else
# echo "ERROR: Could not find $f in $CONFIG_DIR"
# exit 1
# fi

# Note. This script set hive paths in hdfs with user hive and ensures hiveServer is runAsUser hive

HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -mkdir /tmp
HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -mkdir -p /user/hive/warehouse
HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chmod g+w /tmp
HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chmod g+w /user/hive/warehouse
HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chown hive:hive /tmp
HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chown hive:hive /user/hive/warehouse


if id -u hive ; then
echo "hive user exists";
else
echo "Creating hive user";
groupadd -g 500 -r hive && \
useradd --comment "Hive user" -u 500 --shell /bin/bash -M -r -g hive hive
fi
#if id -u hive ; then
# echo "hive user exists";
#else
# echo "Creating hive user";
# groupadd -g 500 -r hive && \
# useradd --comment "Hive user" -u 500 --shell /bin/bash -M -r -g hive hive
#fi

if [[ whoami != hive ]]
then
echo "Switching to hive user";
su hive -c "cd $HIVE_HOME/bin; ./hiveserver2 --hiveconf hive.server2.enable.doAs=false"
else
#if [[ whoami != hive ]]
#then
# echo "Switching to hive user";
# su hive -c "cd $HIVE_HOME/bin; ./hiveserver2 --hiveconf hive.server2.enable.doAs=false"
#else
cd $HIVE_HOME/bin; ./hiveserver2 --hiveconf hive.server2.enable.doAs=false
fi
#fi
2 changes: 1 addition & 1 deletion charts/hive/templates/hive-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
- name: hive-config
mountPath: /opt/hive/conf
- name: hadoop-config
mountPath: /tmp/hadoop-config
mountPath: /opt/hadoop/etc/hadoop
volumes:
- name: hadoop-config
configMap:
Expand Down
5 changes: 1 addition & 4 deletions charts/hive/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


image:
repository: bde2020/hive
repository: gradiant/hive
tag: 2.3.2-postgresql-metastore
pullPolicy: IfNotPresent

Expand Down Expand Up @@ -31,6 +31,3 @@ conf:
# fs.defaultFS: hdfs://hdfs-cluster:8020
# hdfsSite:
# ...



0 comments on commit 3a095d1

Please sign in to comment.