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
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,16 @@ public final class ScmConfigKeys {
// able to send back a new list to the datanodes.
public static final String OZONE_SCM_NAMES = "ozone.scm.names";

public static final String OZONE_SCM_INTERNAL_SERVICE_ID =
"ozone.scm.internal.service.id";

public static final String OZONE_SCM_SERVICE_IDS_KEY =
"ozone.scm.service.ids";
public static final String OZONE_SCM_NODES_KEY =
"ozone.scm.nodes";
public static final String OZONE_SCM_NODE_ID_KEY =
"ozone.scm.node.id";

public static final int OZONE_SCM_DEFAULT_PORT =
OZONE_SCM_DATANODE_PORT_DEFAULT;
// The path where datanode ID is to be written to.
Expand Down Expand Up @@ -363,6 +373,83 @@ public final class ScmConfigKeys {
public static final String HDDS_TRACING_ENABLED = "hdds.tracing.enabled";
public static final boolean HDDS_TRACING_ENABLED_DEFAULT = true;

// SCM Ratis related
public static final String OZONE_SCM_HA_ENABLE_KEY
= "ozone.scm.ratis.enable";
public static final boolean OZONE_SCM_HA_ENABLE_DEFAULT
= false;
public static final String OZONE_SCM_RATIS_PORT_KEY
= "ozone.scm.ratis.port";
public static final int OZONE_SCM_RATIS_PORT_DEFAULT
= 9864;
public static final String OZONE_SCM_RATIS_RPC_TYPE_KEY
= "ozone.scm.ratis.rpc.type";
public static final String OZONE_SCM_RATIS_RPC_TYPE_DEFAULT
= "GRPC";

// SCM Ratis Log configurations
public static final String OZONE_SCM_RATIS_STORAGE_DIR
= "ozone.scm.ratis.storage.dir";
public static final String OZONE_SCM_RATIS_SEGMENT_SIZE_KEY
= "ozone.scm.ratis.segment.size";
public static final String OZONE_SCM_RATIS_SEGMENT_SIZE_DEFAULT
= "16KB";
public static final String OZONE_SCM_RATIS_SEGMENT_PREALLOCATED_SIZE_KEY
= "ozone.scm.ratis.segment.preallocated.size";
public static final String OZONE_SCM_RATIS_SEGMENT_PREALLOCATED_SIZE_DEFAULT
= "16KB";

// SCM Ratis Log Appender configurations
public static final String
OZONE_SCM_RATIS_LOG_APPENDER_QUEUE_NUM_ELEMENTS =
"ozone.scm.ratis.log.appender.queue.num-elements";
public static final int
OZONE_SCM_RATIS_LOG_APPENDER_QUEUE_NUM_ELEMENTS_DEFAULT = 1024;
public static final String OZONE_SCM_RATIS_LOG_APPENDER_QUEUE_BYTE_LIMIT =
"ozone.scm.ratis.log.appender.queue.byte-limit";
public static final String
OZONE_SCM_RATIS_LOG_APPENDER_QUEUE_BYTE_LIMIT_DEFAULT = "32MB";
public static final String OZONE_SCM_RATIS_LOG_PURGE_GAP =
"ozone.scm.ratis.log.purge.gap";
public static final int OZONE_SCM_RATIS_LOG_PURGE_GAP_DEFAULT = 1000000;

// SCM Ratis server configurations
public static final String OZONE_SCM_RATIS_SERVER_REQUEST_TIMEOUT_KEY
= "ozone.scm.ratis.server.request.timeout";
public static final TimeDuration
OZONE_SCM_RATIS_SERVER_REQUEST_TIMEOUT_DEFAULT
= TimeDuration.valueOf(3000, TimeUnit.MILLISECONDS);
public static final String
OZONE_SCM_RATIS_SERVER_RETRY_CACHE_TIMEOUT_KEY
= "ozone.scm.ratis.server.retry.cache.timeout";
public static final TimeDuration
OZONE_SCM_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DEFAULT
= TimeDuration.valueOf(600000, TimeUnit.MILLISECONDS);
public static final String OZONE_SCM_RATIS_MINIMUM_TIMEOUT_KEY
= "ozone.scm.ratis.minimum.timeout";
public static final TimeDuration OZONE_SCM_RATIS_MINIMUM_TIMEOUT_DEFAULT
= TimeDuration.valueOf(1, TimeUnit.SECONDS);

// SCM Ratis Leader Election configurations
public static final String
OZONE_SCM_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY =
"ozone.scm.leader.election.minimum.timeout.duration";
public static final TimeDuration
OZONE_SCM_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_DEFAULT =
TimeDuration.valueOf(1, TimeUnit.SECONDS);
public static final String OZONE_SCM_RATIS_SERVER_FAILURE_TIMEOUT_DURATION_KEY
= "ozone.scm.ratis.server.failure.timeout.duration";
public static final TimeDuration
OZONE_SCM_RATIS_SERVER_FAILURE_TIMEOUT_DURATION_DEFAULT
= TimeDuration.valueOf(120, TimeUnit.SECONDS);

// SCM Leader server role check interval
public static final String OZONE_SCM_RATIS_SERVER_ROLE_CHECK_INTERVAL_KEY
= "ozone.scm.ratis.server.role.check.interval";
public static final TimeDuration
OZONE_SCM_RATIS_SERVER_ROLE_CHECK_INTERVAL_DEFAULT
= TimeDuration.valueOf(15, TimeUnit.SECONDS);

/**
* Never constructed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,6 @@ private OzoneConsts() {
public static final String GDPR_SECRET = "secret";
public static final String GDPR_ALGORITHM = "algorithm";


// SCM HA
public static final String SCM_SERVICE_ID_DEFAULT = "scmServiceIdDefault";
}
180 changes: 180 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1879,6 +1879,186 @@
<tag>OZONE, HDDS, SECURITY</tag>
<description>SCM security server port.</description>
</property>
<property>
<name>ozone.scm.service.ids</name>
<value></value>
<tag>OZONE, SCM, HA</tag>
<description>
Comma-separated list of SCM service Ids. This property allows the client
to figure out quorum of OzoneManager address.
</description>
</property>
<property>
<name>ozone.scm.internal.service.id</name>
<value></value>
<tag>OZONE, SCM, HA</tag>
<description>
Service ID of the SCM. If this is not set fall back to
ozone.scm.service.ids to find the service ID it belongs to.
</description>
</property>
<property>
<name>ozone.scm.nodes.EXAMPLESCMSERVICEID</name>
<value></value>
<tag>OZONE, SCM, HA</tag>
<description>
Comma-separated list of SCM node Ids for a given SCM service ID (eg.
EXAMPLESCMSERVICEID). The SCM service ID should be the value (one of the
values if there are multiple) set for the parameter ozone.scm.service.ids.

Unique identifiers for each SCM Node, delimited by commas. This will be
used by SCMs in HA setup to determine all the SCMs
belonging to the same SCM in the cluster. For example, if you
used “scmService1” as the SCM service ID previously, and you wanted to
use “scm1”, “scm2” and "scm3" as the individual IDs of the SCMs,
you would configure a property ozone.scm.nodes.scmService1, and its value
"scm1,scm2,scm3".
</description>
</property>
<property>
<name>ozone.scm.node.id</name>
<value></value>
<tag>OZONE, SCM, HA</tag>
<description>
The ID of this SCM node. If the SCM node ID is not configured it
is determined automatically by matching the local node's address
with the configured address.

If node ID is not deterministic from the configuration, then it is set
to the scmId from the SCM version file.
</description>
</property>
<property>
<name>ozone.scm.ratis.enable</name>
<value>false</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>Property to enable or disable Ratis server on SCM.
Please note - this is a temporary property to disable SCM Ratis server.
</description>
</property>

<property>
<name>ozone.scm.ratis.port</name>
<value>9872</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>
The port number of the SCM's Ratis server.
</description>
</property>

<property>
<name>ozone.scm.ratis.rpc.type</name>
<value>GRPC</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>Ratis supports different kinds of transports like netty, GRPC,
Hadoop RPC etc. This picks one of those for this cluster.
</description>
</property>

<property>
<name>ozone.scm.ratis.storage.dir</name>
<value/>
<tag>OZONE, SCM, HA, RATIS, STORAGE</tag>
<description>This directory is used for storing SCM's Ratis metadata like
logs. If this is not set then default metadata dirs is used. A warning
will be logged if this not set. Ideally, this should be mapped to a
fast disk like an SSD.
If undefined, SCM ratis storage dir will fallback to ozone.metadata.dirs.
This fallback approach is not recommended for production environments.
</description>
</property>

<property>
<name>ozone.scm.ratis.segment.size</name>
<value>16KB</value>
<tag>OZONE, SCM, HA, RATIS, PERFORMANCE</tag>
<description>The size of the raft segment used by Apache Ratis on SCM.
(16 KB by default)
</description>
</property>

<property>
<name>ozone.scm.ratis.segment.preallocated.size</name>
<value>16KB</value>
<tag>OZONE, SCM, HA, RATIS, PERFORMANCE</tag>
<description>The size of the buffer which is preallocated for raft segment
used by Apache Ratis on SCM.(16 KB by default)
</description>
</property>

<property>
<name>ozone.scm.ratis.log.appender.queue.num-elements</name>
<value>1024</value>
<tag>OZONE, DEBUG, SCM, HA, RATIS</tag>
<description>Number of operation pending with Raft's Log Worker.
</description>
</property>
<property>
<name>ozone.scm.ratis.log.appender.queue.byte-limit</name>
<value>32MB</value>
<tag>OZONE, DEBUG, SCM, HA, RATIS</tag>
<description>Byte limit for Raft's Log Worker queue.
</description>
</property>
<property>
<name>ozone.scm.ratis.log.purge.gap</name>
<value>1000000</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The minimum gap between log indices for Raft server to purge
its log segments after taking snapshot.
</description>
</property>
<property>
<name>ozone.scm.ratis.server.request.timeout</name>
<value>3s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The timeout duration for SCM's ratis server request .</description>
</property>

<property>
<name>ozone.scm.ratis.server.retry.cache.timeout</name>
<value>600000ms</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>Retry Cache entry timeout for SCM's ratis server.</description>
</property>

<property>
<name>ozone.scm.ratis.minimum.timeout</name>
<value>1s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The minimum timeout duration for SCM's Ratis server rpc.
</description>
</property>

<property>
<name>ozone.scm.leader.election.minimum.timeout.duration</name>
<value>1s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The minimum timeout duration for SCM ratis leader election.
Default is 1s.
</description>
</property>

<property>
<name>ozone.scm.ratis.server.failure.timeout.duration</name>
<value>120s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The timeout duration for ratis server failure detection,
once the threshold has reached, the ratis state machine will be informed
about the failure in the ratis ring.
</description>
</property>

<property>
<name>ozone.scm.ratis.server.role.check.interval</name>
<value>15s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The interval between SCM leader performing a role
check on its ratis server. Ratis server informs SCM if it
loses the leader role. The scheduled check is an secondary
check to ensure that the leader role is updated periodically
.</description>
</property>

<property>
<name>hdds.metadata.dir</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.
*/

package org.apache.hadoop.hdds.scm.ha;

import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;

/**
* Utility class used by SCM HA.
*/
public final class SCMHAUtils {
private SCMHAUtils() {
// not used
}

// Check if SCM HA is enabled.
public static boolean isSCMHAEnabled(OzoneConfiguration conf) {
return conf.getBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
ScmConfigKeys.OZONE_SCM_HA_ENABLE_DEFAULT);
}
}
Loading