-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(hbase): add hbase-entrypoint.sh script #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f70555e
feat(hbase): provision hbase-entrypoint.sh
razvan a60fef6
Dockerfile.entrypoint
razvan 989a7a9
working version of hbase-entrypoint.sh
razvan 566123e
hbase-entrypoint.sh: update script args
razvan 51e89be
Merge branch 'main' into hbase/entrypoint
razvan b0e0931
changelog
razvan 88ed0ce
changelog
razvan 9951fc8
Delete hbase/Dockerfile.entrypoint
razvan d9a7f47
fix missing file in previous stage
razvan 521fc62
optionally run region mover
razvan 8dc3fdd
fix krb realm regex
razvan ba9bc6e
Merge branch 'main' into hbase/entrypoint
razvan d2c5247
Merge branch 'main' into hbase/entrypoint
razvan 229eb94
Merge branch 'main' into hbase/entrypoint
NickLarsenNZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Entrypoint for HBase that ensures services are shutdown gracefuly | ||
# | ||
set -x | ||
set -euo pipefail | ||
|
||
# master, regionserver, rest | ||
HBASE_ROLE_NAME="$1" | ||
# k8s service name for this role+group combo | ||
# <svc-name>.<namespace>.svc.cluster.local | ||
HBASE_ROLE_SERVICE_NAME="$2" | ||
# 16010 for master, 16020 for regionservers etc. | ||
HBASE_ROLE_SERVICE_PORT="$3" | ||
|
||
HBASE_ROLE_SERVICE_HOST="${HOSTNAME}.${HBASE_ROLE_SERVICE_NAME}" | ||
|
||
REGION_MOVER_OPTS="--regionserverhost ${HBASE_ROLE_SERVICE_HOST}:${HBASE_ROLE_SERVICE_PORT} --operation unload ${REGION_MOVER_OPTS}" | ||
|
||
if [ -f /stackable/kerberos/krb5.conf ]; then | ||
KERBEROS_REALM=$(grep -oP 'default_realm = \\K.*' /stackable/kerberos/krb5.conf) | ||
export KERBEROS_REALM | ||
fi | ||
|
||
prepare_signal_handlers() { | ||
unset term_child_pid | ||
unset term_kill_needed | ||
trap handle_term_signal TERM | ||
} | ||
|
||
handle_term_signal() { | ||
if [ "${term_child_pid}" ]; then | ||
if [ "regionserver" == "${HBASE_ROLE_NAME}" ]; then | ||
echo "Start pre-shutdown" | ||
# REGION_MOVER_OPTS is a string that contains multiple arguments and needs to be spliced here | ||
# therefore disable shellcheck for this line | ||
# shellcheck disable=SC2086 | ||
/stackable/hbase/bin/hbase org.apache.hadoop.hbase.util.RegionMover ${REGION_MOVER_OPTS} | ||
echo "Done pre-shutdown" | ||
fi | ||
kill -TERM "${term_child_pid}" 2>/dev/null | ||
else | ||
term_kill_needed='yes' | ||
fi | ||
} | ||
|
||
wait_for_termination() { | ||
set +e | ||
term_child_pid=$1 | ||
if [[ -v term_kill_needed ]]; then | ||
kill -TERM "${term_child_pid}" 2>/dev/null | ||
fi | ||
wait "${term_child_pid}" 2>/dev/null | ||
trap - TERM | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
wait "${term_child_pid}" 2>/dev/null | ||
set -e | ||
} | ||
|
||
# ################################################################################################## | ||
# main | ||
# ################################################################################################## | ||
mkdir -p /stackable/conf | ||
cp /stackable/tmp/hdfs/hdfs-site.xml /stackable/conf | ||
cp /stackable/tmp/hdfs/core-site.xml /stackable/conf | ||
cp /stackable/tmp/hbase/* /stackable/conf | ||
cp /stackable/tmp/log_config/log4j* /stackable/conf | ||
|
||
rm -f /stackable/log/_vector/shutdown | ||
prepare_signal_handlers | ||
/stackable/hbase/bin/hbase "${HBASE_ROLE_NAME}" start & | ||
wait_for_termination $! | ||
mkdir -p /stackable/log/_vector && touch /stackable/log/_vector/shutdown |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.