feat(时序数据库集成): tdengine\influxdb\iotdb数据库集成

This commit is contained in:
gx_ma
2025-12-17 14:57:18 +08:00
parent 8501632079
commit e0e9f19d85
58 changed files with 6078 additions and 154 deletions

View File

@@ -0,0 +1,70 @@
version: '2'
networks:
network:
driver: bridge
ipam:
driver: default
config:
- subnet: 177.7.0.0/16
services:
tdengine:
image: 'tdengine/tdengine:3.3.5.8'
container_name: tdengine
privileged: true
hostname: fastbee
ports:
- 6030:6030
- 6041:6041
- 6043-6049:6043-6049
- 6043-6049:6043-6049/udp
volumes:
- /var/data/tdengine/log:/var/log/taos
- /var/data/tdengine/data:/var/lib/taos
- /var/data/tdengine/conf:/etc/taos
- /etc/localtime:/etc/localtime
environment:
TZ: Asia/Shanghai
networks:
network:
ipv4_address: 177.7.0.30
influxdb:
image: influxdb:2.7.5
container_name: influxdb
ports:
- 8086:8086
volumes:
- ./influxdb2:/var/lib/influxdb2
environment:
DOCKER_INFLUXDB_INIT_MODE: "setup"
DOCKER_INFLUXDB_INIT_USERNAME: "admin"
DOCKER_INFLUXDB_INIT_PASSWORD: "admin123"
DOCKER_INFLUXDB_INIT_ORG: "fastbee"
DOCKER_INFLUXDB_INIT_BUCKET: "device_log"
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: "inX0k-IPfSgKg6AIfoZm6Mv0DQyQOKCkfvs5ZF3a836Yzx2Ew9QgxsHev40_2gztuMn6tofwyS6nfbT4cD-SeA=="
networks:
network:
ipv4_address: 177.7.0.31
iotdb:
image: apache/iotdb:1.3.3-standalone
hostname: iotdb
container_name: iotdb
restart: always
ports:
- 6667:6667
- 5555:5555
- 8070:8070
- 9003:9003
privileged: true
volumes:
- /var/data/iotdb/data:/iotdb/data
- /var/data/iotdb/logs:/iotdb/logs
- /var/data/iotdb/conf:/iotdb/conf
environment:
TZ: Asia/Shanghai
networks:
network:
ipv4_address: 177.7.0.32

View File

@@ -63,6 +63,7 @@ services:
- redis
- mysql
- zlmedia
- tdengine
volumes:
- /var/data/java/fastbee-admin.jar:/server.jar
- /var/data/java/uploadPath:/uploadPath
@@ -117,5 +118,25 @@ services:
network:
ipv4_address: 177.7.0.15
# tdengine:
# image: 'tdengine/tdengine:3.3.5.8'
# container_name: tdengine
# privileged: true
# hostname: fastbee
# ports:
# - 6030:6030
# - 6041:6041
# - 6043-6049:6043-6049
# - 6043-6049:6043-6049/udp
# volumes:
# - /var/data/tdengine/log:/var/log/taos
# - /var/data/tdengine/data:/var/lib/taos
# - /var/data/tdengine/conf:/etc/taos
# - /etc/localtime:/etc/localtime
# environment:
# TZ: Asia/Shanghai
# networks:
# network:
# ipv4_address: 177.7.0.16

View File

@@ -0,0 +1,156 @@
@REM
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM
@echo off
@REM You can set datanode memory size, example '2G' or '2048M'
set MEMORY_SIZE=
@REM true or false
@REM DO NOT FORGET TO MODIFY THE PASSWORD FOR SECURITY (%CONFIGNODE_CONF%\jmx.password and %{CONFIGNODE_CONF%\jmx.access)
set JMX_LOCAL="true"
set JMX_PORT="32000"
@REM only take effect when the jmx_local=false
@REM You need to change this IP as a public IP if you want to remotely connect IoTDB ConfigNode by JMX.
@REM 0.0.0.0 is not allowed
set JMX_IP="127.0.0.1"
if %JMX_LOCAL% == "false" (
echo "setting remote JMX..."
@REM you may have no permission to run chmod. If so, contact your system administrator.
set CONFIGNODE_JMX_OPTS=-Dcom.sun.management.jmxremote^
-Dcom.sun.management.jmxremote.port=%JMX_PORT%^
-Dcom.sun.management.jmxremote.rmi.port=%JMX_PORT%^
-Djava.rmi.server.randomIDs=true^
-Dcom.sun.management.jmxremote.ssl=false^
-Dcom.sun.management.jmxremote.authenticate=false^
-Dcom.sun.management.jmxremote.password.file="%CONFIGNODE_CONF%\jmx.password"^
-Dcom.sun.management.jmxremote.access.file="%CONFIGNODE_CONF%\jmx.access"^
-Djava.rmi.server.hostname=%JMX_IP%
) else (
echo "setting local JMX..."
)
set CONFIGNODE_JMX_OPTS=%CONFIGNODE_JMX_OPTS% -Diotdb.jmx.local=%JMX_LOCAL%
for /f %%b in ('wmic cpu get numberofcores ^| findstr "[0-9]"') do (
set system_cpu_cores=%%b
)
if %system_cpu_cores% LSS 1 set system_cpu_cores=1
for /f %%b in ('wmic ComputerSystem get TotalPhysicalMemory ^| findstr "[0-9]"') do (
set system_memory=%%b
)
echo wsh.echo FormatNumber(cdbl(%system_memory%)/(1024*1024), 0) > "%CONFIGNODE_HOME%\sbin\tmp.vbs"
for /f "tokens=*" %%a in ('cscript //nologo "%CONFIGNODE_HOME%\sbin\tmp.vbs"') do set system_memory_in_mb=%%a
del "%CONFIGNODE_HOME%\sbin\tmp.vbs"
set system_memory_in_mb=%system_memory_in_mb:,=%
@REM suggest using memory, system memory 3 / 10
set /a suggest_=%system_memory_in_mb%/10*3
if "%MEMORY_SIZE%"=="" (
set /a memory_size_in_mb=%suggest_%
) else (
if "%MEMORY_SIZE:~-1%"=="M" (
set /a memory_size_in_mb=%MEMORY_SIZE:~0,-1%
) else if "%MEMORY_SIZE:~-1%"=="G" (
set /a memory_size_in_mb=%MEMORY_SIZE:~0,-1%*1024
) else (
echo "Invalid format of MEMORY_SIZE, please use the format like 2048M or 2G."
exit /b 1
)
)
@REM set on heap memory size
@REM when memory_size_in_mb is less than 4 * 1024, we will set on heap memory size to memory_size_in_mb / 4 * 3
@REM when memory_size_in_mb is greater than 4 * 1024 and less than 16 * 1024, we will set on heap memory size to memory_size_in_mb / 5 * 4
@REM when memory_size_in_mb is greater than 16 * 1024 and less than 128 * 1024, we will set on heap memory size to memory_size_in_mb / 8 * 7
@REM when memory_size_in_mb is greater than 128 * 1024, we will set on heap memory size to memory_size_in_mb - 16 * 1024
if %memory_size_in_mb% LSS 4096 (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%/4*3
) else if %memory_size_in_mb% LSS 16384 (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%/5*4
) else if %memory_size_in_mb% LSS 131072 (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%/8*7
) else (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%-16384
)
set /a off_heap_memory_size_in_mb=%memory_size_in_mb%-%on_heap_memory_size_in_mb%
set ON_HEAP_MEMORY=%on_heap_memory_size_in_mb%M
set OFF_HEAP_MEMORY=%off_heap_memory_size_in_mb%M
set IOTDB_ALLOW_HEAP_DUMP="true"
@REM on heap memory size
@REM set ON_HEAP_MEMORY=2G
@REM off heap memory size
@REM set OFF_HEAP_MEMORY=512M
if "%OFF_HEAP_MEMORY:~-1%"=="M" (
set /a off_heap_memory_size_in_mb=%OFF_HEAP_MEMORY:~0,-1%
) else if "%OFF_HEAP_MEMORY:~-1%"=="G" (
set /a off_heap_memory_size_in_mb=%OFF_HEAP_MEMORY:~0,-1%*1024
)
@REM threads number of io
set IO_THREADS_NUMBER=100
@REM Max cached buffer size, Note: unit can only be B!
@REM which equals OFF_HEAP_MEMORY / IO_THREADS_NUMBER
set /a MAX_CACHED_BUFFER_SIZE=%off_heap_memory_size_in_mb%/%IO_THREADS_NUMBER%*1024*1024
set CONFIGNODE_HEAP_OPTS=-Xmx%ON_HEAP_MEMORY% -Xms%ON_HEAP_MEMORY%
set CONFIGNODE_HEAP_OPTS=%CONFIGNODE_HEAP_OPTS% -XX:MaxDirectMemorySize=%OFF_HEAP_MEMORY%
set CONFIGNODE_HEAP_OPTS=%CONFIGNODE_HEAP_OPTS% -Djdk.nio.maxCachedBufferSize=%MAX_CACHED_BUFFER_SIZE%
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+CrashOnOutOfMemoryError
@REM if you want to dump the heap memory while OOM happening, you can use the following command, remember to replace /tmp/heapdump.hprof with your own file path and the folder where this file is located needs to be created in advance
@REM IOTDB_JMX_OPTS=%IOTDB_HEAP_OPTS% -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=\tmp\confignode_heapdump.hprof
@REM You can put your env variable here
@REM set JAVA_HOME=%JAVA_HOME%
@REM set gc log.
IF "%1" equ "printgc" (
IF "%JAVA_VERSION%" == "8" (
md "%CONFIGNODE_HOME%\logs"
set CONFIGNODE_HEAP_OPTS=%CONFIGNODE_HEAP_OPTS% -Xloggc:"%CONFIGNODE_HOME%\logs\gc.log" -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
) ELSE (
md "%CONFIGNODE_HOME%\logs"
set CONFIGNODE_HEAP_OPTS=%CONFIGNODE_HEAP_OPTS% -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file="%CONFIGNODE_HOME%\logs\gc.log":time,uptime,pid,tid,level:filecount=10,filesize=10485760
)
)
@REM Add args for Java 11 and above, due to [JEP 396: Strongly Encapsulate JDK Internals by Default] (https://openjdk.java.net/jeps/396)
IF "%JAVA_VERSION%" == "8" (
set ILLEGAL_ACCESS_PARAMS=
) ELSE (
set ILLEGAL_ACCESS_PARAMS=--add-opens=java.base/java.util.concurrent=ALL-UNNAMED^
--add-opens=java.base/java.lang=ALL-UNNAMED^
--add-opens=java.base/java.util=ALL-UNNAMED^
--add-opens=java.base/java.nio=ALL-UNNAMED^
--add-opens=java.base/java.io=ALL-UNNAMED^
--add-opens=java.base/java.net=ALL-UNNAMED
)
echo ConfigNode on heap memory size = %ON_HEAP_MEMORY%B, off heap memory size = %OFF_HEAP_MEMORY%B
echo If you want to change this configuration, please check conf/confignode-env.bat.

View File

@@ -0,0 +1,314 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# You can set ConfigNode memory size, example '2G' or '2048M'
MEMORY_SIZE=
# You can put your env variable here
# export JAVA_HOME=$JAVA_HOME
# Set max number of open files
max_num=$(ulimit -n)
if [ $max_num -le 65535 ]; then
ulimit -n 65535
if [ $? -ne 0 ]; then
echo "Warning: Failed to set max number of files to be 65535, maybe you need to use 'sudo ulimit -n 65535' to set it when you use iotdb ConfigNode in production environments."
fi
fi
# Set somaxconn to a better value to avoid meaningless connection reset issues when the system is under high load.
# The original somaxconn will be set back when the system reboots.
# For more detail, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=19f92a030ca6d772ab44b22ee6a01378a8cb32d4
SOMAXCONN=65535
case "$(uname)" in
Linux)
somaxconn=$(sysctl -n net.core.somaxconn)
if [ "$somaxconn" -lt $SOMAXCONN ]; then
echo "WARN:"
echo "WARN: the value of net.core.somaxconn (=$somaxconn) is too small, please set it to a larger value using the following command."
echo "WARN: sudo sysctl -w net.core.somaxconn=$SOMAXCONN"
echo "WARN: The original net.core.somaxconn value will be set back when the os reboots."
echo "WARN:"
fi
;;
FreeBSD | Darwin)
somaxconn=$(sysctl -n kern.ipc.somaxconn)
if [ "$somaxconn" -lt $SOMAXCONN ]; then
echo "WARN:"
echo "WARN: the value of kern.ipc.somaxconn (=$somaxconn) is too small, please set it to a larger value using the following command."
echo "WARN: sudo sysctl -w kern.ipc.somaxconn=$SOMAXCONN"
echo "WARN: The original kern.ipc.somaxconn value will be set back when the os reboots."
echo "WARN:"
fi
;;
esac
# whether we allow enable heap dump files
IOTDB_ALLOW_HEAP_DUMP="true"
calculate_memory_sizes()
{
case "`uname`" in
Linux)
system_memory_in_mb=`free -m| sed -n '2p' | awk '{print $2}'`
system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo`
;;
FreeBSD)
system_memory_in_bytes=`sysctl hw.physmem | awk '{print $2}'`
system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
;;
SunOS)
system_memory_in_mb=`prtconf | awk '/Memory size:/ {print $3}'`
system_cpu_cores=`psrinfo | wc -l`
;;
Darwin)
system_memory_in_bytes=`sysctl hw.memsize | awk '{print $2}'`
system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
;;
*)
# assume reasonable defaults for e.g. a modern desktop or
# cheap server
system_memory_in_mb="2048"
system_cpu_cores="2"
;;
esac
# some systems like the raspberry pi don't report cores, use at least 1
if [ "$system_cpu_cores" -lt "1" ]
then
system_cpu_cores="1"
fi
# suggest using memory, system memory 3 / 10
suggest_using_memory_in_mb=`expr $system_memory_in_mb / 10 \* 3`
if [ -n "$MEMORY_SIZE" ]
then
if [ "${MEMORY_SIZE%"G"}" != "$MEMORY_SIZE" ] || [ "${MEMORY_SIZE%"M"}" != "$MEMORY_SIZE" ]
then
if [ "${MEMORY_SIZE%"G"}" != "$MEMORY_SIZE" ]
then
memory_size_in_mb=`expr ${MEMORY_SIZE%"G"} "*" 1024`
else
memory_size_in_mb=`expr ${MEMORY_SIZE%"M"}`
fi
else
echo "Invalid format of MEMORY_SIZE, please use the format like 2048M or 2G"
exit 1
fi
else
# set memory size to suggest using memory, if suggest using memory is greater than 8GB, set memory size to 8GB
if [ "$suggest_using_memory_in_mb" -gt "8192" ]
then
memory_size_in_mb="8192"
else
memory_size_in_mb=$suggest_using_memory_in_mb
fi
fi
# set on heap memory size
# when memory_size_in_mb is less than 4 * 1024, we will set on heap memory size to memory_size_in_mb / 4 * 3
# when memory_size_in_mb is greater than 4 * 1024 and less than 16 * 1024, we will set on heap memory size to memory_size_in_mb / 5 * 4
# when memory_size_in_mb is greater than 16 * 1024 and less than 128 * 1024, we will set on heap memory size to memory_size_in_mb / 8 * 7
# when memory_size_in_mb is greater than 128 * 1024, we will set on heap memory size to memory_size_in_mb - 16 * 1024
if [ "$memory_size_in_mb" -lt "4096" ]
then
on_heap_memory_size_in_mb=`expr $memory_size_in_mb / 4 \* 3`
elif [ "$memory_size_in_mb" -lt "16384" ]
then
on_heap_memory_size_in_mb=`expr $memory_size_in_mb / 5 \* 4`
elif [ "$memory_size_in_mb" -lt "131072" ]
then
on_heap_memory_size_in_mb=`expr $memory_size_in_mb / 8 \* 7`
else
on_heap_memory_size_in_mb=`expr $memory_size_in_mb - 16384`
fi
off_heap_memory_size_in_mb=`expr $memory_size_in_mb - $on_heap_memory_size_in_mb`
ON_HEAP_MEMORY="${on_heap_memory_size_in_mb}M"
OFF_HEAP_MEMORY="${off_heap_memory_size_in_mb}M"
}
CONFIGNODE_CONF_DIR="`dirname "$0"`"
get_cn_system_dir() {
local config_file="$1"
local cn_system_dir=""
cn_system_dir=`sed '/^cn_system_dir=/!d;s/.*=//' ${CONFIGNODE_CONF_DIR}/${config_file} | tail -n 1`
if [ -z "$cn_system_dir" ]; then
echo ""
return 0
fi
if [[ "$cn_system_dir" == /* ]]; then
echo "$cn_system_dir"
else
echo "$CONFIGNODE_CONF_DIR/../$cn_system_dir"
fi
}
if [ -f "${CONFIGNODE_CONF_DIR}/iotdb-system.properties" ]; then
heap_dump_dir=$(get_cn_system_dir "iotdb-system.properties")
else
heap_dump_dir=$(get_cn_system_dir "iotdb-confignode.properties")
fi
if [ -z "$heap_dump_dir" ]; then
heap_dump_dir="$(dirname "$0")/../data/confignode/system"
fi
if [ ! -d "$heap_dump_dir" ]; then
mkdir -p "$heap_dump_dir"
fi
# find java in JAVA_HOME
if [ -n "$JAVA_HOME" ]; then
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
if [ -x "$java" ]; then
JAVA="$java"
break
fi
done
else
JAVA=java
fi
if [ -z $JAVA ] ; then
echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. > /dev/stderr
exit 1;
fi
# Determine the sort of JVM we'll be running on.
java_ver_output=`"$JAVA" -version 2>&1`
jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1`
JVM_VERSION=${jvmver%_*}
JVM_PATCH_VERSION=${jvmver#*_}
if [ "$JVM_VERSION" \< "1.8" ] ; then
echo "IoTDB requires Java 8u92 or later."
exit 1;
fi
if [ "$JVM_VERSION" \< "1.8" ] && [ "$JVM_PATCH_VERSION" -lt 92 ] ; then
echo "IoTDB requires Java 8u92 or later."
exit 1;
fi
version_arr=(${JVM_VERSION//./ })
illegal_access_params=""
#GC log path has to be defined here because it needs to access CONFIGNODE_HOME
if [ "${version_arr[0]}" = "1" ] ; then
# Java 8
MAJOR_VERSION=${version_arr[1]}
echo "$CONFIGNODE_JMX_OPTS" | grep -q "^-[X]loggc"
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
mkdir -p ${CONFIGNODE_HOME}/logs
if [ "$#" -ge "1" -a "$1" == "printgc" ]; then
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xloggc:${CONFIGNODE_HOME}/logs/gc.log -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M"
fi
fi
else
#JDK 11 and others
MAJOR_VERSION=${version_arr[0]}
# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax
# The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
echo "$CONFIGNODE_JMX_OPTS" | grep -q "^-[X]log:gc"
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
mkdir -p ${CONFIGNODE_HOME}/logs
if [ "$#" -ge "1" -a "$1" == "printgc" ]; then
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xlog:gc=info,heap*=info,age*=info,safepoint=info,promotion*=info:file=${CONFIGNODE_HOME}/logs/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760"
fi
fi
# Add argLine for Java 11 and above, due to [JEP 396: Strongly Encapsulate JDK Internals by Default] (https://openjdk.java.net/jeps/396)
illegal_access_params="$illegal_access_params --add-opens=java.base/java.util.concurrent=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.lang=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.util=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.nio=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.io=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.net=ALL-UNNAMED"
fi
calculate_memory_sizes
# on heap memory size
#ON_HEAP_MEMORY="2G"
# off heap memory size
#OFF_HEAP_MEMORY="512M"
if [ "${OFF_HEAP_MEMORY%"G"}" != "$OFF_HEAP_MEMORY" ]
then
off_heap_memory_size_in_mb=`expr ${OFF_HEAP_MEMORY%"G"} "*" 1024`
else
off_heap_memory_size_in_mb=`expr ${OFF_HEAP_MEMORY%"M"}`
fi
# threads number of io
IO_THREADS_NUMBER="100"
# Max cached buffer size, Note: unit can only be B!
# which equals OFF_HEAP_MEMORY / IO_THREADS_NUMBER
MAX_CACHED_BUFFER_SIZE=`expr $off_heap_memory_size_in_mb \* 1024 \* 1024 / $IO_THREADS_NUMBER`
#true or false
#DO NOT FORGET TO MODIFY THE PASSWORD FOR SECURITY (${CONFIGNODE_CONF}/jmx.password and ${CONFIGNODE_CONF}/jmx.access)
#If you want to connect JMX Service by network in local machine, such as nodeTool.sh will try to connect 127.0.0.1:31999, please set JMX_LOCAL to false.
JMX_LOCAL="true"
JMX_PORT="32000"
#only take effect when the jmx_local=false
#You need to change this IP as a public IP if you want to remotely connect IoTDB ConfigNode by JMX.
# 0.0.0.0 is not allowed
JMX_IP="127.0.0.1"
if [ ${JMX_LOCAL} = "false" ]; then
echo "setting remote JMX..."
#you may have no permission to run chmod. If so, contact your system administrator.
chmod 600 ${CONFIGNODE_CONF}/jmx.password
chmod 600 ${CONFIGNODE_CONF}/jmx.access
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Dcom.sun.management.jmxremote"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Djava.rmi.server.randomIDs=true"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Dcom.sun.management.jmxremote.ssl=false"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Dcom.sun.management.jmxremote.password.file=${CONFIGNODE_CONF}/jmx.password"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Dcom.sun.management.jmxremote.access.file=${CONFIGNODE_CONF}/jmx.access"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Djava.rmi.server.hostname=$JMX_IP"
else
echo "setting local JMX..."
fi
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Diotdb.jmx.local=$JMX_LOCAL"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xms${ON_HEAP_MEMORY}"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xmx${ON_HEAP_MEMORY}"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -XX:MaxDirectMemorySize=${OFF_HEAP_MEMORY}"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Djdk.nio.maxCachedBufferSize=${MAX_CACHED_BUFFER_SIZE}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+CrashOnOutOfMemoryError"
# if you want to dump the heap memory while OOM happening, you can use the following command, remember to replace /tmp/heapdump.hprof with your own file path and the folder where this file is located needs to be created in advance
#IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${heap_dump_dir}/confignode_heapdump.hprof"
echo "ConfigNode on heap memory size = ${ON_HEAP_MEMORY}B, off heap memory size = ${OFF_HEAP_MEMORY}B"
echo "If you want to change this configuration, please check conf/confignode-env.sh."

View File

@@ -0,0 +1,187 @@
@REM
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM
@echo off
@REM You can set datanode memory size, example '2G' or '2048M'
set MEMORY_SIZE=
@REM true or false
@REM DO NOT FORGET TO MODIFY THE PASSWORD FOR SECURITY (%IOTDB_CONF%\jmx.password and %{IOTDB_CONF%\jmx.access)
set JMX_LOCAL="true"
set JMX_PORT="31999"
@REM only take effect when the jmx_local=false
@REM You need to change this IP as a public IP if you want to remotely connect IoTDB by JMX.
@REM 0.0.0.0 is not allowed
set JMX_IP="127.0.0.1"
if %JMX_LOCAL% == "false" (
echo "setting remote JMX..."
@REM you may have no permission to run chmod. If so, contact your system administrator.
set IOTDB_JMX_OPTS=-Dcom.sun.management.jmxremote^
-Dcom.sun.management.jmxremote.port=%JMX_PORT%^
-Dcom.sun.management.jmxremote.rmi.port=%JMX_PORT%^
-Djava.rmi.server.randomIDs=true^
-Dcom.sun.management.jmxremote.ssl=false^
-Dcom.sun.management.jmxremote.authenticate=false^
-Dcom.sun.management.jmxremote.password.file="%IOTDB_CONF%\jmx.password"^
-Dcom.sun.management.jmxremote.access.file="%IOTDB_CONF%\jmx.acces"s^
-Djava.rmi.server.hostname=%JMX_IP%
) else (
echo "setting local JMX..."
)
set IOTDB_JMX_OPTS=%IOTDB_JMX_OPTS% -Diotdb.jmx.local=%JMX_LOCAL%
for /f %%b in ('wmic cpu get numberofcores ^| findstr "[0-9]"') do (
set system_cpu_cores=%%b
)
if %system_cpu_cores% LSS 1 set system_cpu_cores=1
for /f %%b in ('wmic ComputerSystem get TotalPhysicalMemory ^| findstr "[0-9]"') do (
set system_memory=%%b
)
echo wsh.echo FormatNumber(cdbl(%system_memory%)/(1024*1024), 0) > "%IOTDB_HOME%\sbin\tmp.vbs"
for /f "tokens=*" %%a in ('cscript //nologo "%IOTDB_HOME%\sbin\tmp.vbs"') do set system_memory_in_mb=%%a
del "%IOTDB_HOME%\sbin\tmp.vbs"
set system_memory_in_mb=%system_memory_in_mb:,=%
set /a suggest_=%system_memory_in_mb%/2
if "%MEMORY_SIZE%"=="" (
set /a memory_size_in_mb=%suggest_%
) else (
if "%MEMORY_SIZE:~-1%"=="M" (
set /a memory_size_in_mb=%MEMORY_SIZE:~0,-1%
) else if "%MEMORY_SIZE:~-1%"=="G" (
set /a memory_size_in_mb=%MEMORY_SIZE:~0,-1%*1024
) else (
echo "Invalid format of MEMORY_SIZE, please use the format like 2048M or 2G."
exit /b 1
)
)
@REM set on heap memory size
@REM when memory_size_in_mb is less than 4 * 1024, we will set on heap memory size to memory_size_in_mb / 4 * 3
@REM when memory_size_in_mb is greater than 4 * 1024 and less than 16 * 1024, we will set on heap memory size to memory_size_in_mb / 5 * 4
@REM when memory_size_in_mb is greater than 16 * 1024 and less than 128 * 1024, we will set on heap memory size to memory_size_in_mb / 8 * 7
@REM when memory_size_in_mb is greater than 128 * 1024, we will set on heap memory size to memory_size_in_mb - 16 * 1024
if %memory_size_in_mb% LSS 4096 (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%/4*3
) else if %memory_size_in_mb% LSS 16384 (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%/5*4
) else if %memory_size_in_mb% LSS 131072 (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%/8*7
) else (
set /a on_heap_memory_size_in_mb=%memory_size_in_mb%-16384
)
set /a off_heap_memory_size_in_mb=%memory_size_in_mb%-%on_heap_memory_size_in_mb%
set ON_HEAP_MEMORY=%on_heap_memory_size_in_mb%M
set OFF_HEAP_MEMORY=%off_heap_memory_size_in_mb%M
set IOTDB_ALLOW_HEAP_DUMP="true"
@REM on heap memory size
@REM set ON_HEAP_MEMORY=2G
@REM off heap memory size
@REM set OFF_HEAP_MEMORY=512M
if "%OFF_HEAP_MEMORY:~-1%"=="M" (
set /a off_heap_memory_size_in_mb=%OFF_HEAP_MEMORY:~0,-1%
) else if "%OFF_HEAP_MEMORY:~-1%"=="G" (
set /a off_heap_memory_size_in_mb=%OFF_HEAP_MEMORY:~0,-1%*1024
)
@REM threads number of io
set IO_THREADS_NUMBER=1000
@REM Max cached buffer size, Note: unit can only be B!
@REM which equals OFF_HEAP_MEMORY / IO_THREADS_NUMBER
set /a MAX_CACHED_BUFFER_SIZE=%off_heap_memory_size_in_mb%/%IO_THREADS_NUMBER%*1024*1024
set IOTDB_HEAP_OPTS=-Xmx%ON_HEAP_MEMORY% -Xms%ON_HEAP_MEMORY%
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:MaxDirectMemorySize=%OFF_HEAP_MEMORY%
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -Djdk.nio.maxCachedBufferSize=%MAX_CACHED_BUFFER_SIZE%
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+CrashOnOutOfMemoryError
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+UseAdaptiveSizePolicy
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -Xss512k
@REM options below try to optimize safepoint stw time.
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+UnlockDiagnosticVMOptions
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:GuaranteedSafepointInterval=0
@REM these two options print safepoints with pauses longer than 1000ms to the standard output. You can see these logs via redirection when starting in the background like "start-datanode.sh > log_datanode_safepoint.txt"
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:SafepointTimeoutDelay=1000
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+SafepointTimeout
@REM option below tries to optimize safepoint stw time for large counted loop.
@REM NOTE: it may have an impact on JIT's black-box optimization.
@REM set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+UseCountedLoopSafepoints
@REM When the GC time is too long, if there are remaining CPU resources, you can try to turn on and increase options below.
@REM for /F "tokens=2 delims==" %%I in ('wmic cpu get NumberOfCores /value') do (
@REM set "CPU_PROCESSOR_NUM=%%I"
@REM )
@REM set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:ParallelGCThreads=%CPU_PROCESSOR_NUM%
@REM if there are much of stw time of reference process in GC log, you can turn on option below.
@REM NOTE: it may have an impact on application's throughput.
@REM set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+ParallelRefProcEnabled
@REM this option can reduce the overhead caused by memory allocation, page fault interrupts, etc. during JVM operation.
@REM NOTE: it may reduce memory utilization and trigger OOM killer when memory is tight.
@REM set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -XX:+AlwaysPreTouch
@REM if you want to dump the heap memory while OOM happening, you can use the following command, remember to replace /tmp/heapdump.hprof with your own file path and the folder where this file is located needs to be created in advance
@REM set IOTDB_JMX_OPTS=%IOTDB_HEAP_OPTS% -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=\tmp\datanode_heapdump.hprof
@REM You can put your env variable here
@REM set JAVA_HOME=%JAVA_HOME%
@REM set gc log.
IF "%1" equ "printgc" (
IF "%JAVA_VERSION%" == "8" (
md "%IOTDB_HOME%\logs"
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -Xloggc:"%IOTDB_HOME%\logs\gc.log" -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
@REM For more detailed GC information, you can uncomment option below.
@REM NOTE: more detailed GC information may bring larger GC log files.
@REM set IOTDB_JMX_OPTS=%IOTDB_JMX_OPTS% -Xloggc:"%IOTDB_HOME%\logs\gc.log" -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+UseGCLogFileRotation -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+PrintReferenceGC -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1 -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M
) ELSE (
md "%IOTDB_HOME%\logs"
set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file="%IOTDB_HOME%\logs\gc.log":time,uptime,pid,tid,level:filecount=10,filesize=10485760
@REM For more detailed GC information, you can uncomment option below.
@REM NOTE: more detailed GC information may bring larger GC log files.
@REM set IOTDB_JMX_OPTS=%IOTDB_JMX_OPTS% -Xlog:gc*=debug,heap*=debug,age*=trace,metaspace*=info,safepoint*=debug,promotion*=info:file="%IOTDB_HOME%\logs\gc.log":time,uptime,pid,tid,level,tags:filecount=10,filesize=100M
)
)
@REM Add args for Java 11 and above, due to [JEP 396: Strongly Encapsulate JDK Internals by Default] (https://openjdk.java.net/jeps/396)
IF "%JAVA_VERSION%" == "8" (
set ILLEGAL_ACCESS_PARAMS=
) ELSE (
set ILLEGAL_ACCESS_PARAMS=--add-opens=java.base/java.util.concurrent=ALL-UNNAMED^
--add-opens=java.base/java.lang=ALL-UNNAMED^
--add-opens=java.base/java.util=ALL-UNNAMED^
--add-opens=java.base/java.nio=ALL-UNNAMED^
--add-opens=java.base/java.io=ALL-UNNAMED^
--add-opens=java.base/java.net=ALL-UNNAMED
)
echo DataNode on heap memory size = %ON_HEAP_MEMORY%B, off heap memory size = %OFF_HEAP_MEMORY%B
echo If you want to change this configuration, please check conf\datanode-env.bat.

View File

@@ -0,0 +1,351 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# You can set DataNode memory size, example '2G' or '2048M'
MEMORY_SIZE=
# You can put your env variable here
# export JAVA_HOME=$JAVA_HOME
# Set max number of open files
max_num=$(ulimit -n)
if [ $max_num -le 65535 ]; then
ulimit -n 65535
if [ $? -ne 0 ]; then
echo "Warning: Failed to set max number of files to be 65535, maybe you need to use 'sudo ulimit -n 65535' to set it when you use iotdb in production environments."
fi
fi
# Set somaxconn to a better value to avoid meaningless connection reset issues when the system is under high load.
# The original somaxconn will be set back when the system reboots.
# For more detail, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=19f92a030ca6d772ab44b22ee6a01378a8cb32d4
SOMAXCONN=65535
case "$(uname)" in
Linux)
somaxconn=$(sysctl -n net.core.somaxconn)
if [ "$somaxconn" -lt $SOMAXCONN ]; then
echo "WARN:"
echo "WARN: the value of net.core.somaxconn (=$somaxconn) is too small, please set it to a larger value using the following command."
echo "WARN: sudo sysctl -w net.core.somaxconn=$SOMAXCONN"
echo "WARN: The original net.core.somaxconn value will be set back when the os reboots."
echo "WARN:"
fi
;;
FreeBSD | Darwin)
somaxconn=$(sysctl -n kern.ipc.somaxconn)
if [ "$somaxconn" -lt $SOMAXCONN ]; then
echo "WARN:"
echo "WARN: the value of kern.ipc.somaxconn (=$somaxconn) is too small, please set it to a larger value using the following command."
echo "WARN: sudo sysctl -w kern.ipc.somaxconn=$SOMAXCONN"
echo "WARN: The original kern.ipc.somaxconn value will be set back when the os reboots."
echo "WARN:"
fi
;;
esac
# whether we allow enable heap dump files
IOTDB_ALLOW_HEAP_DUMP="true"
calculate_memory_sizes()
{
case "`uname`" in
Linux)
system_memory_in_mb=`free -m| sed -n '2p' | awk '{print $2}'`
system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo`
;;
FreeBSD)
system_memory_in_bytes=`sysctl hw.physmem | awk '{print $2}'`
system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
;;
SunOS)
system_memory_in_mb=`prtconf | awk '/Memory size:/ {print $3}'`
system_cpu_cores=`psrinfo | wc -l`
;;
Darwin)
system_memory_in_bytes=`sysctl hw.memsize | awk '{print $2}'`
system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
;;
*)
# assume reasonable defaults for e.g. a modern desktop or
# cheap server
system_memory_in_mb="2048"
system_cpu_cores="2"
;;
esac
# some systems like the raspberry pi don't report cores, use at least 1
if [ "$system_cpu_cores" -lt "1" ]
then
system_cpu_cores="1"
fi
# suggest using memory, system memory 1 / 2
suggest_using_memory_in_mb=`expr $system_memory_in_mb / 2`
if [ -n "$MEMORY_SIZE" ]
then
if [ "${MEMORY_SIZE%"G"}" != "$MEMORY_SIZE" ] || [ "${MEMORY_SIZE%"M"}" != "$MEMORY_SIZE" ]
then
if [ "${MEMORY_SIZE%"G"}" != "$MEMORY_SIZE" ]
then
memory_size_in_mb=`expr ${MEMORY_SIZE%"G"} "*" 1024`
else
memory_size_in_mb=`expr ${MEMORY_SIZE%"M"}`
fi
else
echo "Invalid format of MEMORY_SIZE, please use the format like 2048M or 2G"
exit 1
fi
else
memory_size_in_mb=$suggest_using_memory_in_mb
fi
# set on heap memory size
# when memory_size_in_mb is less than 4 * 1024, we will set on heap memory size to memory_size_in_mb / 4 * 3
# when memory_size_in_mb is greater than 4 * 1024 and less than 16 * 1024, we will set on heap memory size to memory_size_in_mb / 5 * 4
# when memory_size_in_mb is greater than 16 * 1024 and less than 128 * 1024, we will set on heap memory size to memory_size_in_mb / 8 * 7
# when memory_size_in_mb is greater than 128 * 1024, we will set on heap memory size to memory_size_in_mb - 16 * 1024
if [ "$memory_size_in_mb" -lt "4096" ]
then
on_heap_memory_size_in_mb=`expr $memory_size_in_mb / 4 \* 3`
elif [ "$memory_size_in_mb" -lt "16384" ]
then
on_heap_memory_size_in_mb=`expr $memory_size_in_mb / 5 \* 4`
elif [ "$memory_size_in_mb" -lt "131072" ]
then
on_heap_memory_size_in_mb=`expr $memory_size_in_mb / 8 \* 7`
else
on_heap_memory_size_in_mb=`expr $memory_size_in_mb - 16384`
fi
off_heap_memory_size_in_mb=`expr $memory_size_in_mb - $on_heap_memory_size_in_mb`
ON_HEAP_MEMORY="${on_heap_memory_size_in_mb}M"
OFF_HEAP_MEMORY="${off_heap_memory_size_in_mb}M"
}
DATANODE_CONF_DIR="`dirname "$0"`"
# find first dir of dn_data_dirs from properties file
get_first_data_dir() {
local config_file="$1"
local data_dir_value=""
data_dir_value=`sed '/^dn_data_dirs=/!d;s/.*=//' ${DATANODE_CONF_DIR}/${config_file} | tail -n 1`
if [ -z "$data_dir_value" ]; then
echo ""
return 0
fi
local first_dir=""
if [[ "$data_dir_value" == *";"* ]]; then
first_dir=$(echo "$data_dir_value" | cut -d';' -f1)
fi
if [[ "$first_dir" == *","* ]]; then
first_dir=$(echo "$first_dir" | cut -d',' -f1)
fi
if [[ "$first_dir" == /* ]]; then
echo "$first_dir"
else
echo "$DATANODE_CONF_DIR/../$first_dir"
fi
}
if [ -f "${DATANODE_CONF_DIR}/iotdb-system.properties" ]; then
heap_dump_dir=$(get_first_data_dir "iotdb-system.properties")
else
heap_dump_dir=$(get_first_data_dir "iotdb-datanode.properties")
fi
if [ -z "$heap_dump_dir" ]; then
heap_dump_dir="$(dirname "$0")/../data/datanode/data"
fi
if [ ! -d "$heap_dump_dir" ]; then
mkdir -p "$heap_dump_dir"
fi
# find java in JAVA_HOME
if [ -n "$JAVA_HOME" ]; then
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
if [ -x "$java" ]; then
JAVA="$java"
break
fi
done
else
JAVA=java
fi
if [ -z $JAVA ] ; then
echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. > /dev/stderr
exit 1;
fi
# Determine the sort of JVM we'll be running on.
java_ver_output=`"$JAVA" -version 2>&1`
jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1`
JVM_VERSION=${jvmver%_*}
JVM_PATCH_VERSION=${jvmver#*_}
if [ "$JVM_VERSION" \< "1.8" ] ; then
echo "IoTDB requires Java 8u92 or later."
exit 1;
fi
if [ "$JVM_VERSION" \< "1.8" ] && [ "$JVM_PATCH_VERSION" -lt 92 ] ; then
echo "IoTDB requires Java 8u92 or later."
exit 1;
fi
version_arr=(${JVM_VERSION//./ })
illegal_access_params=""
#GC log path has to be defined here because it needs to access IOTDB_HOME
if [ "${version_arr[0]}" = "1" ] ; then
# Java 8
MAJOR_VERSION=${version_arr[1]}
echo "$IOTDB_JMX_OPTS" | grep -q "^-[X]loggc"
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
mkdir -p ${IOTDB_HOME}/logs
if [ "$#" -ge "1" -a "$1" == "printgc" ]; then
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xloggc:${IOTDB_HOME}/logs/gc.log -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M"
# For more detailed GC information, you can uncomment option below.
# NOTE: more detailed GC information may bring larger GC log files.
# IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xloggc:${IOTDB_HOME}/logs/gc.log -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+UseGCLogFileRotation -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+PrintReferenceGC -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1 -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
fi
fi
else
#JDK 11 and others
MAJOR_VERSION=${version_arr[0]}
# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax
# The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
echo "$IOTDB_JMX_OPTS" | grep -q "^-[X]log:gc"
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
mkdir -p ${IOTDB_HOME}/logs
if [ "$#" -ge "1" -a "$1" == "printgc" ]; then
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xlog:gc=info,heap*=info,age*=info,safepoint=info,promotion*=info:file=${IOTDB_HOME}/logs/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760"
# For more detailed GC information, you can uncomment option below.
# NOTE: more detailed GC information may bring larger GC log files.
# IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xlog:gc*=debug,heap*=debug,age*=trace,metaspace*=info,safepoint*=debug,promotion*=info:file=${IOTDB_HOME}/logs/gc.log:time,uptime,pid,tid,level,tags:filecount=10,filesize=100M"
fi
fi
# Add argLine for Java 11 and above, due to [JEP 396: Strongly Encapsulate JDK Internals by Default] (https://openjdk.java.net/jeps/396)
illegal_access_params="$illegal_access_params --add-opens=java.base/java.util.concurrent=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.lang=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.util=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.nio=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.io=ALL-UNNAMED"
illegal_access_params="$illegal_access_params --add-opens=java.base/java.net=ALL-UNNAMED"
fi
calculate_memory_sizes
# on heap memory size
#ON_HEAP_MEMORY="2G"
# off heap memory size
#OFF_HEAP_MEMORY="512M"
if [ "${OFF_HEAP_MEMORY%"G"}" != "$OFF_HEAP_MEMORY" ]
then
off_heap_memory_size_in_mb=`expr ${OFF_HEAP_MEMORY%"G"} "*" 1024`
else
off_heap_memory_size_in_mb=`expr ${OFF_HEAP_MEMORY%"M"}`
fi
# threads number for io
IO_THREADS_NUMBER="1000"
# Max cached buffer size, Note: unit can only be B!
# which equals OFF_HEAP_MEMORY / IO_THREADS_NUMBER
MAX_CACHED_BUFFER_SIZE=`expr $off_heap_memory_size_in_mb \* 1024 \* 1024 / $IO_THREADS_NUMBER`
#true or false
#DO NOT FORGET TO MODIFY THE PASSWORD FOR SECURITY (${IOTDB_CONF}/jmx.password and ${IOTDB_CONF}/jmx.access)
#If you want to connect JMX Service by network in local machine, such as nodeTool.sh will try to connect 127.0.0.1:31999, please set JMX_LOCAL to false.
JMX_LOCAL="true"
JMX_PORT="31999"
#only take effect when the jmx_local=false
#You need to change this IP as a public IP if you want to remotely connect IoTDB by JMX.
# 0.0.0.0 is not allowed
JMX_IP="127.0.0.1"
if [ ${JMX_LOCAL} = "false" ]; then
echo "setting remote JMX..."
#you may have no permission to run chmod. If so, contact your system administrator.
chmod 600 ${IOTDB_CONF}/jmx.password
chmod 600 ${IOTDB_CONF}/jmx.access
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Dcom.sun.management.jmxremote"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Djava.rmi.server.randomIDs=true"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Dcom.sun.management.jmxremote.ssl=false"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Dcom.sun.management.jmxremote.password.file=${IOTDB_CONF}/jmx.password"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Dcom.sun.management.jmxremote.access.file=${IOTDB_CONF}/jmx.access"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Djava.rmi.server.hostname=$JMX_IP"
else
echo "setting local JMX..."
fi
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Diotdb.jmx.local=$JMX_LOCAL"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xms${ON_HEAP_MEMORY}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xmx${ON_HEAP_MEMORY}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:MaxDirectMemorySize=${OFF_HEAP_MEMORY}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Djdk.nio.maxCachedBufferSize=${MAX_CACHED_BUFFER_SIZE}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+CrashOnOutOfMemoryError"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+UseAdaptiveSizePolicy"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xss512k"
# these two options print safepoints with pauses longer than 1000ms to the standard output. You can see these logs via redirection when starting in the background like "start-datanode.sh > log_datanode_safepoint.log"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:SafepointTimeoutDelay=1000"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+SafepointTimeout"
# option below tries to optimize safepoint stw time for large counted loop.
# NOTE: it may have an impact on JIT's black-box optimization.
# IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+UseCountedLoopSafepoints"
# when the GC time is too long, if there are remaining CPU resources, you can try to turn on and increase options below.
# for Linux:
# CPU_PROCESSOR_NUM=$(nproc)
# for MacOS:
# CPU_PROCESSOR_NUM=$(sysctl -n hw.ncpu)
# IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:ParallelGCThreads=${CPU_PROCESSOR_NUM}"
# if there are much of stw time of reference process in GC log, you can turn on option below.
# NOTE: it may have an impact on application's throughput.
# IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+ParallelRefProcEnabled"
# this option can reduce the overhead caused by memory allocation, page fault interrupts, etc. during JVM operation.
# NOTE: it may reduce memory utilization and trigger OOM killer when memory is tight.
# IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+AlwaysPreTouch"
# if you want to dump the heap memory while OOM happening, you can use the following command, remember to replace /tmp/heapdump.hprof with your own file path and the folder where this file is located needs to be created in advance
# IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${heap_dump_dir}/datanode_heapdump.hprof"
echo "DataNode on heap memory size = ${ON_HEAP_MEMORY}B, off heap memory size = ${OFF_HEAP_MEMORY}B"
echo "If you want to change this configuration, please check conf/datanode-env.sh."

View File

@@ -0,0 +1,33 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# This configuration file needs to be configured only when the start-all.sh,stop-all.sh, and destroy.sh scripts are required.
# You also need to modify this configuration file when the cluster nodes change
# Configure ConfigNodes machine addresses separated by ,
confignode_address_list=
# Configure DataNodes machine addresses separated by ,
datanode_address_list=
# User name for logging in to the deployment machine using ssh
ssh_account=root
# ssh login port
ssh_port=22
# iotdb deployment directory (iotdb should be deployed to the following folders in all machines)
confignode_deploy_path=
datanode_deploy_path=

View File

@@ -0,0 +1,72 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
####################
### Cluster Configuration
####################
cluster_name=defaultCluster
####################
### Seed ConfigNode
####################
cn_seed_config_node=127.0.0.1:10710
dn_seed_config_node=127.0.0.1:10710
####################
### Node RPC Configuration
####################
cn_internal_address=127.0.0.1
cn_internal_port=10710
cn_consensus_port=10720
dn_rpc_address=0.0.0.0
dn_rpc_port=6667
dn_internal_address=127.0.0.1
dn_internal_port=10730
dn_mpp_data_exchange_port=10740
dn_schema_region_consensus_port=10750
dn_data_region_consensus_port=10760
####################
### Replication configuration
####################
schema_replication_factor=1
data_replication_factor=1
####################
### Directory Configuration
####################
# dn_data_dirs=data/datanode/data
# dn_wal_dirs=data/datanode/wal
####################
### Metric Configuration
####################
# cn_metric_reporter_list=
cn_metric_prometheus_reporter_port=9091
# dn_metric_reporter_list=
dn_metric_prometheus_reporter_port=9092

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# see https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html#gdeup
iotdb readonly
root readwrite

View File

@@ -0,0 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# see https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html#gdeup
iotdb passw!d
root passw!d

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration scan="true" scanPeriod="60 seconds">
<appender class="ch.qos.logback.core.ConsoleAppender" name="stdout">
<Target>System.out</Target>
<encoder>
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="backup">
<Encoding>UTF-8</Encoding>
<file>${IOTDB_HOME}/logs/log_backup.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-backup-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<root level="all">
<appender-ref ref="stdout"/>
<appender-ref ref="backup"/>
</root>
</configuration>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration scan="true" scanPeriod="60 seconds">
<jmxConfigurator/>
<!-- prevent logback from outputting its own status at the start of every log -->
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEERROR">
<file>${CONFIGNODE_HOME}/logs/log_confignode_error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${CONFIGNODE_HOME}/logs/log-confignode-error-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEWARN">
<file>${CONFIGNODE_HOME}/logs/log_confignode_warn.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${CONFIGNODE_HOME}/logs/log-confignode-warn-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>WARN</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEDEBUG">
<file>${CONFIGNODE_HOME}/logs/log_confignode_debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${CONFIGNODE_HOME}/logs/log-confignode-debug-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender class="ch.qos.logback.core.ConsoleAppender" name="stdout">
<Target>System.out</Target>
<encoder>
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>${CONSOLE_LOG_LEVEL:-DEBUG}</level>
</filter>
</appender>
<!-- a log appender that collect all log records whose level is greater than debug-->
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEALL">
<file>${CONFIGNODE_HOME}/logs/log_confignode_all.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${CONFIGNODE_HOME}/logs/log-confignode-all-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<root level="info">
<appender-ref ref="FILEDEBUG"/>
<appender-ref ref="FILEWARN"/>
<appender-ref ref="FILEERROR"/>
<appender-ref ref="FILEALL"/>
<appender-ref ref="stdout"/>
</root>
<logger level="info" name="org.apache.iotdb.confignode"/>
<logger level="info" name="org.apache.ratis"/>
</configuration>

View File

@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration scan="true" scanPeriod="60 seconds">
<jmxConfigurator/>
<!-- prevent logback from outputting its own status at the start of every log -->
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEERROR">
<file>${IOTDB_HOME}/logs/log_datanode_error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-error-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEWARN">
<file>${IOTDB_HOME}/logs/log_datanode_warn.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-warn-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>WARN</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEDEBUG">
<file>${IOTDB_HOME}/logs/log_datanode_debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-debug-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILETRACE">
<file>${IOTDB_HOME}/logs/log_datanode_trace.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-trace-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>TRACE</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender class="ch.qos.logback.core.ConsoleAppender" name="stdout">
<Target>System.out</Target>
<encoder>
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>${CONSOLE_LOG_LEVEL:-DEBUG}</level>
</filter>
</appender>
<!-- a log appender that collect all log records whose level is greater than debug-->
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILEALL">
<file>${IOTDB_HOME}/logs/log_datanode_all.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-all-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILE_COST_MEASURE">
<file>${IOTDB_HOME}/logs/log_datanode_measure.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-measure-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="AUDIT">
<file>${IOTDB_HOME}/logs/log_datanode_audit.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-audit-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="QUERY_DEBUG">
<file>${IOTDB_HOME}/logs/log_datanode_query_debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-query-debug-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="SLOW_SQL">
<file>${IOTDB_HOME}/logs/log_datanode_slow_sql.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-slow-sql-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="COMPACTION">
<file>${IOTDB_HOME}/logs/log_datanode_compaction.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-compaction-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="PIPE">
<file>${IOTDB_HOME}/logs/log_datanode_pipe.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-pipe-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EXPLAIN_ANALYZE">
<file>${IOTDB_HOME}/logs/log_explain_analyze.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${IOTDB_HOME}/logs/log-datanode-explain-%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<root level="info">
<appender-ref ref="FILETRACE"/>
<appender-ref ref="FILEDEBUG"/>
<appender-ref ref="FILEWARN"/>
<appender-ref ref="FILEERROR"/>
<appender-ref ref="FILEALL"/>
<appender-ref ref="stdout"/>
</root>
<logger level="OFF" name="io.moquette.broker.metrics.MQTTMessageLogger"/>
<logger level="info" name="org.apache.iotdb.db.service"/>
<logger level="info" name="org.apache.iotdb.db.conf"/>
<logger level="info" name="org.apache.iotdb.db.cost.statistic">
<appender-ref ref="FILE_COST_MEASURE"/>
</logger>
<logger level="info" name="IoTDB_AUDIT_LOGGER">
<appender-ref ref="AUDIT"/>
</logger>
<logger level="info" name="QUERY_DEBUG">
<appender-ref ref="QUERY_DEBUG"/>
</logger>
<logger level="info" name="SLOW_SQL">
<appender-ref ref="SLOW_SQL"/>
</logger>
<logger level="info" name="QUERY_FREQUENCY">
<appender-ref ref="QUERY_FREQUENCY"/>
</logger>
<logger level="info" name="DETAILED_FAILURE_QUERY_TRACE"/>
<logger level="info" name="COMPACTION">
<appender-ref ref="COMPACTION"/>
</logger>
<logger level="info" name="org.apache.iotdb.pipe.api">
<appender-ref ref="PIPE"/>
</logger>
<logger level="info" name="org.apache.iotdb.db.pipe">
<appender-ref ref="PIPE"/>
</logger>
<logger level="info" name="org.apache.iotdb.commons.pipe">
<appender-ref ref="PIPE"/>
</logger>
<logger level="info" name="EXPLAIN_ANALYZE">
<appender-ref ref="EXPLAIN_ANALYZE"/>
</logger>
</configuration>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration scan="true" scanPeriod="60 seconds">
<appender class="ch.qos.logback.core.ConsoleAppender" name="stdout">
<Target>System.out</Target>
<encoder>
<pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<root level="error">
<appender-ref ref="stdout"/>
</root>
</configuration>

View File

@@ -0,0 +1,67 @@
# This is a automacically generated configuration file for Explorer in [TOML](https://toml.io/) format.
#
# Here is a full list of available options.
# Explorer server port to listen on.
# Default is 6060.
#
port = 6060
# IPv4 listen address.
# Default is 0.0.0.0
addr = "0.0.0.0"
# IPv6 listen address.
# ipv6 = "::1"
# Explorer server log level.
# Default is "info"
#
log_level = "info"
# REST API endpoint to connect to the cluster.
# This configuration is also the target for data migration tasks.
#
# Default is "http://buildkitsandbox:6041" - the default endpoint for REST API.
#
cluster = "http://fastbee:6041"
# native endpoint to connect to the cluster.
# Default is disabled. To enable it, set it to the native API URL like "taos://buildkitsandbox:6030" and uncomment it.
# If you enable it, you will get more performance for data migration tasks.
#
# cluster_native = "taos://buildkitsandbox:6030"
# API endpoint for data replication/backup/data sources. No default option.
# Set it to API URL like "http://buildkitsandbox:6050".
#
x_api ="http://fastbee:6050"
# GRPC endpoint for "Agent"s.
# Default is "http://buildkitsandbox:6055" - the default endpoint for taosX grpc API.
# You should set it to public IP or FQDN name like:
# "http://192.168.111.111:6055" or "http://node1.company.domain:6055" and
# ensure to add the port to the exception list of the firewall if it enabled.
grpc = "http://fastbee:6055"
# CORS configuration switch, it allows cross-origin access
cors = true
# cloud open api.
# cloud_open_api = "https://pre.ali.cloud.taosdata.com/openapi"
# Enable ssl
# If the following two files exist, enable ssl protocol
#
[ssl]
# SSL certificate
#
# certificate = "/path/to/ca.file" # on linux/macOS
# certificate = "C:\\path\\to\\ca.file" # on windows
# SSL certificate key
#
# certificate_key = "/path/to/key.file" # on linux/macOS
# certificate_key = "C:\\path\\to\\key.file" # on windows

View File

@@ -0,0 +1,193 @@
########################################################
# #
# Configuration #
# #
########################################################
######### 0. Client only configurations #############
# The interval for CLI to send heartbeat to mnode
# shellActivityTimer 3
############### 1. Cluster End point ############################
# The end point of the first dnode in the cluster to be connected to when this dnode or the CLI utility is started
# firstEp hostname:6030
# The end point of the second dnode to be connected to if the firstEp is not available
# secondEp
############### 2. Configuration Parameters of current dnode #####
# The FQDN of the host on which this dnode will be started. It can be IP address
fqdn fastbee
# The port for external access after this dnode is started
# serverPort 6030
# The maximum number of connections a dnode can accept
# maxShellConns 5000
# The directory for writing log files, if you are using Windows platform please change to Windows path
# logDir /var/log/taos
# All data files are stored in this directory, if you are using Windows platform please change to Windows path
# dataDir /var/lib/taos
# temporary file's directory, if you are using Windows platform please change to Windows path
# tempDir /tmp/
# Switch for allowing to collect and report service usage information
# telemetryReporting 1
# Switch for allowing to collect and report crash information
# crashReporting 1
# The maximum number of vnodes supported by this dnode
# supportVnodes 0
# The interval of this dnode reporting status to mnode, [1..10] seconds
# statusInterval 1
# The minimum sliding window time, milli-second
# minSlidingTime 10
# The minimum time window, milli-second
# minIntervalTime 10
# The maximum allowed query buffer size in MB during query processing for each data node
# -1 no limit (default)
# 0 no query allowed, queries are disabled
# queryBufferSize -1
# The compressed rpc message, option:
# -1 (no compression)
# 0 (all message compressed),
# > 0 (rpc message body which larger than this value will be compressed)
# compressMsgSize -1
# query retrieved column data compression option:
# -1 (no compression)
# 0 (all retrieved column data compressed),
# > 0 (any retrieved column size greater than this value all data will be compressed.)
# compressColData -1
# system time zone
# timezone UTC-8
# system time zone (for windows 10)
# timezone Asia/Shanghai (CST, +0800)
# system locale
# locale en_US.UTF-8
# system charset
# charset UTF-8
# stop writing logs when the disk size of the log folder is less than this value
# minimalLogDirGB 1.0
# stop writing temporary files when the disk size of the tmp folder is less than this value
# minimalTmpDirGB 1.0
# if free disk space is less than this value, this dnode will fail to start
# minimalDataDirGB 2.0
# enable/disable system monitor
# monitor 1
# enable/disable audit log
# audit 1
# enable/disable audit create table
# auditCreateTable 1
# The following parameter is used to limit the maximum number of lines in log files.
# max number of lines per log filters
# numOfLogLines 10000000
# write log in async way: 1 - async, 0 - sync
# asyncLog 1
# time period of keeping log files, in days
# logKeepDays 0
############ 3. Debug Flag and levels #############################################
# The following parameters are used for debug purpose only by this dnode.
# debugFlag is a 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
# Available debug levels are:
# 131: output warning and error
# 135: output debug, warning and error
# 143: output trace, debug, warning and error to log
# 199: output debug, warning and error to both screen and file
# 207: output trace, debug, warning and error to both screen and file
# debug flag for all log type, take effect when non-zero value
# debugFlag 0
# debug flag for timer
# tmrDebugFlag 131
# debug flag for util
# uDebugFlag 131
# debug flag for rpc
# rpcDebugFlag 131
# debug flag for jni
# jniDebugFlag 131
# debug flag for query
# qDebugFlag 131
# debug flag for client driver
# cDebugFlag 131
# debug flag for dnode messages
# dDebugFlag 135
# debug flag for vnode
# vDebugFlag 131
# debug flag for meta management messages
# mDebugFlag 135
# debug flag for wal
# wDebugFlag 135
# debug flag for sync module
# sDebugFlag 135
# debug flag for tsdb
# tsdbDebugFlag 131
# debug flag for tq
# tqDebugFlag 131
# debug flag for fs
# fsDebugFlag 131
# debug flag for udf
# udfDebugFlag 131
# debug flag for sma
# smaDebugFlag 131
# debug flag for index
# idxDebugFlag 131
# debug flag for tdb
# tdbDebugFlag 131
# debug flag for meta
# metaDebugFlag 131
# generate core file when service crash
# enableCoreFile 1
monitor 1
monitorFQDN fastbee
audit 1

View File

@@ -0,0 +1,110 @@
debug = true
taosConfigDir = ""
port = 6041
logLevel = "info"
httpCodeServerError = false
SMLAutoCreateDB = false
[cors]
allowAllOrigins = true
#[pool]
#maxConnect = 0
#maxIdle = 0
#idleTimeout = 0
[ssl]
enable = false
certFile = ""
keyFile = ""
[log]
#path = "/var/log/taos"
rotationCount = 30
rotationTime = "24h"
rotationSize = "1GB"
enableRecordHttpSql = false
sqlRotationCount = 2
sqlRotationTime = "24h"
sqlRotationSize = "1GB"
[monitor]
disable = true
collectDuration = "3s"
incgroup = false
pauseQueryMemoryThreshold = 70
pauseAllMemoryThreshold = 80
identity = ""
[uploadKeeper]
enable = true
url = "http://127.0.0.1:6043/adapter_report"
interval = "15s"
timeout = "5s"
retryTimes = 3
retryInterval = "5s"
[opentsdb]
enable = true
[influxdb]
enable = true
[statsd]
enable = false
port = 6044
db = "statsd"
user = "root"
password = "taosdata"
worker = 10
gatherInterval = "5s"
protocol = "udp4"
maxTCPConnections = 250
tcpKeepAlive = false
allowPendingMessages = 50000
deleteCounters = true
deleteGauges = true
deleteSets = true
deleteTimings = true
[collectd]
enable = false
port = 6045
db = "collectd"
user = "root"
password = "taosdata"
worker = 10
[opentsdb_telnet]
enable = false
maxTCPConnections = 250
tcpKeepAlive = false
dbs = ["opentsdb_telnet", "collectd", "icinga2", "tcollector"]
ports = [6046, 6047, 6048, 6049]
user = "root"
password = "taosdata"
batchSize = 1
flushInterval = "0s"
[node_exporter]
enable = false
db = "node_exporter"
user = "root"
password = "taosdata"
urls = ["http://fastbee:9100"]
responseTimeout = "5s"
httpUsername = ""
httpPassword = ""
httpBearerTokenString = ""
caCertFile = ""
certFile = ""
keyFile = ""
insecureSkipVerify = true
gatherDuration = "5s"
[prometheus]
enable = true
[tmq]
releaseIntervalMultiplierForAutocommit = 2

View File

@@ -0,0 +1,48 @@
# Start with debug middleware for gin
debug = false
# Listen port, default is 6043
port = 6043
# log level
loglevel = "info"
# go pool size
gopoolsize = 50000
# interval for metrics
RotationInterval = "15s"
[tdengine]
host = "fastbee"
port = 6041
username = "root"
password = "taosdata"
usessl = false
[metrics]
# metrics prefix in metrics names.
prefix = "taos"
# export some tables that are not super table
tables = []
# database for storing metrics data
[metrics.database]
name = "log"
# database options for db storing metrics data
[metrics.database.options]
vgroups = 1
buffer = 64
KEEP = 90
cachemodel = "both"
[environment]
# Whether running in cgroup.
incgroup = false
[log]
#path = "/var/log/taos"
rotationCount = 5
rotationTime = "24h"
rotationSize = 100000000

Binary file not shown.

Binary file not shown.

View File