There are a few things to check:
1. What version of HDP are you using?
2. What do you mean saying ‘NameNode automatically becomes inactive’? Is the namenode process down? Can you please verify?
3. Please check namenode log or upload namenode log to our ftp site.
Hope this helps.