This repository has been archived by the owner on Oct 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Add copy graph script, update README.md #165
Open
amcp
wants to merge
1
commit into
amazon-archives:master
Choose a base branch
from
amcp:copygraph
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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,49 @@ | ||
#!/bin/bash | ||
wget https://github.com/amcp/dynamodb-import-export-tool/archive/createTable.zip | ||
unzip -q createTable.zip | ||
rm createTable.zip | ||
pushd dynamodb-import-export-tool-createTable | ||
mvn install | ||
pushd target | ||
|
||
export ORIGINAL_TABLE_ENDPOINT=$1 | ||
export ORIGINAL_TABLE_REGION=$2 | ||
export ORIGINAL_TABLE_PREFIX=$3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. take in old table name and new table name as parameters and do not iterate over all graph stores in this file. Need flexibility to support the upgrade path from Titan 1.0.0 to JanusGraph 0.1.0 given the titan_ids/janusgraph_ids table name difference. |
||
export NEW_TABLE_ENDPOINT=$4 | ||
export NEW_TABLE_REGION=$5 | ||
export NEW_TABLE_PREFIX=$6 | ||
|
||
declare -a tableSuffixes=("edgestore" "graphindex" "system_properties" "systemlog" "titan_ids" "txlog") | ||
|
||
for tableSuffix in "${tableSuffixes[@]}"; do | ||
ORIGINAL_TABLE_NAME="${ORIGINAL_TABLE_PREFIX}_${tableSuffix}" | ||
NEW_TABLE_NAME="${NEW_TABLE_PREFIX}_${tableSuffix}" | ||
# prepare graph for cross-region replication | ||
# https://github.com/awslabs/dynamodb-cross-region-library#step-1-optional-table-copy-bootstrapping-existing-data | ||
|
||
# enable stream in source tables | ||
aws dynamodb update-table \ | ||
--endpoint ${ORIGINAL_TABLE_ENDPOINT} \ | ||
--table-name ${ORIGINAL_TABLE_NAME} \ | ||
--stream-specification "StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES" | ||
|
||
# bootstrap destination tables | ||
java -jar dynamodb-import-export-tool-1.1.0.jar \ | ||
--sourceSigningRegion ${ORIGINAL_TABLE_REGION} \ | ||
--sourceEndpoint ${ORIGINAL_TABLE_ENDPOINT} \ | ||
--sourceTable ${ORIGINAL_TABLE_NAME} \ | ||
--destinationSigningRegion ${NEW_TABLE_REGION} \ | ||
--destinationEndpoint ${NEW_TABLE_ENDPOINT} \ | ||
--destinationTable ${NEW_TABLE_NAME} \ | ||
--readThroughputRatio 0.5 \ | ||
--writeThroughputRatio 1 \ | ||
--createDestination | ||
|
||
echo "copied table ${ORIGINAL_TABLE_NAME} at ${ORIGINAL_TABLE_ENDPOINT} to ${NEW_TABLE_NAME} at ${NEW_TABLE_ENDPOINT}" | ||
done | ||
|
||
popd | ||
popd | ||
|
||
# clean up | ||
rm -rf dynamodb-import-export-tool-createTable |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add license header