Yesterday evening our EC2 instance running ElasticSearch became
unreachable. Ping, SSh and elasticsearch were all unreachable even after
multiple reboots.
The solution
- spawn up a new EC2 instance
- use chef to provision it as an elasticsearch server (same
elasticsearch.yml). - Point our task server which we use to build the indexes, and build our
Food, SavedMeal, Recipe, and UserSet(Groups) indexes - Point our two web servers which search the index, and add new
documents at the new server - Open the site back up
The first problem I ran into, and seem to have solved (although not sure
how great solution is) was too many open files.
I am running the start-stop-daemon via sudo which is using the limits.conf
info now and has raised limit from 1024.
Search is now snappy and consistent.
However now not able to add documents to the index.
I'm getting
UnavailableShardsException[[default][4] [2] shardIt, [0] active : Timeout
waiting for [1m], request: index {[default][Food][206621],
source[{"id":206621,"name":"French Vanilla Formula 1
(US)","description":"","slug":"french-vanilla-formula-1-us","media_id":null,"user_id":19645,"serving_size":"2
scoops","gram_weight":null,"calories":null,"calories_from_fat":10,"total_fat":1,"saturated_fat":null,"polyunsaturated_fat":null,"monounsaturated_fat":null,"cholesterol":null,"sodium":140,"potassium":210,"total_carbohydrate":13,"dietary_fiber":3,"sugars":9,"protein":9,"vitamin_a":25,"vitamin_c":25,"calcium":8,"iron":15,"vitamin_d":25,"vitamin_e":25,"vitamin_k":0,"thiamin":25,"riboflavin":25,"niacin":25,"vitamin_b6":25,"folic_acid":25,"vitamin_b12":25,"pantothenic_acid":25,"phosphorus":15,"magnesium":10,"zinc":25,"selenium":15,"copper":25,"manganese":null,"kcal":90,"kj":null,"alcohol":null,"caffeine":null,"rank":null,"counter":null,"expert_rank":null,"pantry_counter":null,"brand":"Herbalife","overall_rank":null,"verified":false,"source":"iChange","culture":"en_US","indexable":1}]}]
And if I try and go directly to an indexed item that is returning properly
from the search I get
{"error": "NoShardAvailableActionException[[default][0] No shard available
for [Food#16447]]","status": 500}
This is my elasticsearch.yml
cluster: name: ichange_cluster index: store: type: fs cloud: aws:
access_key: AKIAJ2XMXZ6C4EUYP36Q secret_key:
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 network: host: 0.0.0.0 gateway:
type: local recover_after_nodes: 1 recover_after_time: 5m expected_nodes: 1
path: logs: /var/log/elasticsearch data: /var/lib/elasticsearch work:
/tmp/elasticsearch