nc <host> <port>
and then type the request content:
GET <path>
Accept: application/json
ContentType: application/json
Let's bite the HCatalog via Rest interface then, first put request content in a file head.txt:
GET /templeton/v1/status
Accept: application/json
ContentType: application/json
Then send the request to the HCatalog web service - "what address and port, master" you may ask, well check it in HCatalog config file. In my case web service in running on default port (50111). While checking the port, note down HCatalog username you will need it later on.
echo head.txt | nc localhost 50111
You should get something like this:
{"status":"ok","version":"v1"}#
Now prepare for a mind-blowing experience change first line in head.txt to
GET /templeton/v1/ddl/database?user.name=hcat
To get information about databases for user hcat!
Let's go even deeper and check properties of given database:
GET /templeton/v1/ddl/database/<database_name>?user.name=hcat
To get tables from given database:
GET /templeton/v1/ddl/database/<database_name>/table?user.name=hcat
GET /templeton/v1/ddl/database/<database_name>/table/<table_name>?user.name=hcat
That's all guys - thanks!
No comments:
Post a Comment