This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for loading data from Greenplum databases (#692)
* Integration with Greenplum: WIP * Script supporting greenplum data dumping * Python scripts working with either Python2 or Python3 * Document federated database use * Remove temporary files after loading
- Loading branch information
Mihai Budiu
authored
Sep 11, 2020
1 parent
2337324
commit f472529
Showing
72 changed files
with
1,098 additions
and
392 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,54 @@ | ||
#!/usr/bin/env python | ||
# This script installs Hillview next to a greenplum database. | ||
# It needs a config-greenplum.json file that has a description of the | ||
# Greenplum database installation. See also the section | ||
# on Greenplum installation from https://github.com/vmware/hillview/blob/master/docs/userManual.md | ||
|
||
# Copyright (c) 2020 VMware Inc. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed 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. | ||
|
||
# pylint: disable=invalid-name | ||
from argparse import ArgumentParser | ||
from jproperties import Properties | ||
import os | ||
from hillviewCommon import ClusterConfiguration, get_config, get_logger, execute_command | ||
|
||
def main(): | ||
parser = ArgumentParser() | ||
parser.add_argument("config", help="json cluster configuration file") | ||
args = parser.parse_args() | ||
config = get_config(parser, args) | ||
|
||
execute_command("./package-binaries.sh") | ||
web = config.get_webserver() | ||
web.copy_file_to_remote("../hillview-bin.zip", ".", "") | ||
web.copy_file_to_remote("config-greenplum.json", ".", "") | ||
web.run_remote_shell_command("unzip -o hillview-bin.zip") | ||
web.run_remote_shell_command("cd bin; ./upload-data.py -d . -s dump-greenplum.sh config-greenplum.json") | ||
web.run_remote_shell_command("cd bin; ./redeploy.sh -s config-greenplum.json") | ||
web.copy_file_to_remote("../repository/PROGRESS_DATADIRECT_JDBC_DRIVER_PIVOTAL_GREENPLUM_5.1.4.000275.jar", | ||
config.service_folder + "/" + config.tomcat + "/lib", "") | ||
# Generate properties file | ||
with open("greenplum.properties", "rb") as f: | ||
p = Properties() | ||
p.load(f, "utf-8") | ||
p["greenplumDumpScript"] = config.service_folder + "/dump-greenplum.sh" | ||
with open("hillview.properties", "wb") as f: | ||
p.store(f, encoding="utf-8") | ||
web.copy_file_to_remote("hillview.properties", config.service_folder, "") | ||
os.remove("hillview.properties") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains 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 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 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,28 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2020 VMware Inc. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed 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 is used when connecting to a Greenplum database | ||
# to dump data in an external web table. See | ||
# https://gpdb.docs.pivotal.io/6-10/admin_guide/load/topics/g-defining-a-command-based-writable-external-web-table.html | ||
# and https://gpdb.docs.pivotal.io/6-10/ref_guide/sql_commands/CREATE_EXTERNAL_TABLE.html | ||
# The script receives data at stdin | ||
|
||
# Single argument is the directory where the data is to be dumped | ||
DIR=$1 | ||
PREFIX="file" | ||
mkdir -p ${DIR} || exit 1 | ||
echo "$(</dev/stdin)" >${DIR}/${PREFIX}${GP_SEGMENT_ID} |
This file contains 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,11 @@ | ||
# This properties file is a blueprint for a hillview.properties file | ||
# used with a Greenplum installation. | ||
|
||
########################################################### | ||
# Parameters interfacing Hillview with a Greenplum database | ||
|
||
# This script is invoked when data is dumped from an external web table | ||
greenplumDumpScript = /home/gpdamin/hillview/dump-greenplum.sh | ||
# This directory is used to store the data dumped from Greenplum before it's parsed by Hillview. | ||
# The directory must be writable by the segment hosts. | ||
greenplumDumpDirectory = /tmp |
This file contains 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 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 |
---|---|---|
|
@@ -32,6 +32,7 @@ esac | |
${SUDO} ${INSTALL} install wget maven ${NODEJS} ${NPM} ${LIBFORTRAN} unzip gzip python3 | ||
echo "Installing typescript compiler" | ||
${SUDO} npm install -g [email protected] | ||
pip install jproperties | ||
|
||
# Download apache if not there. | ||
pushd .. | ||
|
@@ -75,6 +76,6 @@ popd | |
|
||
# Install Cassandra and populate a test database | ||
if [ ${INSTALL_CASSANDRA} -eq 1 ]; then | ||
./${mydir}/install-cassandra.sh | ||
sudo apt install mysql-server | ||
./${mydir}/install-cassandra.sh | ||
sudo apt install mysql-server | ||
fi |
This file contains 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 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 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 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 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 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 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
Oops, something went wrong.