in case of having Shiro authentication for Zeppelin, first you need to login from the command line using the credentials. Please find the below procedure in order to run a job from command line.
The first step is to authentic through the API with a POST to /api/login. I have used the default username and password from shiro.ini file. Use the below command in order to login from command line. Modify the IP address and credentials. In your case it looks something like this. ‘userName=GalGadot&password=WonderWoman’.
curl -i –data ‘userName=admin&password=password1’ -X POST http://ec2-34-27-130-194.us-west-2.compute.amazonaws.com:8890/api/login
The command will return the below output if the login is successful.
HTTP/1.1 200 OK
Date: Monday, May 7, 2018 6:10:03 PM UTC
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: authorization,Content-Type
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, HEAD, DELETE
X-FRAME-OPTIONS: SAMEORIGIN
X-XSS-Protection: 1
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 06-May-2018 18:10:03 GMT
Set-Cookie: JSESSIONID=f50827a1-59d4-40f3-9c60-d1b20ef47a83; Path=/; HttpOnly
Set-Cookie: JSESSIONID=deleteMe; Path=/; Max-Age=0; Expires=Sun, 06-May-2018 18:10:03 GMT
Set-Cookie: JSESSIONID=7143ce79-17be-4900-bad1-5d865bffe000; Path=/; HttpOnly
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 06-May-2018 18:10:03 GMT
Content-Type: application/json
Date: Mon, 07 May 2018 18:10:03 GMT
Content-Length: 123
Server: Jetty(9.2.15.v20160210)
{“status”:”OK”,”message”:””,”body”:{“principal”:”admin”,”ticket”:”7fcecbea-3a1e-40ed-8e21-0514e43e68a9″,”roles”:”[admin]”}}
- Next, Using this cookie we can make authorized request to the API by simply setting this as a cookie in the cURL request. Use the “Set-Cookie” from the above output. I got two “Set-Cookie” from my outout. When I gave the first one it failed. However when I tried giving the second one i.e Set-Cookie: JSESSIONID=7143ce79-17be-4900-bad1-5d865bffe000; Path=/; HttpOnly, it worked. So please try the below command with the appropriate cookie. and the job url.
curl -i -b ‘JSESSIONID=7143ce79-17be-4900-bad1-5d865bffe000; Path=/; HttpOnly’ http://ec2-xx-xx-xxx.us-west-2.compute.amazonaws.com:8890/api/notebook/job/2A94M5J1Z
So if the authentication is successful, it returns the ” 200 OK” http status.
HTTP/1.1 200 OK
Date: Monday, May 7, 2018 6:13:22 PM UTC
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: authorization,Content-Type
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, HEAD, DELETE
X-FRAME-OPTIONS: SAMEORIGIN
X-XSS-Protection: 1
Content-Type: application/json
Date: Mon, 07 May 2018 18:13:22 GMT
Content-Length: 1184
Server: Jetty(9.2.15.v20160210)
{“status”:”OK”,”body”:[{“progress”:”100″,”started”:”Mon May 07 17:59:43 UTC 2018″,”finished”:”Mon May 07 17:59:45 UTC 2018″,”id”:”20150213-231621_168813393″,”status”:”FINISHED”},{“progress”:”100″,”started”:”Mon May 07 17:59:43 UTC 2018″,”finished”:”Mon May 07 17:59:48 UTC 2018″,”id”:”20150210-015259_1403135953″,”status”:”FINISHED”},{“progress”:”100″,”started”:”Mon May 07 17:59:44 UTC 2018″,”finished”:”Mon May 07 18:00:01 UTC 2018″,”id”:”20150210-015302_1492795503″,”status”:”FINISHED”},{“progress”:”100″,”started”:”Mon May 07 17:59:49 UTC 2018″,”finished”:”Mon May 07 18:00:03 UTC 2018″,”id”:”20150212-145404_867439529″,”status”:”FINISHED”},{“progress”:”100″,”started”:”Mon May 07 18:00:01 UTC 2018″,”finished”:”Mon May 07 18:00:05 UTC 2018″,”id”:”20150213-230422_1600658137″,”status”:”FINISHED”},{“progress”:”100″,”started”:”Mon May 07 17:59:45 UTC 2018″,”finished”:”Mon May 07 17:59:45 UTC 2018″,”id”:”20150213-230428_1231780373″,”status”:”FINISHED”},{“progress”:”100″,”started”:”Mon May 07 17:59:45 UTC 2018″,”finished”:”Mon May 07 17:59:45 UTC 2018″,”id”:”20150326-214658_12335843″,”status”:”FINISHED”},{“progress”:”100″,”id”:”20150703-133047_853701097″,”status”:”FINISHED”}]}
By running the job using the above command, if it is successful, the status will be “FINISHED”. I hope the above information is useful.
Need to learn more about aws big data (demystified)?
- Contact me via linked in Omid Vahdaty
- website: https://amazon-aws-big-data-demystified.ninja/
- Join our meetup, FB group and youtube channel
- Join our meetup : https://www.meetup.com/AWS-Big-Data-Demystified/
- Join our facebook group https://www.facebook.com/groups/amazon.aws.big.data.demystified/
- subscribe to our youtube channel https://www.youtube.com/channel/UCzeGqhZIWU-hIDczWa8GtgQ?view_as=subscriber
——————————————————————————————————————————
I put a lot of thoughts into these blogs, so I could share the information in a clear and useful way. If you have any comments, thoughts, questions, or you need someone to consult with, feel free to contact me:
https://www.linkedin.com/in/omid-vahdaty/