Created 06-29-2018 02:56 PM
my rest server is up and running and the following command works
[root@hadoop1 ~]# curl --negotiate -u : 'http://hadoop1:17001/status/cluster' 1 live servers, 0 dead servers, 6.0000 average load 1 live servers hadoop5.xxx.com:16020 1530282635984 requests=0, regions=6 heapSizeMB=145 maxHeapSizeMB=2007
but the other curl commands are failing with authentication error . I have a Kerberos ticket acquired from
/etc/security/keytabs/hbase.service.keytab
[root@hadoop1 ~]# curl -H "Accept: text/xml" http://hadoop1:17001/version <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 401 Authentication required</title> </head> <body><h2>HTTP ERROR 401</h2> <p>Problem accessing /version. Reason: <pre> Authentication required</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> <br/>
Created 06-29-2018 03:04 PM
You have to use negotiate for all the curl calls
curl --negotiate -u -H "Accept: text/xml" http://hadoop1:17001/version
Created 06-29-2018 03:04 PM
You have to use negotiate for all the curl calls
curl --negotiate -u -H "Accept: text/xml" http://hadoop1:17001/version
Created 06-29-2018 03:28 PM
ok I will use negotiate ..can you tell why I am not seeing the right formatted output of table names but I see "<" ">" around them ?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><TableList><table name="UFM"/><table name="WZ"/><table name="state_code"/></TableList>[root@hadoop1 ~]#
Created 06-29-2018 03:45 PM
This is not an issue. You can use some xml formatter to pretty print it since you are getting proper results.
Created 06-29-2018 04:02 PM
I am getting the proper results .. the tables are there in the xml list "UFM" "WZ" , how can I make them appear in normal format like ?
UFM
WZ
Created 06-29-2018 04:09 PM
You need to use some XML parsers to parse the results and get the table names to get the desired output you want.
https://unix.stackexchange.com/questions/83385/parse-xml-to-get-node-value-in-bash-script
Created on 06-29-2018 04:49 PM - edited 08-18-2019 02:51 AM
please see above , this is from the hortonworks document , how they are able to get the right output without any xml parsing ?
Created 06-29-2018 06:11 PM
oh the following syntax worked
[root@hadoop1 ~]# curl --negotiate -i -u : -X GET -H "Accept: text" http://$(hostname):17001/ HTTP/1.1 401 Authentication required WWW-Authenticate: Negotiate Set-Cookie: hadoop.auth=; Path=/; HttpOnly Content-Type: text/html; charset=iso-8859-1 Cache-Control: must-revalidate,no-cache,no-store Content-Length: 1393 HTTP/1.1 200 OK Set-Cookie: hadoop.auth="u=hbase&p=hbase/hadoop1.xxx.com@XXX.US&t=kerberos&e=1530331783162&s=Ypuvww45JSzCbQwTbc5ysWmaSfI="; Path=/; HttpOnly Content-Type: text/plain Cache-Control: no-cache Content-Length: 18 UFM WZ state_code
Created 06-29-2018 04:57 PM
To get output in the above format you should not pass the "Accept: text/xml" header. Just try hitting
curl --negotiate -u http://hadoop1:17001
Created 06-29-2018 06:08 PM
he doesn't like the syntax of this
# curl --negotiate -u http://hadoop1:17001 curl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information