-
-
Save Raboo/b19df89e8e6f864212b39bb0ba8e768d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
AMBARI_USER='admin' | |
AMBARI_PASSWORD='PWPWPW' | |
AMBARI_HOST='localhost' | |
CLUSTER_NAME='mitate' | |
MOVE_FROM='old-host.mitate.com' | |
MOVE_TO='new-host.mitate.com' | |
SSH_USER=john.doe | |
# Tell to ambari we want to install this component on new_host | |
curl -u $AMBARI_USER:$AMBARI_PASSWORD -H "X-Requested-By:ambari" -i -X POST http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/$MOVE_TO/host_components/JOURNALNODE | |
# Trigger installation | |
curl -u $AMBARI_USER:$AMBARI_PASSWORD -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo": {"context": "Install JournalNode","query":"HostRoles/component_name.in('JOURNALNODE')"}, "Body":{"HostRoles": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/$MOVE_TO/host_components | |
# Stop JournalNode on old host | |
curl -u $AMBARI_USER:$AMBARI_PASSWORD -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo": {"context": "Stop JournalNode","query":"HostRoles/component_name.in('JOURNALNODE')"}, "Body":{"HostRoles": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/$MOVE_FROM/host_components/JOURNALNODE | |
# copy journal from old node to new node. | |
mkdir /hadoop/hdfs | |
rsync -av -e "ssh" --rsync-path="sudo rsync" $SSH_USER@$MOVE_FROM:/hadoop/hdfs/journal/ $SSH_USER@$MOVE_TO:/hadoop/hdfs/journal | |
# update the configuration property below within in the Ambari UI within the HDFS section. | |
# <dfs.namenode.shared.edits.dir> | |
# Start JournalNode on new host | |
curl -u $AMBARI_USER:$AMBARI_PASSWORD -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo": {"context": "Start JournalNode","query":"HostRoles/component_name.in('JOURNALNODE')"}, "Body":{"HostRoles": {"state": "STARTED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/$MOVE_TO/host_components/JOURNALNODE | |
# Remove the old component | |
curl -u $AMBARI_USER:$AMBARI_PASSWORD -H "X-Requested-By:ambari" -i -X DELETE http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/$MOVE_FROM/host_components/JOURNALNODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Did you make anything to reconstruct the dfs.journalnode.edits.dir.
my directory dfs.journalnode.edits.dir seems to stay empty now.
Even the other nodes I did not move ...
Best Regards.