Configuring the HDFS Read-Only Mode
Scenario
You can enable the read-only mode for HDFS directories. After the read-only mode is enabled, the configured directories can only be read but cannot be written. Enabling the read-only mode during HDFS inventory data migration can greatly improve migration efficiency and prevent migration failures caused by write operations.
Notes and Constraints
- This function applies to MRS 3.6.0 or later only.
- The read-only mode needs to be enabled again after NameNode is restarted.
- After using the read-only mode, exit the read-only mode immediately to prevent impact on services.
Prerequisites
Procedure
- Log in to the node where the client is installed as the client installation user.
- Go to the client installation directory.
cd /opt/client
- Configure environment variables.
source bigdata_env
- Authenticate the user if the cluster is in security mode. Skip this step for a cluster in normal mode.
kinit Component service user
- Enable the read-only mode.
hdfs dfsadmin -readonly enable
- Table 1 describes the parameters in the read-only mode command.
- If the read-only mode is enabled for only one NameService, add the -fs parameter before the command. In the federation scenario, the -fs parameter is mandatory. For example:
hdfs dfsadmin -fs hdfs://hacluster -readonly enable
- Log in to Manager, choose Cluster > Services > HDFS, click Configurations, and click All Configurations. On the displayed page, search for and set the following parameters as required.
Table 2 Parameters related to the read-only mode Parameter
Description
Default Value
hdfs.readonly-mode.directory.list
Directories for which the read-only mode is enabled.
- The configured directory can only be read and cannot be written.
- Use commas (,) to separate multiple directories.
- This parameter value does not support regular expressions.
-
hdfs.readonly-mode.white.list.user
Users who are not restricted by the read-only mode after the read-only mode is enabled.
- Use commas (,) to separate multiple users.
- This parameter value does not support regular expressions.
-
- Save the configuration. You do not need to restart the service or instance.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot