diff --git a/.gitmodules b/.gitmodules index 156226d54486c17e64b9c514e47e3a7dc3fe6942..74afbbf9973abec6423633b848181b349de4ed6f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,9 @@ [submodule "src/connector/grafanaplugin"] path = src/connector/grafanaplugin url = https://github.com/taosdata/grafanaplugin +[submodule "src/connector/hivemq-tdengine-extension"] + path = src/connector/hivemq-tdengine-extension + url = https://github.com/huskar-t/hivemq-tdengine-extension.git [submodule "tests/examples/rust"] path = tests/examples/rust url = https://github.com/songtianyi/tdengine-rust-bindings.git -[submodule "src/connector/hivemq-tdengine-extension"] - path = src/connector/hivemq-tdengine-extension - url = https://github.com/huskar-t/hivemq-tdengine-extension.git \ No newline at end of file diff --git a/cmake/version.inc b/cmake/version.inc index 07356bb2161bde20a2e6e0c9588a15cf2fb11b10..962f1f60406f3657a379ee99427e110985988c44 100755 --- a/cmake/version.inc +++ b/cmake/version.inc @@ -4,7 +4,7 @@ PROJECT(TDengine) IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "2.0.14.0") + SET(TD_VER_NUMBER "2.0.16.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/packaging/docker/dockerManifest.sh b/packaging/docker/dockerManifest.sh index ca2c3c66c9875a697b372f73448aa53deb887f68..b52580cfa6bdc13fcc7b716a85029fd1c679a6b6 100755 --- a/packaging/docker/dockerManifest.sh +++ b/packaging/docker/dockerManifest.sh @@ -35,10 +35,11 @@ done echo "verNumber=${verNumber}" -docker manifest create -a tdengine/tdengine:${verNumber} tdengine/tdengine-amd64:${verNumber} tdengine/tdengine-aarch64:${verNumber} tdengine/tdengine-aarch32:${verNumber} +#docker manifest create -a tdengine/tdengine:${verNumber} tdengine/tdengine-amd64:${verNumber} tdengine/tdengine-aarch64:${verNumber} tdengine/tdengine-aarch32:${verNumber} +docker manifest create -a tdengine/tdengine tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest docker login -u tdengine -p ${passWord} #replace the docker registry username and password -docker manifest push tdengine/tdengine:${verNumber} +docker manifest push tdengine/tdengine # how set latest version ??? diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 102fea6b9e3f8892d8e8af26c6ee54bdaa948fb8..7b6bfee42bd1a533798365edecacdff528420d73 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: tdengine base: core18 -version: '2.0.14.0' +version: '2.0.16.0' icon: snap/gui/t-dengine.svg summary: an open-source big data platform designed and optimized for IoT. description: | @@ -72,7 +72,7 @@ parts: - usr/bin/taosd - usr/bin/taos - usr/bin/taosdemo - - usr/lib/libtaos.so.2.0.14.0 + - usr/lib/libtaos.so.2.0.16.0 - usr/lib/libtaos.so.1 - usr/lib/libtaos.so diff --git a/tests/examples/rust b/tests/examples/rust new file mode 160000 index 0000000000000000000000000000000000000000..1c8924dc668e6aa848214c2fc54e3ace3f5bf8df --- /dev/null +++ b/tests/examples/rust @@ -0,0 +1 @@ +Subproject commit 1c8924dc668e6aa848214c2fc54e3ace3f5bf8df diff --git a/tests/pytest/cluster/clusterEnvSetup/Dockerfile b/tests/pytest/cluster/clusterEnvSetup/Dockerfile index b699e8a23ff0e1ff329ffaf4b97aa8f34350eaf7..c9c4d79be981e45609e040bf5835e275fc446260 100644 --- a/tests/pytest/cluster/clusterEnvSetup/Dockerfile +++ b/tests/pytest/cluster/clusterEnvSetup/Dockerfile @@ -2,15 +2,20 @@ FROM ubuntu:latest AS builder ARG PACKAGE=TDengine-server-1.6.5.10-Linux-x64.tar.gz 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 WORKDIR /root - + COPY ${PACKAGE} . +COPY ${TARBITRATORPKG} . RUN tar -zxf ${PACKAGE} +RUN tar -zxf ${TARBITRATORPKG} RUN mv ${EXTRACTDIR}/driver ./lib RUN tar -zxf ${EXTRACTDIR}/${CONTENT} +RUN mv ${EXTRACTDIR2}/bin/* /root/bin FROM ubuntu:latest @@ -19,8 +24,10 @@ WORKDIR /root RUN apt-get update RUN apt-get install -y vim tmux net-tools 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/tarbitrator /usr/bin COPY --from=builder /root/bin/taos /usr/bin COPY --from=builder /root/cfg/taos.cfg /etc/taos/ COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1 @@ -29,8 +36,8 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" ENV LC_CTYPE=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" ] -CMD [ "bash" ] +CMD [ "bash" ] \ No newline at end of file diff --git a/tests/pytest/cluster/clusterEnvSetup/basic.py b/tests/pytest/cluster/clusterEnvSetup/basic.py index 10ba91ab06704f9373b7c7a4c1d2cab72287d0dd..d9b8e9ce4a7bc144839334332268ac0f09f78f0d 100644 --- a/tests/pytest/cluster/clusterEnvSetup/basic.py +++ b/tests/pytest/cluster/clusterEnvSetup/basic.py @@ -12,15 +12,89 @@ # -*- coding: utf-8 -*- import os +import taos 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): - os.system("./buildClusterEnv.sh -n 3 -v 2.0.14.1") - os.system("yes|taosdemo -h 172.27.0.7 -n 100 -t 100 -x") - os.system("python3 ../../concurrent_inquiry.py -H 172.27.0.7 -T 4 -t 4 -l 10") + if self.numOfNodes < 2 or self.numOfNodes > 5: + print("the number of nodes must be between 2 and 5") + exit(0) + os.system("./buildClusterEnv.sh -n %d -v %s" % (self.numOfNodes, self.clusterVersion)) + self.getConnection() + self.createDondes() + self.startArbitrator() + +parser = argparse.ArgumentParser() +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') -clusterTest = ClusterTestcase() -clusterTest.run() \ No newline at end of file +args = parser.parse_args() +cluster = BuildDockerCluser(args.host, args.user, args.password, args.config_dir, args.num_of_nodes, args.version) +cluster.run() \ No newline at end of file diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh index 973d000a0ad582d3aba90fc1f7ff8f7d88812473..968cdd1c1c81b9f6dba68bc2cca542038ada8606 100755 --- a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh +++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh @@ -27,18 +27,28 @@ do esac 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 { - for i in {1.. $2} + for i in {1..5} do mkdir -p /data/node$i/data mkdir -p /data/node$i/log mkdir -p /data/node$i/cfg + mkdir -p /data/node$i/core done } function cleanEnv { - for i in {1..3} + for i in {1..5} do echo /data/node$i/data/* rm -rf /data/node$i/data/* @@ -54,49 +64,60 @@ function prepareBuild { rm -rf $CURR_DIR/../../../../release/* fi - cd $CURR_DIR/../../../../packaging - ./release.sh -v edge -n $VERSION >> /dev/null + 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 + echo "generating TDeninger packages" + ./release.sh -v edge -n $VERSION >> /dev/null - if [ ! -f $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then - echo "no TDengine install package found" - exit 1 - fi + if [ ! -e $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then + echo "no TDengine install package found" + exit 1 + 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 - mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR + cd $CURR_DIR/../../../../release + 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 cd $CURR_DIR - cp docker-compose.yml $DOCKER_DIR + cp *.yml $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 { + 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 - 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 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 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 + + echo "docker compose finish" } -cleanEnv +createDIR +cleanEnv +addTaoscfg prepareBuild clusterUp \ No newline at end of file diff --git a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml index c45a09582b5cd46a20ce052f3f535def67c46232..cb35abd9a1497c92dee10e1e6fb95027fb21710c 100644 --- a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml +++ b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml @@ -1,14 +1,16 @@ version: '3.7' services: - td2.0-node1: - build: + td2.0-node1: + build: context: . args: - PACKAGE=${PACKAGE} + - TARBITRATORPKG=${TARBITRATORPKG} - EXTRACTDIR=${DIR} + - EXTRACTDIR2=${DIR2} image: 'tdengine:${VERSION}' - container_name: 'td2.0-node1' + container_name: 'tdnode1' cap_add: - ALL stdin_open: true @@ -18,7 +20,15 @@ services: 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: + - "tdnode2:172.27.0.8" + - "tdnode3:172.27.0.9" + - "tdnode4:172.27.0.10" + - "tdnode5:172.27.0.11" volumes: # bind data directory - type: bind @@ -32,14 +42,18 @@ services: - type: bind source: /data/node1/cfg target: /etc/taos + # bind core dump path + - type: bind + source: /data/node1/core + target: /coredump - type: bind source: /data target: /root - hostname: node1 + hostname: tdnode1 networks: taos_update_net: ipv4_address: 172.27.0.7 - command: taosd + command: taosd td2.0-node2: build: @@ -48,7 +62,7 @@ services: - PACKAGE=${PACKAGE} - EXTRACTDIR=${DIR} image: 'tdengine:${VERSION}' - container_name: 'td2.0-node2' + container_name: 'tdnode2' cap_add: - ALL stdin_open: true @@ -58,7 +72,15 @@ services: 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" + - "tdnode3:172.27.0.9" + - "tdnode4:172.27.0.10" + - "tdnode5:172.27.0.11" volumes: # bind data directory - type: bind @@ -72,52 +94,19 @@ services: - type: bind source: /data/node2/cfg target: /etc/taos + # bind core dump path + - type: bind + source: /data/node2/core + target: /coredump - type: bind source: /data target: /root + hostname: tdnode2 networks: taos_update_net: ipv4_address: 172.27.0.8 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: taos_update_net: diff --git a/tests/pytest/cluster/clusterEnvSetup/insert.json b/tests/pytest/cluster/clusterEnvSetup/insert.json new file mode 100644 index 0000000000000000000000000000000000000000..56a64b7b8561877cb26b4ef2336ab8b98f26c02c --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/insert.json @@ -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}] + }] + }] +} diff --git a/tests/pytest/cluster/clusterEnvSetup/node3.yml b/tests/pytest/cluster/clusterEnvSetup/node3.yml new file mode 100644 index 0000000000000000000000000000000000000000..4f4f3a6f991f0ffff51265fee4c5a3b8941b5d85 --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/node3.yml @@ -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 \ No newline at end of file diff --git a/tests/pytest/cluster/clusterEnvSetup/node4.yml b/tests/pytest/cluster/clusterEnvSetup/node4.yml index 542dc4cac1626ebc4387e6138067a5d91d64434d..c82a174cb883b14c885de7c5e8f19d98263b22b7 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node4.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node4.yml @@ -7,8 +7,8 @@ services: args: - PACKAGE=${PACKAGE} - EXTRACTDIR=${DIR} - image: 'tdengine:2.0.13.1' - container_name: 'td2.0-node4' + image: 'tdengine:${VERSION}' + container_name: 'tdnode4' cap_add: - ALL stdin_open: true @@ -18,7 +18,15 @@ services: 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: + - "tdnode2:172.27.0.8" + - "tdnode3:172.27.0.9" + - "tdnode4:172.27.0.10" + - "tdnode5:172.27.0.11" volumes: # bind data directory - type: bind @@ -32,9 +40,14 @@ services: - type: bind source: /data/node4/cfg target: /etc/taos + # bind core dump path + - type: bind + source: /data/node4/core + target: /coredump - type: bind source: /data - target: /root + target: /root + hostname: tdnode4 networks: taos_update_net: ipv4_address: 172.27.0.10 diff --git a/tests/pytest/cluster/clusterEnvSetup/node5.yml b/tests/pytest/cluster/clusterEnvSetup/node5.yml index 832cc65e0888e5fc51feae7f13a7cd24b813878b..2e37e47512430ac99244f6b2f0e2d309a2145edc 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node5.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node5.yml @@ -7,8 +7,8 @@ services: args: - PACKAGE=${PACKAGE} - EXTRACTDIR=${DIR} - image: 'tdengine:2.0.13.1' - container_name: 'td2.0-node5' + image: 'tdengine:${VERSION}' + container_name: 'tdnode5' cap_add: - ALL stdin_open: true @@ -18,7 +18,15 @@ services: 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: + - "tdnode2:172.27.0.8" + - "tdnode3:172.27.0.9" + - "tdnode4:172.27.0.10" + - "tdnode5:172.27.0.11" volumes: # bind data directory - type: bind @@ -32,9 +40,14 @@ services: - type: bind source: /data/node5/cfg target: /etc/taos + # bind core dump path + - type: bind + source: /data/node5/core + target: /coredump - type: bind source: /data - target: /root + target: /root + hostname: tdnode5 networks: taos_update_net: ipv4_address: 172.27.0.11 diff --git a/tests/pytest/cluster/clusterEnvSetup/taosdemoxWrapper.py b/tests/pytest/cluster/clusterEnvSetup/taosdemoxWrapper.py new file mode 100644 index 0000000000000000000000000000000000000000..ad0696669a7a3fc3bd40a5016eb12fdf24366cba --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/taosdemoxWrapper.py @@ -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() \ No newline at end of file