Upgrading to Elasticsearch 5.4.0 on Heroku using Elastic Cloud: [indices:admin/delete] requires authentication.

in technology •  8 years ago 

I learned the hard way how to setup access authentication for a protected cluster after upgrading to Elasticsearch 5.4.0 on Heroku’s Elastic Cloud service. My previous instance did not require Shield access authentication.

After porting the changes and pushing the upgrade, I hit the following error when rebuilding indices:

Elasticsearch::Transport::Transport::Errors::Unauthorized: [401] {“error”:{“root_cause”:[{“type”:”security_exception”,”reason”:”action [indices:admin/delete] requires authentication”,”header”:{“WWW-Authenticate”:”Basic realm=\”security\” charset=\”UTF-8\””}}],”type”:”security_exception”,”reason”:”action [indices:admin/delete] requires authentication”,”header”:{“WWW-Authenticate”:”Basic realm=\”security\” charset=\”UTF-8\””}},”status”:401}

To setup access authentication using a transport service:

(1) Install and configure the elasticsearch-transport gem (or alternative for non-Rails projects)

gem 'elasticsearch-transport', '~> 5.0.4'

(2) Push changes to Heroku server

$ git push heroku <app-name> <branch-name>

(3) Update your version on Elastic Cloud. This is accessible from the Heroku Dashboard add-on section.

Version: 5.4.0

Note: Shield is enabled by default. Save the auto-generated password that is provided for the elastic user.

(4) Using elastic credentials, log into Kibana and create an additional superuser. This is accessible from the Elastic Cloud dashboard, click on Kibana and then the management tab and elasticsearch security.

# Elasticsearch security via Kibana management tab
user: <user>
pass: <password>
role: superuser

(5) Set the access credentials on the config variable FOUNDELASTICSEARCH_URL like:

https://username:password@cluster_id.region.aws.found.io

This is accessible from your Heroku dashboard settings tab.

(6) Run rake commands to rebuild indices on Heroku environment.

$ heroku run rake elasticsearch:import:all

You should be setup and able to rebuild indices.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Good points in this article. Same thoughts here. I strongly advice people to only buy in to cryptos that have a solid background: A solid team, product, advisors, preferably VC investors, etc. Sell all cryptos that don't have this solid background. It's a waiste of money. This is quite an interesting website I found: https://www.coincheckup.com. Since I use this site I make so much less basic investment mistakes.

Congratulations @aaroncareaga! You have received a personal award!

1 Year on Steemit
_Click on the badge to view your Board of Honor.

Do you like SteemitBoard's project? Vote for its witness and get one more award!

Congratulations @aaroncareaga! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!