forked from hstreamdb/jepsen.hstream
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
project: add new test template for hstream kafka
- Loading branch information
Showing
13 changed files
with
474 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
ARG BASE_IMAGE="jepsen-hstream:base" | ||
FROM ${BASE_IMAGE} | ||
|
||
# Waiting for Zookeeper | ||
COPY ./wait-zk.sh /usr/local/bin/wait-zk | ||
RUN chmod +x /usr/local/bin/wait-zk | ||
|
||
# Waiting for logdeviced | ||
COPY ./wait-hstore.sh /usr/local/bin/wait-hstore | ||
RUN chmod +x /usr/local/bin/wait-hstore | ||
|
||
# Waiting for hservers | ||
COPY ./wait-hservers.sh /usr/local/bin/wait-hservers | ||
RUN chmod +x /usr/local/bin/wait-hservers | ||
|
||
# Config for LogDevice | ||
COPY ./logdevice.json /etc/logdevice.json | ||
|
||
EXPOSE 22 6440 | ||
|
||
CMD /usr/local/bin/init-ssh && \ | ||
ZK_IP=$(dig +short zookeeper) && \ | ||
sed -i "s/172.16.0.10:2181/$ZK_IP:2181/g" /etc/logdevice.json && \ | ||
/usr/local/bin/wait-zk && \ | ||
/usr/share/zookeeper/bin/zkCli.sh -server zookeeper:2181 create /logdevice.conf "`cat /etc/logdevice.json`" && \ | ||
ld-admin-server \ | ||
--config-path zk:zookeeper:2181/logdevice.conf \ | ||
--enable-maintenance-manager \ | ||
--maintenance-log-snapshotting \ | ||
--enable-safety-check-periodic-metadata-update \ | ||
>> /tmp/$HOSTNAME.log 2>&1 & \ | ||
/usr/local/bin/wait-hstore && \ | ||
hadmin store nodes-config bootstrap --metadata-replicate-across node:3 && \ | ||
/usr/local/bin/wait-hservers && \ | ||
hstream-kafka --host hserver-1 node init >> /tmp/$HOSTNAME.log 2>&1 && \ | ||
echo "Bootstraped" > /var/jepsen/shared/hserver-cluster-started && \ | ||
tail -f /dev/null |
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,52 @@ | ||
{ | ||
"cluster": "logdevice-dev", | ||
"server_settings": { | ||
"enable-node-self-registration": "true", | ||
"enable-nodes-configuration-manager": "true", | ||
"use-nodes-configuration-manager-nodes-configuration": "true", | ||
"enable-cluster-maintenance-state-machine": "true", | ||
"rocksdb-memtable-size-per-node": "1024M", | ||
"free-disk-space-threshold": 0.1 | ||
}, | ||
"client_settings": { | ||
"enable-nodes-configuration-manager": "true", | ||
"use-nodes-configuration-manager-nodes-configuration": "true", | ||
"admin-client-capabilities": "true" | ||
}, | ||
"internal_logs": { | ||
"config_log_deltas": { | ||
"replicate_across": { | ||
"node": 3 | ||
} | ||
}, | ||
"config_log_snapshots": { | ||
"replicate_across": { | ||
"node": 3 | ||
} | ||
}, | ||
"event_log_deltas": { | ||
"replicate_across": { | ||
"node": 3 | ||
} | ||
}, | ||
"event_log_snapshots": { | ||
"replicate_across": { | ||
"node": 3 | ||
} | ||
}, | ||
"maintenance_log_deltas": { | ||
"replicate_across": { | ||
"node": 3 | ||
} | ||
}, | ||
"maintenance_log_snapshots": { | ||
"replicate_across": { | ||
"node": 3 | ||
} | ||
} | ||
}, | ||
"zookeeper": { | ||
"zookeeper_uri": "ip://172.16.0.10:2181", | ||
"timeout": "30s" | ||
} | ||
} |
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 @@ | ||
#!/usr/bin/bash | ||
|
||
until ( \ | ||
/usr/local/bin/hstream-kafka --host hserver-1 --port 9092 node status && \ | ||
/usr/local/bin/hstream-kafka --host hserver-2 --port 9092 node status && \ | ||
/usr/local/bin/hstream-kafka --host hserver-3 --port 9092 node status && \ | ||
/usr/local/bin/hstream-kafka --host hserver-4 --port 9092 node status && \ | ||
/usr/local/bin/hstream-kafka --host hserver-5 --port 9092 node status \ | ||
) >/dev/null 2>&1; do | ||
sleep 1 | ||
done; |
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,22 @@ | ||
#!/usr/bin/bash | ||
|
||
Test_Open () { | ||
</dev/tcp/"$1"/"$2" | ||
if [ "$?" -ne 0 ]; then | ||
return 1 | ||
else | ||
return 0 | ||
fi | ||
} | ||
|
||
Wait_Until_Open () { | ||
until Test_Open "$1" "$2" | ||
do | ||
sleep 1 | ||
done | ||
} | ||
|
||
Wait_Until_Open hstore-1 6440 | ||
Wait_Until_Open hstore-2 6440 | ||
Wait_Until_Open hstore-3 6440 | ||
sleep 5 # In case of the hstore node is not ready although its port is open |
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,19 @@ | ||
#!/usr/bin/bash | ||
|
||
Test_Open () { | ||
</dev/tcp/"$1"/"$2" | ||
if [ "$?" -ne 0 ]; then | ||
return 1 | ||
else | ||
return 0 | ||
fi | ||
} | ||
|
||
Wait_Until_Open () { | ||
until Test_Open "$1" "$2" | ||
do | ||
sleep 1 | ||
done | ||
} | ||
|
||
Wait_Until_Open zookeeper 2181 |
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,59 @@ | ||
ARG HSTREAM_IMAGE="hstreamdb/hstream:latest" | ||
FROM ${HSTREAM_IMAGE} | ||
|
||
# Do not ask for user input when installing packages | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
ARG USE_CHINA_MIRROR | ||
# Mirror | ||
RUN if [ "$USE_CHINA_MIRROR" = true ] ; then sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list ; fi | ||
|
||
# Basic system stuff | ||
RUN apt-get -qy update && \ | ||
apt-get -qy --no-install-recommends install \ | ||
apt-transport-https | ||
|
||
# Jepsen (control) dependencies | ||
RUN apt-get -qy update && \ | ||
apt-get -qy --no-install-recommends install \ | ||
curl \ | ||
dos2unix \ | ||
git \ | ||
gnuplot-nox \ | ||
htop \ | ||
iputils-ping \ | ||
libjna-java \ | ||
leiningen \ | ||
openjdk-21-jdk-headless \ | ||
openssh-client \ | ||
screen \ | ||
wget \ | ||
zookeeper && \ | ||
rm -rf /var/lib/apt/lists/* && apt-get clean | ||
|
||
ADD ./bashrc /root/.bashrc | ||
ADD ./init-ssh-control.sh /init-ssh.sh | ||
RUN dos2unix /init-ssh.sh /root/.bashrc \ | ||
&& chmod +x /init-ssh.sh | ||
|
||
# Proxy | ||
ARG arg_http_proxy | ||
ARG arg_https_proxy | ||
ENV env_http_proxy=$arg_http_proxy | ||
ENV env_https_proxy=$arg_https_proxy | ||
|
||
CMD /init-ssh.sh && \ | ||
eval `ssh-agent` && \ | ||
ssh-add /root/.ssh/id_rsa && \ | ||
cd /home/Work && \ | ||
tail -f --retry /var/jepsen/shared/hserver-cluster-started | sed '/Bootstraped/ q' && \ | ||
### Use proxy (if set) to download deps, then unset proxy for running tests | ||
export http_proxy=$env_http_proxy https_proxy=$env_https_proxy && \ | ||
lein deps && \ | ||
unset http_proxy && \ | ||
unset https_proxy && \ | ||
# start test | ||
lein with-profile kafka run test \ | ||
--nodes "ld1,ld2,ld3,n1,n2,n3,n4,n5,zk" \ | ||
--ssh-private-key "/root/.ssh/id_rsa" && \ | ||
exit |
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,2 @@ | ||
eval $(ssh-agent) &> /dev/null | ||
ssh-add /root/.ssh/id_rsa &> /dev/null |
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,21 @@ | ||
#!/bin/sh | ||
|
||
sleep 1 && \ | ||
|
||
: "${SSH_PRIVATE_KEY?SSH_PRIVATE_KEY is empty, please use up.sh}" | ||
: "${SSH_PUBLIC_KEY?SSH_PUBLIC_KEY is empty, please use up.sh}" | ||
|
||
if [ ! -f ~/.ssh/known_hosts ]; then | ||
mkdir -m 700 ~/.ssh | ||
echo $SSH_PRIVATE_KEY | perl -p -e 's/↩/\n/g' > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
echo $SSH_PUBLIC_KEY > ~/.ssh/id_rsa.pub | ||
echo > ~/.ssh/known_hosts | ||
# Get nodes list | ||
sort -V /var/jepsen/shared/nodes > ~/nodes | ||
# Scan SSH keys | ||
while read node; do | ||
ssh-keyscan -t rsa $node >> ~/.ssh/known_hosts | ||
ssh-keyscan -t ed25519 $node >> ~/.ssh/known_hosts | ||
done <~/nodes | ||
fi |
Oops, something went wrong.