HDFS start the process overview and security cluster mode operation

1. Start the process overview

When Namenode starts, the first image file (fsimage) loaded into memory, and perform various operations Edit Log (edits) in. Once successfully established file system metadata in memory image, you create a new document and an empty fsimage edit log. At this point, namenode start listening datanode request. But at the moment, namenode run in safe mode, that namenode file system for the client is read-only.

The system is not determined by the position of the data block namenode maintained, but in the form of a list of memory blocks in the datanode. During normal operation of the system, namenode retains the mapping information for all block positions in memory. In safe mode, all datanode will send the latest information to the block list namenode, after namenode learned enough block location information, to the efficient operation of the file system.

If the "smallest copy of the conditions" to meet, namenode will exit safe mode after 30 seconds. So-called minimum condition refers to the copy of the entire file system block satisfies a minimum of 99.9% of copy level (default value: dfs.replication.min = 1). Just when you start a formatted HDFS clusters, because the system does not have any block, so namenode not enter safe mode.

2. The basic syntax

Cluster in secure mode, can not perform critical operations (write operation). After the cluster startup is complete, the automatic exit safe mode.

(1) bin / hdfs dfsadmin -safemode get (Function Description: View Secure Mode)

(2) bin / hdfs dfsadmin -safemode enter (Function Description: enter the safe state mode)

(3) bin / hdfs dfsadmin -safemode leave (Function Description: disengage security state)

(4) bin / hdfs dfsadmin -safemode wait (Function Description: Wait Secure Mode)

3. Case

       Analog wait Safe Mode

       1) first into safe mode

bin/hdfs dfsadmin -safemode enter

       2) execute the following script

Edit a script

#!/bin/bash
bin/hdfs dfsadmin -safemode wait
bin/hdfs dfs -put ~/hello.txt /root/hello.txt

3) then open a window, execute

bin/hdfs dfsadmin -safemode leave

Guess you like

Origin www.cnblogs.com/MWCloud/p/11237056.html