Hdfs Service Systemd - startup

0 votes
I want to create a service that starts and stops my hdfs that is associated to my spark cluster.

service descripton:

[Unit]
Description=Hdfs service
[Service]
Type=simple
WorkingDirectory=/home/hduser
ExecStart=/opt/hadoop-2.6.4/sbin/start-service-hdfs.sh
ExecStop=/opt/hadoop-2.6.4/sbin/stop-service-hdfs.sh
[Install]
WantedBy=multi-user.target
 

The problem  I m facing is when i start the service, it starts but it stops just after sometime its been started.
Can anyone tell me what exactly the issue could be??

Thanks in advance!
Mar 29, 2018 in Big Data Hadoop by coldcode
• 2,020 points
463 views

1 answer to this question.

0 votes
I guess the issue you are facing is because you are not mentioning the configurations correctly, that is why it is not working.

My HADOOP_HOME is /home/hadoop/user1/etc/hadoop/

Try the below given configuration.

[Unit]
Description=Hadoop DFS namenode and datanode
After=syslog.target network.target remote-fs.target nss-lookup.target network-online.target
Requires=network-online.target

[Service]
User=hadoop
Group=hadoop
Type=forking
ExecStart=/home/hadoop/user1/etc/hadoop/sbin/start-dfs.sh
ExecStop=/home/hadoop/envs/dwh/hadoop/sbin/stop-dfs.sh
WorkingDirectory=/home/hadoop/envs/dwh
Environment=JAVA_HOME=/usr/lib/jvm/java-8-oracle
Environment=HADOOP_HOME=/home/hadoop/user1/etc/hadoop
TimeoutStartSec=1min
Restart=on-failure
PIDFile=/tmp/hadoop-hadoop-namenode.pid

[Install]
WantedBy=multi-user.target

Hope it works for you.
answered Mar 29, 2018 by nitinrawat895
• 10,710 points

Related Questions In Big Data Hadoop

+2 votes
10 answers

Is there any difference between “hdfs dfs” and “hadoop fs” shell commands?

Yes, there's a difference between hadoop fs and ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Kunal
10,922 views
0 votes
13 answers

What is the difference between Hadoop/HDFS & HBase?

HDFS is a distributed file system whereas ...READ MORE

answered Apr 26 in Big Data Hadoop by Arihar
• 160 points
10,499 views
+1 vote
1 answer

HDFS Permission

You have to check permissions on the ...READ MORE

answered Mar 26, 2018 in Big Data Hadoop by Ashish
• 2,630 points
36 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,260 points
1,187 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
3,304 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,292 views
0 votes
1 answer
0 votes
1 answer

How can I download only hdfs and not hadoop?

No, you cannot download HDFS alone because ...READ MORE

answered Mar 15, 2018 in Big Data Hadoop by nitinrawat895
• 10,710 points
95 views
0 votes
1 answer

How to create a FileSystem object that can be used for reading from and writing to HDFS?

Read operation on HDFS In order to read ...READ MORE

answered Mar 21, 2018 in Big Data Hadoop by nitinrawat895
• 10,710 points

edited Mar 21, 2018 by nitinrawat895 353 views