Skip to content
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

Add REPLICATION parameter to Cassandra schema script #6582

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions plugin/storage/cassandra/schema/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function usage {
>&2 echo " TRACE_TTL - time to live for trace data, in seconds (default: 172800, 2 days)"
>&2 echo " DEPENDENCIES_TTL - time to live for dependencies data, in seconds (default: 0, no TTL)"
>&2 echo " KEYSPACE - keyspace (default: jaeger_v1_{datacenter})"
>&2 echo " REPLICATION - complete replication configuration (overrides REPLICATION_FACTOR if set)"
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
>&2 echo " REPLICATION_FACTOR - replication factor for prod (default: 2 for prod, 1 for test)"
>&2 echo " VERSION - Cassandra backend version, 3 or 4 (default: 4). Ignored if template is provided."
>&2 echo ""
Expand Down Expand Up @@ -47,14 +48,22 @@ fi
if [[ "$MODE" == "" ]]; then
usage "missing MODE parameter"
elif [[ "$MODE" == "prod" ]]; then
if [[ "$DATACENTER" == "" ]]; then usage "missing DATACENTER parameter for prod mode"; fi
datacenter=$DATACENTER
replication_factor=${REPLICATION_FACTOR:-2}
replication="{'class': 'NetworkTopologyStrategy', '$datacenter': '${replication_factor}' }"
if [[ -n "$REPLICATION" ]]; then
replication="$REPLICATION"
else
if [[ "$DATACENTER" == "" ]]; then usage "missing DATACENTER parameter for prod mode"; fi
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
datacenter=$DATACENTER
replication_factor=${REPLICATION_FACTOR:-2}
replication="{'class': 'NetworkTopologyStrategy', '$datacenter': '${replication_factor}' }"
fi
elif [[ "$MODE" == "test" ]]; then
datacenter=${DATACENTER:-'test'}
replication_factor=${REPLICATION_FACTOR:-1}
replication="{'class': 'SimpleStrategy', 'replication_factor': '${replication_factor}'}"
if [[ -n "$REPLICATION" ]]; then
replication="$REPLICATION"
else
datacenter=${DATACENTER:-'test'}
replication_factor=${REPLICATION_FACTOR:-1}
replication="{'class': 'SimpleStrategy', 'replication_factor': '${replication_factor}'}"
fi
else
usage "invalid MODE=$MODE, expecting 'prod' or 'test'"
fi
Expand Down
Loading