Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker/src/main/DockerCompose/docker-compose-host-3c3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
- schema_replication_factor=3
- schema_region_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
- config_node_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
- CONFIGNODE_JMX_OPTS=-Xms1G -Xmx1G -XX:MaxDirectMemorySize=256M
volumes:
- /etc/hosts:/etc/hosts:ro
- ./data/confignode:/iotdb/data
Expand All @@ -48,6 +49,7 @@ services:
- dn_data_region_consensus_port=10760
- data_replication_factor=3
- data_region_consensus_protocol_class=org.apache.iotdb.consensus.iot.IoTConsensus
- IOTDB_JMX_OPTS=-Xms4G -Xmx4G -XX:MaxDirectMemorySize=1G
volumes:
- /etc/hosts:/etc/hosts:ro
- ./data/datanode:/iotdb/data/
Expand Down
4 changes: 3 additions & 1 deletion docker/src/main/DockerCompose/docker-compose-standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ services:
- dn_schema_region_consensus_port=10750
- dn_data_region_consensus_port=10760
- dn_seed_config_node=iotdb-service:10710
volumes:
- IOTDB_JMX_OPTS=-Xms4G -Xmx4G -XX:MaxDirectMemorySize=1G
- CONFIGNODE_JMX_OPTS=-Xms1G -Xmx1G -XX:MaxDirectMemorySize=256M
volumes:
- ./data:/iotdb/data
- ./logs:/iotdb/logs
networks:
Expand Down
11 changes: 6 additions & 5 deletions docker/src/main/DockerCompose/replace-conf-from-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@ function process_single(){
if [[ "${content:0:1}" != "#" ]]; then
sed -i "${line_no}d" ${filename}
fi
sed -i "${line_no} i${key_value}" ${filename}
sed -i "${line_no}a${key_value}" ${filename}
else
echo "append $key $filename"
line_no=$(wc -l $filename)
sed -i "${line_no} a${key_value}" ${filename}
echo "append $key $filename"
line_no=$(wc -l $filename|cut -d ' ' -f1)
sed -i "${line_no}a${key_value}" ${filename}
fi
}

function replace_configs(){
for v in $(env); do
if [[ "${v}" =~ "=" && "${v}" =~ "_" && ! "${v}" =~ "JAVA_" ]]; then
key_name="${v%%=*}"
if [[ "${key_name}" == "${key_name,,}" && ! 2w$key_name =~ ^_ ]]; then
# echo "###### $v ####"
for f in ${target_files}; do
process_single $v ${conf_path}/$f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

# You can set ConfigNode memory size, example '2G' or '2048M'
MEMORY_SIZE=
# on heap memory size
#ON_HEAP_MEMORY="2G"
# off heap memory size
#OFF_HEAP_MEMORY="512M"

# You can put your env variable here
# export JAVA_HOME=$JAVA_HOME
Expand Down Expand Up @@ -250,12 +254,23 @@ else
fi


calculate_memory_sizes
if [[ "$CONFIGNODE_JMX_OPTS" =~ -Xms ]];then
item_arr=(${CONFIGNODE_JMX_OPTS})
for item in ${item_arr[@]};do
if [[ -n "$item" ]]; then
if [[ "$item" =~ -Xmx ]]; then
ON_HEAP_MEMORY=${item#*mx}
elif [[ "$item" =~ -XX:MaxDirectMemorySize= ]]; then
OFF_HEAP_MEMORY=${item#*=}
fi
fi
done
elif [[ -n "$ON_HEAP_MEMORY" ]]; then
echo "ON_HEAP_MEMORY=$ON_HEAP_MEMORY"
else
calculate_memory_sizes
fi

# 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
Expand Down Expand Up @@ -300,9 +315,9 @@ else
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}"
if [[ ! "$CONFIGNODE_JMX_OPTS" =~ -Xms ]]; then CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xms${ON_HEAP_MEMORY}"; fi
if [[ ! "$CONFIGNODE_JMX_OPTS" =~ -Xmx ]]; then CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xmx${ON_HEAP_MEMORY}"; fi
if [[ ! "$CONFIGNODE_JMX_OPTS" =~ -XX:MaxDirectMemorySize ]]; then CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -XX:MaxDirectMemorySize=${OFF_HEAP_MEMORY}"; fi
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 ${heap_dump_dir}/confignode_heapdump.hprof with your own file path and the folder where this file is located needs to be created in advance
Expand Down
35 changes: 25 additions & 10 deletions iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@

# You can set DataNode memory size, example '2G' or '2048M'
MEMORY_SIZE=
# on heap memory size
#ON_HEAP_MEMORY="2G"
# off heap memory size
#OFF_HEAP_MEMORY="512M"


# You can put your env variable here
# export JAVA_HOME=$JAVA_HOME
Expand Down Expand Up @@ -261,12 +266,22 @@ else
fi


calculate_memory_sizes

# on heap memory size
#ON_HEAP_MEMORY="2G"
# off heap memory size
#OFF_HEAP_MEMORY="512M"
if [[ "$IOTDB_JMX_OPTS" =~ -Xms ]];then
item_arr=(${IOTDB_JMX_OPTS})
for item in ${item_arr[@]};do
if [[ -n "$item" ]]; then
if [[ "$item" =~ -Xmx ]]; then
ON_HEAP_MEMORY=${item#*mx}
elif [[ "$item" =~ -XX:MaxDirectMemorySize= ]]; then
OFF_HEAP_MEMORY=${item#*=}
fi
fi
done
elif [[ -n "$ON_HEAP_MEMORY" ]]; then
echo "ON_HEAP_MEMORY=$ON_HEAP_MEMORY"
else
calculate_memory_sizes
fi


if [ "${OFF_HEAP_MEMORY%"G"}" != "$OFF_HEAP_MEMORY" ]
Expand Down Expand Up @@ -311,10 +326,11 @@ 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}"
if [[ ! "$CONFIGNODE_JMX_OPTS" =~ -Xms ]]; then IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xms${ON_HEAP_MEMORY}"; fi
if [[ ! "$CONFIGNODE_JMX_OPTS" =~ -Xmx ]]; then IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xmx${ON_HEAP_MEMORY}"; fi
if [[ ! "$CONFIGNODE_JMX_OPTS" =~ -XX:MaxDirectMemorySize= ]]; then IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:MaxDirectMemorySize=${OFF_HEAP_MEMORY}"; fi
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"
Expand Down Expand Up @@ -345,7 +361,6 @@ IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+SafepointTimeout"
# if you want to dump the heap memory while OOM happening, you can use the following command, remember to replace ${heap_dump_dir}/datanode_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."

Loading