DearĀ Gaurav,

Hope you are doing well.

Please use below command

su - hdfs -c "/usr/hdp/current/hadoop-client/sbin/ start namenode"
su - hdfs -c "/usr/hdp/current/hadoop-client/sbin/ start datanode"

Verify that the DataNode process is up and running:

ps -ef|grep DataNode

Verify that NameNode can go out of safe mode.

su - hdfs -c "hdfs dfsadmin -safemode wait"

You should see the following result: Safe mode is OFF

Hope it will help you to resolve your query.
If you have any further query,please let us know.