Skip to content

Instantly share code, notes, and snippets.

@smarj
Last active May 1, 2017 19:07
Show Gist options
  • Save smarj/cae128ea76d80fb6aae94919559fb62f to your computer and use it in GitHub Desktop.
Save smarj/cae128ea76d80fb6aae94919559fb62f to your computer and use it in GitHub Desktop.
#!/bin/bash
SHARED=${HOME}/Documents/Docker/shared
if [[ ! -d "${SHARED}" ]]; then
mkdir -p "${SHARED}"
fi
docker run --name=riakts1 -d -p 8087:8087 -p 8098:8098 --label cluster.name=adhoc -v ${SHARED}:/shared basho/riak-ts
CNODE=`docker inspect -f '{{.NetworkSettings.IPAddress}}' riakts1`
if [ -z ${CNODE} ]
then
echo "Creation of 'riakts1' container failed."
exit 1
fi
docker run --name=riakts2 -d -P -e COORDINATOR_NODE=${CNODE} --label cluster.name=adhoc -v ${SHARED}:/shared basho/riak-ts
docker run --name=riakts3 -d -P -e COORDINATOR_NODE=${CNODE} --label cluster.name=adhoc -v ${SHARED}:/shared basho/riak-ts
#!/bin/bash
if [ -z "$1" ]; then
ts=$(( (`date +%s` - 120) * 1000))
else
ts=$(( ($1 - 120) * 1000 ))
fi
for i in $(seq 1 100); do
ts=$((ts + 1000))
data=$RANDOM
curl -XPOST http://localhost:8098/ts/v1/query/ -d "insert into Sample values ('NJ', 'Toms River', $ts, $data)"
# echo "insert into Sample values ('NJ', 'Toms River', '$ts', $data)"
done
CREATE TABLE Sample
(
state varchar not null,
city varchar not null,
time TIMESTAMP not null,
random sint64 not null,
primary key (
(state, city, quantum(time, 15, 'm')),
state, city, time
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment