0

I have two servers that I need to run with these commands:

cd /home/hadoop/apache-hive-3.1.1-bin/ 
sudo hiveserver2 

and

sudo /opt/hue/build/env/bin/hue runserver 

So I putted both commands in a script.sh (along with other stuff):

$HADOOP_HOME/sbin/start-dfs.sh
$HADOOP_HOME/sbin/start-yarn.sh
cd /home/hadoop/apache-hive-3.1.1-bin/ 
hiveserver2 & 
sudo /opt/hue/build/env/bin/hue runserver &

So when I execute it with bash script.sh only the four first lines work. The hue server never get urned on.

Why is that ? Is it because the terminal stays reserved for the hiveserver? How can I avoid that please. Thank you


EDIT 1:

So, I edited as suggested my script:

$HADOOP_HOME/sbin/start-dfs.sh
$HADOOP_HOME/sbin/start-yarn.sh
sudo gnome-terminal -- bash -c "cd /home/hadoop/apache-hive-3.1.1-bin; hiveserver2 &" 
sudo /opt/hue/build/env/bin/hue runserver &

and I executed using bash script.sh. Now hueserver is running but not hiveserver. A second terminal is open but with nothing in it (total black screen).

  • Sorry but same problem persists. – AbderrahmenM Jun 14 at 12:31
  • Please check edited question. Thank you – AbderrahmenM Jun 14 at 12:53
  • Now it only executes first two lines then it asks for user's password without a prompt so i can type it (It just prints [sudo] enter hadoop password: and it exits without waiting for me to put the password) – AbderrahmenM Jun 14 at 13:02
  • Because otherwise I'll get the following error after the first two lines: No protocol specified unable to init server could not connect connection refused – AbderrahmenM Jun 14 at 13:08
  • I should probably precise that it isn't my main user that executes the script. Actually before executing it I need to do: su - hadoop and enter hadoop password – AbderrahmenM Jun 14 at 13:09
0

here's what you can do instead :

gnome-terminal -- bash -c "$HADOOP_HOME/sbin/start-dfs.sh; $HADOOP_HOME/sbin/start-yarn.sh; cd /home/hadoop/apache-hive-3.1.1-bin; hiveserver2" &&
sudo /opt/hue/build/env/bin/hue runserver &
  • Now it runs first two commands and then: No protocol specified unable to init server could not connect connection refused – AbderrahmenM Jun 14 at 13:12
  • I should probably precise that it isn't my main user that executes the script. Actually before executing it I need to do: su - hadoop and enter hadoop password – AbderrahmenM Jun 14 at 13:13
  • I still had the same problem using the script in your answer (No protocol specified unable to init server could not connect connection refused ) so I added sudo before gnome-* and now it opens a new terminal, executes the first two commands (start-dfs and start-yarn) and then it closes and in the main terminal it runs hue. hiveserver still not activated – AbderrahmenM Jun 14 at 13:38
  • When I execute separtely separately the hue or hive servers I actually need to leave the terminal open otherwise it will stop the running servers. I need a way to keep the scond terminal (the one that get launched with gnome-terminal) open – AbderrahmenM Jun 14 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.