If Kerberos security has been enabled on the cluster, use the following
commands to save the namespace:
sudo su -l [HDFS_USER] -c 'kinit -kt
/etc/security/keytabs/nn.service.keytab nn/[HOSTNAME]@[REALM];hdfs dfsadmin
-safemode enter' sudo su -l [HDFS_USER] -c 'kinit -kt
/etc/security/keytabs/nn.service.keytab nn/[HOSTNAME]@[REALM];hdfs dfsadmin
-saveNamespace'
In this example, [HDFS_USER] is the HDFS service user (for
example, hdfs), [HOSTNAME] is the Active NameNode hostname,
and [REALM] is your Kerberos realm.