Merge pull request #5189 from taosdata/xiaoping/add_test_case
[TD-2846]<test>: scripts for docker cluster
This commit is contained in:
commit
f104b15cbb
|
@ -2,15 +2,20 @@ FROM ubuntu:latest AS builder
|
||||||
|
|
||||||
ARG PACKAGE=TDengine-server-1.6.5.10-Linux-x64.tar.gz
|
ARG PACKAGE=TDengine-server-1.6.5.10-Linux-x64.tar.gz
|
||||||
ARG EXTRACTDIR=TDengine-enterprise-server
|
ARG EXTRACTDIR=TDengine-enterprise-server
|
||||||
|
ARG TARBITRATORPKG=TDengine-tarbitrator-1.6.5.10-Linux-x64.tar.gz
|
||||||
|
ARG EXTRACTDIR2=TDengine-enterprise-arbitrator
|
||||||
ARG CONTENT=taos.tar.gz
|
ARG CONTENT=taos.tar.gz
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
|
|
||||||
COPY ${PACKAGE} .
|
COPY ${PACKAGE} .
|
||||||
|
COPY ${TARBITRATORPKG} .
|
||||||
|
|
||||||
RUN tar -zxf ${PACKAGE}
|
RUN tar -zxf ${PACKAGE}
|
||||||
|
RUN tar -zxf ${TARBITRATORPKG}
|
||||||
RUN mv ${EXTRACTDIR}/driver ./lib
|
RUN mv ${EXTRACTDIR}/driver ./lib
|
||||||
RUN tar -zxf ${EXTRACTDIR}/${CONTENT}
|
RUN tar -zxf ${EXTRACTDIR}/${CONTENT}
|
||||||
|
RUN mv ${EXTRACTDIR2}/bin/* /root/bin
|
||||||
|
|
||||||
FROM ubuntu:latest
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
@ -19,8 +24,10 @@ WORKDIR /root
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y vim tmux net-tools
|
RUN apt-get install -y vim tmux net-tools
|
||||||
RUN echo 'alias ll="ls -l --color=auto"' >> /root/.bashrc
|
RUN echo 'alias ll="ls -l --color=auto"' >> /root/.bashrc
|
||||||
|
RUN ulimit -c unlimited
|
||||||
|
|
||||||
COPY --from=builder /root/bin/taosd /usr/bin
|
COPY --from=builder /root/bin/taosd /usr/bin
|
||||||
|
COPY --from=builder /root/bin/tarbitrator /usr/bin
|
||||||
COPY --from=builder /root/bin/taos /usr/bin
|
COPY --from=builder /root/bin/taos /usr/bin
|
||||||
COPY --from=builder /root/cfg/taos.cfg /etc/taos/
|
COPY --from=builder /root/cfg/taos.cfg /etc/taos/
|
||||||
COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1
|
COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1
|
||||||
|
@ -29,7 +36,7 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
|
||||||
ENV LC_CTYPE=en_US.UTF-8
|
ENV LC_CTYPE=en_US.UTF-8
|
||||||
ENV LANG=en_US.UTF-8
|
ENV LANG=en_US.UTF-8
|
||||||
|
|
||||||
EXPOSE 6030-6041/tcp 6060/tcp 6030-6039/udp
|
EXPOSE 6030-6042/tcp 6060/tcp 6030-6039/udp
|
||||||
|
|
||||||
# VOLUME [ "/var/lib/taos", "/var/log/taos", "/etc/taos" ]
|
# VOLUME [ "/var/lib/taos", "/var/log/taos", "/etc/taos" ]
|
||||||
|
|
||||||
|
|
|
@ -12,15 +12,89 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import taos
|
||||||
import random
|
import random
|
||||||
|
import argparse
|
||||||
|
|
||||||
class ClusterTestcase:
|
class BuildDockerCluser:
|
||||||
|
|
||||||
|
def __init__(self, hostName, user, password, configDir, numOfNodes, clusterVersion):
|
||||||
|
self.hostName = hostName
|
||||||
|
self.user = user
|
||||||
|
self.password = password
|
||||||
|
self.configDir = configDir
|
||||||
|
self.numOfNodes = numOfNodes
|
||||||
|
self.clusterVersion = clusterVersion
|
||||||
|
|
||||||
|
def getConnection(self):
|
||||||
|
self.conn = taos.connect(
|
||||||
|
host = self.hostName,
|
||||||
|
user = self.user,
|
||||||
|
password = self.password,
|
||||||
|
config = self.configDir)
|
||||||
|
|
||||||
|
def createDondes(self):
|
||||||
|
self.cursor = self.conn.cursor()
|
||||||
|
for i in range(2, self.numOfNodes + 1):
|
||||||
|
self.cursor.execute("create dnode tdnode%d" % i)
|
||||||
|
|
||||||
|
def startArbitrator(self):
|
||||||
|
print("start arbitrator")
|
||||||
|
os.system("docker exec -d $(docker ps|grep tdnode1|awk '{print $1}') tarbitrator")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
os.system("./buildClusterEnv.sh -n 3 -v 2.0.14.1")
|
if self.numOfNodes < 2 or self.numOfNodes > 5:
|
||||||
os.system("yes|taosdemo -h 172.27.0.7 -n 100 -t 100 -x")
|
print("the number of nodes must be between 2 and 5")
|
||||||
os.system("python3 ../../concurrent_inquiry.py -H 172.27.0.7 -T 4 -t 4 -l 10")
|
exit(0)
|
||||||
|
os.system("./buildClusterEnv.sh -n %d -v %s" % (self.numOfNodes, self.clusterVersion))
|
||||||
|
self.getConnection()
|
||||||
|
self.createDondes()
|
||||||
|
self.startArbitrator()
|
||||||
|
|
||||||
clusterTest = ClusterTestcase()
|
parser = argparse.ArgumentParser()
|
||||||
clusterTest.run()
|
parser.add_argument(
|
||||||
|
'-H',
|
||||||
|
'--host',
|
||||||
|
action='store',
|
||||||
|
default='tdnode1',
|
||||||
|
type=str,
|
||||||
|
help='host name to be connected (default: tdnode1)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-u',
|
||||||
|
'--user',
|
||||||
|
action='store',
|
||||||
|
default='root',
|
||||||
|
type=str,
|
||||||
|
help='user (default: root)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-p',
|
||||||
|
'--password',
|
||||||
|
action='store',
|
||||||
|
default='taosdata',
|
||||||
|
type=str,
|
||||||
|
help='password (default: taosdata)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-c',
|
||||||
|
'--config-dir',
|
||||||
|
action='store',
|
||||||
|
default='/etc/taos',
|
||||||
|
type=str,
|
||||||
|
help='configuration directory (default: /etc/taos)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-n',
|
||||||
|
'--num-of-nodes',
|
||||||
|
action='store',
|
||||||
|
default=2,
|
||||||
|
type=int,
|
||||||
|
help='number of nodes in the cluster (default: 2, min: 2, max: 5)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-v',
|
||||||
|
'--version',
|
||||||
|
action='store',
|
||||||
|
default='2.0.14.1',
|
||||||
|
type=str,
|
||||||
|
help='the version of the cluster to be build, Default is 2.0.14.1')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
cluster = BuildDockerCluser(args.host, args.user, args.password, args.config_dir, args.num_of_nodes, args.version)
|
||||||
|
cluster.run()
|
|
@ -27,18 +27,28 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
function addTaoscfg {
|
||||||
|
for i in {1..5}
|
||||||
|
do
|
||||||
|
touch /data/node$i/cfg/taos.cfg
|
||||||
|
echo 'firstEp tdnode1:6030' > /data/node$i/cfg/taos.cfg
|
||||||
|
echo 'fqdn tdnode'$i >> /data/node$i/cfg/taos.cfg
|
||||||
|
echo 'arbitrator tdnode1:6042' >> /data/node$i/cfg/taos.cfg
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function createDIR {
|
function createDIR {
|
||||||
for i in {1.. $2}
|
for i in {1..5}
|
||||||
do
|
do
|
||||||
mkdir -p /data/node$i/data
|
mkdir -p /data/node$i/data
|
||||||
mkdir -p /data/node$i/log
|
mkdir -p /data/node$i/log
|
||||||
mkdir -p /data/node$i/cfg
|
mkdir -p /data/node$i/cfg
|
||||||
|
mkdir -p /data/node$i/core
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanEnv {
|
function cleanEnv {
|
||||||
for i in {1..3}
|
for i in {1..5}
|
||||||
do
|
do
|
||||||
echo /data/node$i/data/*
|
echo /data/node$i/data/*
|
||||||
rm -rf /data/node$i/data/*
|
rm -rf /data/node$i/data/*
|
||||||
|
@ -54,49 +64,60 @@ function prepareBuild {
|
||||||
rm -rf $CURR_DIR/../../../../release/*
|
rm -rf $CURR_DIR/../../../../release/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -e $DOCKER_DIR/TDengine-server-$VERSION-Linux-x64.tar.gz ] || [ ! -e $DOCKER_DIR/TDengine-arbitrator-$VERSION-Linux-x64.tar.gz ]; then
|
||||||
cd $CURR_DIR/../../../../packaging
|
cd $CURR_DIR/../../../../packaging
|
||||||
|
echo "generating TDeninger packages"
|
||||||
./release.sh -v edge -n $VERSION >> /dev/null
|
./release.sh -v edge -n $VERSION >> /dev/null
|
||||||
|
|
||||||
if [ ! -f $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then
|
if [ ! -e $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then
|
||||||
echo "no TDengine install package found"
|
echo "no TDengine install package found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -e $CURR_DIR/../../../../release/TDengine-arbitrator-$VERSION-Linux-x64.tar.gz ]; then
|
||||||
|
echo "no arbitrator install package found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cd $CURR_DIR/../../../../release
|
cd $CURR_DIR/../../../../release
|
||||||
mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
|
mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
|
||||||
|
mv TDengine-arbitrator-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf $DOCKER_DIR/*.yml
|
rm -rf $DOCKER_DIR/*.yml
|
||||||
cd $CURR_DIR
|
cd $CURR_DIR
|
||||||
|
|
||||||
cp docker-compose.yml $DOCKER_DIR
|
cp *.yml $DOCKER_DIR
|
||||||
cp Dockerfile $DOCKER_DIR
|
cp Dockerfile $DOCKER_DIR
|
||||||
|
|
||||||
if [ $NUM_OF_NODES -eq 4 ]; then
|
|
||||||
cp ../node4.yml $DOCKER_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $NUM_OF_NODES -eq 5 ]; then
|
|
||||||
cp ../node5.yml $DOCKER_DIR
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clusterUp {
|
function clusterUp {
|
||||||
|
echo "docker compose start"
|
||||||
|
|
||||||
cd $DOCKER_DIR
|
cd $DOCKER_DIR
|
||||||
|
|
||||||
|
if [ $NUM_OF_NODES -eq 2 ]; then
|
||||||
|
echo "create 2 dnodes"
|
||||||
|
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose up -d
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $NUM_OF_NODES -eq 3 ]; then
|
if [ $NUM_OF_NODES -eq 3 ]; then
|
||||||
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION VERSION=$VERSION docker-compose up -d
|
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml up -d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $NUM_OF_NODES -eq 4 ]; then
|
if [ $NUM_OF_NODES -eq 4 ]; then
|
||||||
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node4.yml up -d
|
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml up -d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $NUM_OF_NODES -eq 5 ]; then
|
if [ $NUM_OF_NODES -eq 5 ]; then
|
||||||
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node4.yml -f node5.yml up -d
|
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml -f node5.yml up -d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "docker compose finish"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createDIR
|
||||||
cleanEnv
|
cleanEnv
|
||||||
|
addTaoscfg
|
||||||
prepareBuild
|
prepareBuild
|
||||||
clusterUp
|
clusterUp
|
|
@ -6,9 +6,11 @@ services:
|
||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
- PACKAGE=${PACKAGE}
|
- PACKAGE=${PACKAGE}
|
||||||
|
- TARBITRATORPKG=${TARBITRATORPKG}
|
||||||
- EXTRACTDIR=${DIR}
|
- EXTRACTDIR=${DIR}
|
||||||
|
- EXTRACTDIR2=${DIR2}
|
||||||
image: 'tdengine:${VERSION}'
|
image: 'tdengine:${VERSION}'
|
||||||
container_name: 'td2.0-node1'
|
container_name: 'tdnode1'
|
||||||
cap_add:
|
cap_add:
|
||||||
- ALL
|
- ALL
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
@ -18,7 +20,15 @@ services:
|
||||||
command: >
|
command: >
|
||||||
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
echo $TZ > /etc/timezone &&
|
echo $TZ > /etc/timezone &&
|
||||||
|
mkdir /coredump &&
|
||||||
|
echo 'kernel.core_pattern=/coredump/core_%e_%p' >> /etc/sysctl.conf &&
|
||||||
|
sysctl -p &&
|
||||||
exec my-main-application"
|
exec my-main-application"
|
||||||
|
extra_hosts:
|
||||||
|
- "tdnode2:172.27.0.8"
|
||||||
|
- "tdnode3:172.27.0.9"
|
||||||
|
- "tdnode4:172.27.0.10"
|
||||||
|
- "tdnode5:172.27.0.11"
|
||||||
volumes:
|
volumes:
|
||||||
# bind data directory
|
# bind data directory
|
||||||
- type: bind
|
- type: bind
|
||||||
|
@ -32,10 +42,14 @@ services:
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data/node1/cfg
|
source: /data/node1/cfg
|
||||||
target: /etc/taos
|
target: /etc/taos
|
||||||
|
# bind core dump path
|
||||||
|
- type: bind
|
||||||
|
source: /data/node1/core
|
||||||
|
target: /coredump
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data
|
source: /data
|
||||||
target: /root
|
target: /root
|
||||||
hostname: node1
|
hostname: tdnode1
|
||||||
networks:
|
networks:
|
||||||
taos_update_net:
|
taos_update_net:
|
||||||
ipv4_address: 172.27.0.7
|
ipv4_address: 172.27.0.7
|
||||||
|
@ -48,7 +62,7 @@ services:
|
||||||
- PACKAGE=${PACKAGE}
|
- PACKAGE=${PACKAGE}
|
||||||
- EXTRACTDIR=${DIR}
|
- EXTRACTDIR=${DIR}
|
||||||
image: 'tdengine:${VERSION}'
|
image: 'tdengine:${VERSION}'
|
||||||
container_name: 'td2.0-node2'
|
container_name: 'tdnode2'
|
||||||
cap_add:
|
cap_add:
|
||||||
- ALL
|
- ALL
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
@ -58,7 +72,15 @@ services:
|
||||||
command: >
|
command: >
|
||||||
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
echo $TZ > /etc/timezone &&
|
echo $TZ > /etc/timezone &&
|
||||||
|
mkdir /coredump &&
|
||||||
|
echo 'kernel.core_pattern=/coredump/core_%e_%p' >> /etc/sysctl.conf &&
|
||||||
|
sysctl -p &&
|
||||||
exec my-main-application"
|
exec my-main-application"
|
||||||
|
extra_hosts:
|
||||||
|
- "tdnode1:172.27.0.7"
|
||||||
|
- "tdnode3:172.27.0.9"
|
||||||
|
- "tdnode4:172.27.0.10"
|
||||||
|
- "tdnode5:172.27.0.11"
|
||||||
volumes:
|
volumes:
|
||||||
# bind data directory
|
# bind data directory
|
||||||
- type: bind
|
- type: bind
|
||||||
|
@ -72,52 +94,19 @@ services:
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data/node2/cfg
|
source: /data/node2/cfg
|
||||||
target: /etc/taos
|
target: /etc/taos
|
||||||
|
# bind core dump path
|
||||||
|
- type: bind
|
||||||
|
source: /data/node2/core
|
||||||
|
target: /coredump
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data
|
source: /data
|
||||||
target: /root
|
target: /root
|
||||||
|
hostname: tdnode2
|
||||||
networks:
|
networks:
|
||||||
taos_update_net:
|
taos_update_net:
|
||||||
ipv4_address: 172.27.0.8
|
ipv4_address: 172.27.0.8
|
||||||
command: taosd
|
command: taosd
|
||||||
|
|
||||||
td2.0-node3:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
args:
|
|
||||||
- PACKAGE=${PACKAGE}
|
|
||||||
- EXTRACTDIR=${DIR}
|
|
||||||
image: 'tdengine:${VERSION}'
|
|
||||||
container_name: 'td2.0-node3'
|
|
||||||
cap_add:
|
|
||||||
- ALL
|
|
||||||
stdin_open: true
|
|
||||||
tty: true
|
|
||||||
environment:
|
|
||||||
TZ: "Asia/Shanghai"
|
|
||||||
command: >
|
|
||||||
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
|
||||||
echo $TZ > /etc/timezone &&
|
|
||||||
exec my-main-application"
|
|
||||||
volumes:
|
|
||||||
# bind data directory
|
|
||||||
- type: bind
|
|
||||||
source: /data/node3/data
|
|
||||||
target: /var/lib/taos
|
|
||||||
# bind log directory
|
|
||||||
- type: bind
|
|
||||||
source: /data/node3/log
|
|
||||||
target: /var/log/taos
|
|
||||||
# bind configuration
|
|
||||||
- type: bind
|
|
||||||
source: /data/node3/cfg
|
|
||||||
target: /etc/taos
|
|
||||||
- type: bind
|
|
||||||
source: /data
|
|
||||||
target: /root
|
|
||||||
networks:
|
|
||||||
taos_update_net:
|
|
||||||
ipv4_address: 172.27.0.9
|
|
||||||
command: taosd
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
taos_update_net:
|
taos_update_net:
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
"filetype": "insert",
|
||||||
|
"cfgdir": "/etc/taos",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 6030,
|
||||||
|
"user": "root",
|
||||||
|
"password": "taosdata",
|
||||||
|
"thread_count": 4,
|
||||||
|
"thread_count_create_tbl": 1,
|
||||||
|
"result_file": "./insert_res.txt",
|
||||||
|
"confirm_parameter_prompt": "no",
|
||||||
|
"databases": [{
|
||||||
|
"dbinfo": {
|
||||||
|
"name": "db",
|
||||||
|
"drop": "no",
|
||||||
|
"replica": 1,
|
||||||
|
"days": 2,
|
||||||
|
"cache": 16,
|
||||||
|
"blocks": 8,
|
||||||
|
"precision": "ms",
|
||||||
|
"keep": 365,
|
||||||
|
"minRows": 100,
|
||||||
|
"maxRows": 4096,
|
||||||
|
"comp":2,
|
||||||
|
"walLevel":1,
|
||||||
|
"quorum":1,
|
||||||
|
"fsync":3000,
|
||||||
|
"update": 0
|
||||||
|
},
|
||||||
|
"super_tables": [{
|
||||||
|
"name": "stb",
|
||||||
|
"child_table_exists":"no",
|
||||||
|
"childtable_count": 1,
|
||||||
|
"childtable_prefix": "stb_",
|
||||||
|
"auto_create_table": "no",
|
||||||
|
"data_source": "rand",
|
||||||
|
"insert_mode": "taosc",
|
||||||
|
"insert_rate": 0,
|
||||||
|
"insert_rows": 100000,
|
||||||
|
"multi_thread_write_one_tbl": "no",
|
||||||
|
"number_of_tbl_in_one_sql": 1,
|
||||||
|
"rows_per_tbl": 100,
|
||||||
|
"max_sql_len": 1024000,
|
||||||
|
"disorder_ratio": 0,
|
||||||
|
"disorder_range": 1000,
|
||||||
|
"timestamp_step": 10,
|
||||||
|
"start_timestamp": "2020-10-01 00:00:00.000",
|
||||||
|
"sample_format": "csv",
|
||||||
|
"sample_file": "./sample.csv",
|
||||||
|
"tags_file": "",
|
||||||
|
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}],
|
||||||
|
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
td2.0-node3:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- PACKAGE=${PACKAGE}
|
||||||
|
- EXTRACTDIR=${DIR}
|
||||||
|
image: 'tdengine:${VERSION}'
|
||||||
|
container_name: 'tdnode3'
|
||||||
|
cap_add:
|
||||||
|
- ALL
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
TZ: "Asia/Shanghai"
|
||||||
|
command: >
|
||||||
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
|
echo $TZ > /etc/timezone &&
|
||||||
|
mkdir /coredump &&
|
||||||
|
echo 'kernel.core_pattern=/coredump/core_%e_%p' >> /etc/sysctl.conf &&
|
||||||
|
sysctl -p &&
|
||||||
|
exec my-main-application"
|
||||||
|
extra_hosts:
|
||||||
|
- "tdnode1:172.27.0.7"
|
||||||
|
- "tdnode2:172.27.0.8"
|
||||||
|
- "tdnode4:172.27.0.10"
|
||||||
|
- "tdnode5:172.27.0.11"
|
||||||
|
volumes:
|
||||||
|
# bind data directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node3/data
|
||||||
|
target: /var/lib/taos
|
||||||
|
# bind log directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node3/log
|
||||||
|
target: /var/log/taos
|
||||||
|
# bind configuration
|
||||||
|
- type: bind
|
||||||
|
source: /data/node3/cfg
|
||||||
|
target: /etc/taos
|
||||||
|
# bind core dump path
|
||||||
|
- type: bind
|
||||||
|
source: /data/node3/core
|
||||||
|
target: /coredump
|
||||||
|
- type: bind
|
||||||
|
source: /data
|
||||||
|
target: /root
|
||||||
|
hostname: tdnode3
|
||||||
|
networks:
|
||||||
|
taos_update_net:
|
||||||
|
ipv4_address: 172.27.0.9
|
||||||
|
command: taosd
|
|
@ -7,8 +7,8 @@ services:
|
||||||
args:
|
args:
|
||||||
- PACKAGE=${PACKAGE}
|
- PACKAGE=${PACKAGE}
|
||||||
- EXTRACTDIR=${DIR}
|
- EXTRACTDIR=${DIR}
|
||||||
image: 'tdengine:2.0.13.1'
|
image: 'tdengine:${VERSION}'
|
||||||
container_name: 'td2.0-node4'
|
container_name: 'tdnode4'
|
||||||
cap_add:
|
cap_add:
|
||||||
- ALL
|
- ALL
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
@ -18,7 +18,15 @@ services:
|
||||||
command: >
|
command: >
|
||||||
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
echo $TZ > /etc/timezone &&
|
echo $TZ > /etc/timezone &&
|
||||||
|
mkdir /coredump &&
|
||||||
|
echo 'kernel.core_pattern=/coredump/core_%e_%p' >> /etc/sysctl.conf &&
|
||||||
|
sysctl -p &&
|
||||||
exec my-main-application"
|
exec my-main-application"
|
||||||
|
extra_hosts:
|
||||||
|
- "tdnode2:172.27.0.8"
|
||||||
|
- "tdnode3:172.27.0.9"
|
||||||
|
- "tdnode4:172.27.0.10"
|
||||||
|
- "tdnode5:172.27.0.11"
|
||||||
volumes:
|
volumes:
|
||||||
# bind data directory
|
# bind data directory
|
||||||
- type: bind
|
- type: bind
|
||||||
|
@ -32,9 +40,14 @@ services:
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data/node4/cfg
|
source: /data/node4/cfg
|
||||||
target: /etc/taos
|
target: /etc/taos
|
||||||
|
# bind core dump path
|
||||||
|
- type: bind
|
||||||
|
source: /data/node4/core
|
||||||
|
target: /coredump
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data
|
source: /data
|
||||||
target: /root
|
target: /root
|
||||||
|
hostname: tdnode4
|
||||||
networks:
|
networks:
|
||||||
taos_update_net:
|
taos_update_net:
|
||||||
ipv4_address: 172.27.0.10
|
ipv4_address: 172.27.0.10
|
||||||
|
|
|
@ -7,8 +7,8 @@ services:
|
||||||
args:
|
args:
|
||||||
- PACKAGE=${PACKAGE}
|
- PACKAGE=${PACKAGE}
|
||||||
- EXTRACTDIR=${DIR}
|
- EXTRACTDIR=${DIR}
|
||||||
image: 'tdengine:2.0.13.1'
|
image: 'tdengine:${VERSION}'
|
||||||
container_name: 'td2.0-node5'
|
container_name: 'tdnode5'
|
||||||
cap_add:
|
cap_add:
|
||||||
- ALL
|
- ALL
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
@ -18,7 +18,15 @@ services:
|
||||||
command: >
|
command: >
|
||||||
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
echo $TZ > /etc/timezone &&
|
echo $TZ > /etc/timezone &&
|
||||||
|
mkdir /coredump &&
|
||||||
|
echo 'kernel.core_pattern=/coredump/core_%e_%p' >> /etc/sysctl.conf &&
|
||||||
|
sysctl -p &&
|
||||||
exec my-main-application"
|
exec my-main-application"
|
||||||
|
extra_hosts:
|
||||||
|
- "tdnode2:172.27.0.8"
|
||||||
|
- "tdnode3:172.27.0.9"
|
||||||
|
- "tdnode4:172.27.0.10"
|
||||||
|
- "tdnode5:172.27.0.11"
|
||||||
volumes:
|
volumes:
|
||||||
# bind data directory
|
# bind data directory
|
||||||
- type: bind
|
- type: bind
|
||||||
|
@ -32,9 +40,14 @@ services:
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data/node5/cfg
|
source: /data/node5/cfg
|
||||||
target: /etc/taos
|
target: /etc/taos
|
||||||
|
# bind core dump path
|
||||||
|
- type: bind
|
||||||
|
source: /data/node5/core
|
||||||
|
target: /coredump
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /data
|
source: /data
|
||||||
target: /root
|
target: /root
|
||||||
|
hostname: tdnode5
|
||||||
networks:
|
networks:
|
||||||
taos_update_net:
|
taos_update_net:
|
||||||
ipv4_address: 172.27.0.11
|
ipv4_address: 172.27.0.11
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
|
import random
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
class taosdemoxWrapper:
|
||||||
|
|
||||||
|
def __init__(self, host, metadata, database, tables, threads, configDir, replica,
|
||||||
|
columnType, columnsPerTable, rowsPerTable, disorderRatio, disorderRange, charTypeLen):
|
||||||
|
self.host = host
|
||||||
|
self.metadata = metadata
|
||||||
|
self.database = database
|
||||||
|
self.tables = tables
|
||||||
|
self.threads = threads
|
||||||
|
self.configDir = configDir
|
||||||
|
self.replica = replica
|
||||||
|
self.columnType = columnType
|
||||||
|
self.columnsPerTable = columnsPerTable
|
||||||
|
self.rowsPerTable = rowsPerTable
|
||||||
|
self.disorderRatio = disorderRatio
|
||||||
|
self.disorderRange = disorderRange
|
||||||
|
self.charTypeLen = charTypeLen
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.metadata is None:
|
||||||
|
os.system("taosdemox -h %s -d %s -t %d -T %d -c %s -a %d -b %s -n %d -t %d -O %d -R %d -w %d -x -y"
|
||||||
|
% (self.host, self.database, self.tables, self.threads, self.configDir, self.replica, self.columnType,
|
||||||
|
self.rowsPerTable, self.disorderRatio, self.disorderRange, self.charTypeLen))
|
||||||
|
else:
|
||||||
|
os.system("taosdemox -f %s" % self.metadata)
|
||||||
|
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
'-H',
|
||||||
|
'--host-name',
|
||||||
|
action='store',
|
||||||
|
default='tdnode1',
|
||||||
|
type=str,
|
||||||
|
help='host name to be connected (default: tdnode1)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-f',
|
||||||
|
'--metadata',
|
||||||
|
action='store',
|
||||||
|
default=None,
|
||||||
|
type=str,
|
||||||
|
help='The meta data to execution procedure, if use -f, all other options invalid, Default is NULL')
|
||||||
|
parser.add_argument(
|
||||||
|
'-d',
|
||||||
|
'--db-name',
|
||||||
|
action='store',
|
||||||
|
default='test',
|
||||||
|
type=str,
|
||||||
|
help='Database name to be created (default: test)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-t',
|
||||||
|
'--num-of-tables',
|
||||||
|
action='store',
|
||||||
|
default=10,
|
||||||
|
type=int,
|
||||||
|
help='Number of tables (default: 10000)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-T',
|
||||||
|
'--num-of-threads',
|
||||||
|
action='store',
|
||||||
|
default=10,
|
||||||
|
type=int,
|
||||||
|
help='Number of rest threads (default: 10)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-c',
|
||||||
|
'--config-dir',
|
||||||
|
action='store',
|
||||||
|
default='/etc/taos/',
|
||||||
|
type=str,
|
||||||
|
help='Configuration directory. (Default is /etc/taos/)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-a',
|
||||||
|
'--replica',
|
||||||
|
action='store',
|
||||||
|
default=100,
|
||||||
|
type=int,
|
||||||
|
help='Set the replica parameters of the database (default: 1, min: 1, max: 3)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-b',
|
||||||
|
'--column-type',
|
||||||
|
action='store',
|
||||||
|
default='int',
|
||||||
|
type=str,
|
||||||
|
help='the data_type of columns (default: TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,BINARY,NCHAR,BOOL,TIMESTAMP)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-l',
|
||||||
|
'--num-of-cols',
|
||||||
|
action='store',
|
||||||
|
default=10,
|
||||||
|
type=int,
|
||||||
|
help='The number of columns per record (default: 10)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-n',
|
||||||
|
'--num-of-rows',
|
||||||
|
action='store',
|
||||||
|
default=1000,
|
||||||
|
type=int,
|
||||||
|
help='Number of subtales per stable (default: 1000)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-O',
|
||||||
|
'--disorder-ratio',
|
||||||
|
action='store',
|
||||||
|
default=0,
|
||||||
|
type=int,
|
||||||
|
help=' (0: in order, > 0: disorder ratio, default: 0)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-R',
|
||||||
|
'--disorder-range',
|
||||||
|
action='store',
|
||||||
|
default=0,
|
||||||
|
type=int,
|
||||||
|
help='Out of order datas range, ms (default: 1000)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-w',
|
||||||
|
'--char-type-length',
|
||||||
|
action='store',
|
||||||
|
default=16,
|
||||||
|
type=int,
|
||||||
|
help='Out of order datas range, ms (default: 16)')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
taosdemox = taosdemoxWrapper(args.host_name, args.metadata, args.db_name, args.num_of_tables,
|
||||||
|
args.num_of_threads, args.config_dir, args.replica, args.column_type, args.num_of_cols,
|
||||||
|
args.num_of_rows, args.disorder_ratio, args.disorder_range, args.char_type_length)
|
||||||
|
taosdemox.run()
|
Loading…
Reference in New Issue