I did it earlier this year with Ambari 1.7 and postgresql. As noticed
earlier, no master processes was running on the nodes I renamed.
Provided without guarantees :
http://www.swiss-scalability.com/2015/01/rename-host-in-ambari-170.html



2015-04-19 13:22 GMT+02:00 Frank Eisenhauer <[email protected]>:

> Seems like renaming a host is more complex than expected, especially in my
> case, where I have to rename the hosts with the master services like the
> namenode, hbase master etc.
>
> I'm currently considering to install the test lab from scratch and migrate
> the "old" lab to the newly installed one.
>
>
>
>
>
> On Sunday, April 19, 2015, Alejandro Fernandez <[email protected]>
> wrote:
>
>>  Renaming a host also has implications because NameNode and other
>> services can still have references to the old name in several configs.
>> If the host has no master components, then it's definitely easier.
>>
>>  The following steps can be used to change host name in the Ambari
>> database, so please use at your own risk.
>>  1. Stop all services through Ambari UI.
>>
>>  2. Stop ambari-server on Ambari server host from command line, run:
>> > ambari-server stop
>>
>>  3. Stop ambari-agent on all of the hosts from command line, run:
>> > ambari-agent stop
>> This is done to make sure that operation safer.
>>
>>  4. Backup database on the Ambari server from command line, please run:
>> > mkdir /var/db_backup
>> > cd /var/db_backup
>>
>>  *Postgres*
>> > pg_dump -U ambari ambari > ambari1.sql (default password: bigdata)
>> > pg_dump -U mapred ambarirca > ambarirca1.sql (default password: mapred)
>>
>>  *MySQL*
>> In Linux, the MySQL databases are stored in /var/lib/mysql by default.
>> > mysqldump -u ambari ambari > ambari1.sql (default password: bigdata)
>>
>>  5. Replace all occurrences of old hostname with new hostname.
>> For example:
>> > sed 's/old-hostname/new-hostname/g' ambari1.sql > ambari2.sql
>> > sed 's/old-hostname/new-hostname/g' ambarirca1.sql > ambarirca2.sql
>> (not needed when using MySQL)
>> Warning: Use tools that are appropriate for you. Please be careful to not
>> accidentally replace unintended strings in the database data.
>>
>>  6. Clean up Ambari database from command line, please run:
>> > ambari-server reset
>>
>>  7. Recreate Ambari database from command line, please run:
>> *Postgres*
>> > su postgres -c 'psql -c "drop database ambari" '
>> > su postgres -c 'psql -c "drop database ambarirca" '
>> > su postgres -c 'psql -c "create database ambari" '
>> > su postgres -c 'psql -c "create database ambarirca" '
>>
>>  *MySQL*
>> > mysql -u ambari -pbigdata  (or other password)
>> mysql> DROP DATABASE ambari;
>> mysql> CREATE DATABASE ambari;
>> mysql> exit;
>>
>>  8. Load into Ambari database with the modified database generated in
>> step 5 and run the following commands:
>> *Postgres*
>> > su postgres -c 'psql -f ambari2.sql -d ambari'
>> > su postgres -c 'psql -f ambarirca2.sql -d ambarirca'
>>
>>  *MySQL*
>> > mysql -u ambari -pbigdata ambari < ambari2.sql (default password:
>> bigdata)
>>
>>  9. Start ambari-server on Ambari server host from command line, please
>> run:
>> > ambari-server start
>>
>>  10. Start ambari-agent on all of the hosts from command line, please
>> run:
>> > ambari-agent start
>>
>>  11. Verify that Ambari shows new host name.
>>
>>  12.Restart all services through Ambari UI, this will cause all
>> components to pick up any changes in configs.
>> Note: This procedure does not modify any database that is used by Hadoop
>> components such as Hive metastore database or Oozie database. If database
>> access were granted to old hosts, you may need to grant permissions to the
>> new host before starting the Hadoop service.
>>
>>  Thanks,
>> Alejandro
>>
>>  On 4/18/15, 1:16 PM, "Yusaku Sako" <[email protected]> wrote:
>>
>>  Just FYI...
>> What I've seen folks do is dump the database, keep a backup, replace all
>> occurrences of the old hostname to the new hostname in the dump file, then
>> reimport.
>>
>>  Yusaku
>>
>>  On 4/18/15 9:51 AM, "Sumit Mohanty" <[email protected]> wrote:
>>
>>  +Alejandro
>>
>>  In theory, you can stop ambari-server, modify all occurrences of the
>> hostname and that should be it. There is not first class support for it.
>>
>>  Alejandro, did you look at the possibility of manually changing all host
>> names to rename a host
>> (https://issues.apache.org/jira/browse/AMBARI-10167)
>>
>>  -Sumit
>> ________________________________________
>> From: Frank Eisenhauer <[email protected]>
>> Sent: Saturday, April 18, 2015 12:31 AM
>> To: Ambari User
>> Subject: Change hostname on running cluster
>>
>>  Hi All,
>>
>>  we have a running hadoop cluster where we unfortunately have a hostname
>> in uppercase, e.g. SRV-HADOOP01.BIGDATA.LOCAL.
>>
>>  As of Ambari 1.7 we are experiencing a lot of side effects which are
>> presumably caused by the hostnames in uppercase.
>>
>>  I would like to rename the particular hosts(e.g.
>> srv-hadoop01.bigdata.local), so that there are only hosts with lowercase
>> names in the cluster.
>>
>>  Is it possible to change the hostname? I came across a few blogs, but in
>> general renaming hostnames seems not to be recommended.
>>
>>  Has anyone performed a hostname change?
>>
>>  Many thanks in advance.
>>
>>
>>
>>

Reply via email to