I have a Cloudera Quickstart VM with Cloudera CDH 5.5 that I use for tests. The default hostname is quickstart.cloudera, I would like to change to its name in the network, let's say host02.
I tried to change /etc/init.d/cloudera-quickstart-init, /etc/default/cloudera-scm-agent, change configurations inside Cloudera Manager, but all changes broke my environment. Is there a recipe to do it?
Ok.... within Cloudera Manager, the hostname is write once, but there is a way to trick it.
If DNS, the hostname, and the host's FQDN are not properly configured, this will not work and you may end up with a bork'd system.
1. You need to change the name which is reported by 'hostname' to the new value.
2. This new value needs to resolve via DNS and needs to be the fully qualified domain name.
3. You will need to dump the deployment -- curl -u admin:admin http://MANAGER:7180/cm/deployment > config.json; then shutdown the agent service and all running services -- sudo service cloudera-scm-agent hard_stop (or the like, I don't remember the exact flag at the moment, service cloudera-scm-agent help should give it)
4. Back up the config file and edit the hosts section of the config to reflect the changes.
5. Upload the changed deployment -- curl -u 'admin:admin' -X PUT -i -H "content-type:application/json" -d @config.json \
6. *before you restart the agent* make sure that the host responds correctly to DNS queries and hostname requests.....
7. restart the agent: sudo service cloudera-scm-agent restart
if the configuration is borked, then shutdown the agent and redo step 5 with the backup of the config file (you did make a backup, right?)
There are some other things which can be fixed by this method -- I recently wrote about such a case: http://matthewkwilliams.com/index.php/2016/04/07/cloudera-manager-disaster-recovery-with-json-deploy...
Thanks for the explanations that helped me a lot !
I had to change some more files to get an healthy cluster after having changed the hostname :
3.1. Back up the agent default config file and apply the changes.
cp /etc/default/cloudera-scm-agent /opt/cloudera/sauvegarde/etc_default_cloudera-scm-agent
sed -i -e 's/quickstart.cloudera/$(hostname)/g' /etc/default/cloudera-scm-agent
3.2. Back up the services config directory and edit the hosts section of the each config file to reflect the changes.
cp -r /var/run/cloudera-scm-agent/process /opt/cloudera/sauvegarde/
# for each file in /var/run/cloudera-scm-agent/process :
for fichier in $(grep -rl quickstart.cloudera /var/run/cloudera-scm-agent/process); do sed -i -e "s/quickstart.cloudera/$(hostname)/g" $fichier; done
3.3. You may eventually need to change the value in the /etc/cloudera-scm-agent/config.ini as explained in the blog post of the preceding anwser
Just be aware that all this works well on a non-kerberized cluster. It should be much more complex on a secure server.