- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to check if Ambari setup was already done?
- Labels:
-
Apache Ambari
Created ‎03-02-2016 03:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When automating the setup of Ambari, is there an easy way of checking if "ambari-server setup" was already done, in order to skip this step in a script?
Created ‎03-02-2016 03:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ambari stores the configuration information in /etc/ambari-server/conf/ambari.properties file on Ambari server host. You could check something like below for the jdbc user and database name before invoking "ambari-server setup":
cat /etc/ambari-server/conf/ambari.properties | grep jdbc.user.name server.jdbc.user.name=<ambari_database_user_name> cat /etc/ambari-server/conf/ambari.properties | grep jdbc.database server.jdbc.database=mysql server.jdbc.database_name=<database_name>
If the entries exist and match with your environment, the setup was already done
On a fresh Ambari install where "ambari-server setup" is not yet done, this is what you would get:
[root@c6409 ~]# cat /etc/ambari-server/conf/ambari.properties | grep jdbc.user.name [root@c6409 ~]# echo $? 1 [root@c6409 ~]#
Created ‎03-02-2016 03:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ambari stores the configuration information in /etc/ambari-server/conf/ambari.properties file on Ambari server host. You could check something like below for the jdbc user and database name before invoking "ambari-server setup":
cat /etc/ambari-server/conf/ambari.properties | grep jdbc.user.name server.jdbc.user.name=<ambari_database_user_name> cat /etc/ambari-server/conf/ambari.properties | grep jdbc.database server.jdbc.database=mysql server.jdbc.database_name=<database_name>
If the entries exist and match with your environment, the setup was already done
On a fresh Ambari install where "ambari-server setup" is not yet done, this is what you would get:
[root@c6409 ~]# cat /etc/ambari-server/conf/ambari.properties | grep jdbc.user.name [root@c6409 ~]# echo $? 1 [root@c6409 ~]#
Created ‎03-02-2016 04:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great thanks!
Created ‎03-02-2016 04:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could query the Ambari db for table "clusters" for eg.
mysql> select * from clusters; +------------+-------------+--------------+--------------+--------------------+---------------+-----------------------+------------------+ | cluster_id | resource_id | cluster_info | cluster_name | provisioning_state | security_type | desired_cluster_state | desired_stack_id | +------------+-------------+--------------+--------------+--------------------+---------------+-----------------------+------------------+ | 2 | 4 | | Test | INSTALLED | NONE | | 3 | +------------+-------------+--------------+--------------+--------------------+---------------+-----------------------+------------------+ 1 row in set (0.01 sec)
Or using curl get http://<ambari-server>:8080/api/v1/clusters/C1/ and process.
Created ‎03-02-2016 04:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @vpoornalingam! Two options, both of which are more effort than @vsharma's options though.
Created ‎03-02-2016 06:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This approach actually also checks whether HDP is provisioned whereas the first approach only says Ambari setup stepnis done. Of course from your question, its clear you only need that.
