Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Documentation of the Ambari-Database

avatar
Contributor

Hi,

I want to extract Data from the Apache Ambari internal database. Is there an official documentation of the

Schematic structure of the database. I dont want to use the REST-API because of I am scare about the stability of the Interface in the next Releases.

Best Regards

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Dominik Ludwig

There are not official doc on the usage of each and every Ambari Database table. But you can refer to the Ambari DB schema and it's relation with other tables by looking at the SQL files that ambari uses to setup the ambari DB.

# # ls -lart /var/lib/ambari-server/resources/*.sql

-rwxr-xr-x. 1 root root 81282 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLServer-CREATE.sql
-rwxr-xr-x. 1 root root   827 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-EMBEDDED-DROP.sql
-rwxr-xr-x. 1 root root  1232 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
-rwxr-xr-x. 1 root root  1337 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-DROP.sql
-rwxr-xr-x. 1 root root 79172 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql
-rwxr-xr-x. 1 root root  2160 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Oracle-DROP.sql
-rwxr-xr-x. 1 root root 85484 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Oracle-CREATE.sql
-rwxr-xr-x. 1 root root  1192 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-MySQL-DROP.sql
-rwxr-xr-x. 1 root root 80064 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
-rwxr-xr-x. 1 root root 96945 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-AzureDB-CREATE.sql
-rwxr-xr-x. 1 root root  2117 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLServer-DROP.sql
-rwxr-xr-x. 1 root root  4215 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLServer-CREATELOCAL.sql
-rwxr-xr-x. 1 root root     0 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLAnywhere-DROP.sql
-rwxr-xr-x. 1 root root 84134 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLAnywhere-CREATE.sql

.

There are some thirdparty tools available that can produce graph from the SQL Schema file.

- But updating the DB entries directly is not recommended approach (except extreme scenarios when we have no other options left). So you should rely on the tools offered by ambari like "config.sh" script for managing the configurations, Rest APIs for managing and monitoring Ambari resources.

.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@Dominik Ludwig

There are not official doc on the usage of each and every Ambari Database table. But you can refer to the Ambari DB schema and it's relation with other tables by looking at the SQL files that ambari uses to setup the ambari DB.

# # ls -lart /var/lib/ambari-server/resources/*.sql

-rwxr-xr-x. 1 root root 81282 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLServer-CREATE.sql
-rwxr-xr-x. 1 root root   827 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-EMBEDDED-DROP.sql
-rwxr-xr-x. 1 root root  1232 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
-rwxr-xr-x. 1 root root  1337 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-DROP.sql
-rwxr-xr-x. 1 root root 79172 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql
-rwxr-xr-x. 1 root root  2160 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Oracle-DROP.sql
-rwxr-xr-x. 1 root root 85484 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-Oracle-CREATE.sql
-rwxr-xr-x. 1 root root  1192 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-MySQL-DROP.sql
-rwxr-xr-x. 1 root root 80064 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
-rwxr-xr-x. 1 root root 96945 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-AzureDB-CREATE.sql
-rwxr-xr-x. 1 root root  2117 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLServer-DROP.sql
-rwxr-xr-x. 1 root root  4215 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLServer-CREATELOCAL.sql
-rwxr-xr-x. 1 root root     0 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLAnywhere-DROP.sql
-rwxr-xr-x. 1 root root 84134 May 27 02:11 /var/lib/ambari-server/resources/Ambari-DDL-SQLAnywhere-CREATE.sql

.

There are some thirdparty tools available that can produce graph from the SQL Schema file.

- But updating the DB entries directly is not recommended approach (except extreme scenarios when we have no other options left). So you should rely on the tools offered by ambari like "config.sh" script for managing the configurations, Rest APIs for managing and monitoring Ambari resources.

.

avatar
Master Mentor

@Dominik Ludwig

Although you can refer to the ER diagram of ambari 2.4 as mentioned in the following link:

https://community.hortonworks.com/storage/attachments/13698-ambari-database-er-diagram.pdf

.

avatar
Contributor

Very cool. Many thanks

avatar
Contributor

Hi @Jay SenSharma ,

many thanks for your detailed asnwer. Is my Approach best practice? Ore woud you advice against this Approach.

Best Regards

avatar
Master Mentor

@Dominik Ludwig

Using Ambari API is the best approach instead of developing a view /tool to mofigy the ambari DB.

Ambari APIs are very matured and ambari UI itself makes those API calls to fetch the details / perform operations / monitor resources. So i think in future there might be many enhancements in the ambari API ... but it wont affect current ambari API usages or fundamental behavior of API calls.

So i will suggest you to rely on the ambari API instead of Direct DB modification.

.

There is a best link available on Ambari API usage and it's various usage for managing & monitoring resources: https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md

.

Most of the details can be extracted using Ambari APIs (that we can extract from the Database directly)