Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HipChat ElasticSearch meetup

HipChat ElasticSearch meetup

"Zuhaib will discuss how HipChat uses Elasticsearch in its infrastructure to provide near real-time search and chat history to the hundreds of thousands of active chatters using HipChat. He will cover some of the issues we've overcome using elasticsearch with AWS and CouchDB."

http://www.meetup.com/Elasticsearch-San-Francisco/events/141698772/

Zuhaib Siddique

November 18, 2013
Tweet

Other Decks in Programming

Transcript

  1. { "id": "b0952da8-faa1-48f7-b1df-a8b2fb24bdfe", "from": { "nick": "Zuhaib Siddique", "group_id": 1,

    "user_id": 1 }, "room": { "group_id": 1, "name": "testing", "id": 1 }, "stanza_type": "muc_message", "date": "2013-11-14T23:20:13Z 424967", "stanza_data": { "body": "ElasticSearch FTW" } } What is a HipChat Message? Wednesday, November 20, 13
  2. CouchDB + CouchDB-Lucene •Started to tip over at 200M Docs

    •m2.4xlarge Wednesday, November 20, 13
  3. Why ElasticSearch for HipChat { "query_string" : { "default_field" :

    "content", "query" : "this AND that OR thus" } } Wednesday, November 20, 13
  4. (allthethings) ElasticSearch { "_index": "muc-2013.11", "_type": "document", "_id": "b0952da8-faa1-48f7-b1df-a8b2fb24bdfe", "_version":

    1, "exists": true, "_source": { "from": { "nick": "Zuhaib Siddique", "group_id": 1, "user_id": 1 }, "room": { "group_id": 1, "name": "testing", "id": 1 }, "stanza_type": "muc_message", "date": "2013-11-14T23:20:13Z 424967", "_id": "b0952da8-faa1-48f7-b1df-a8b2fb24bdfe", "stanza_data": { "body": "ElasticSearch FTW" } } } { "id": "b0952da8-faa1-48f7-b1df-a8b2fb24bdfe", "from": { "nick": "Zuhaib Siddique", "group_id": 1, "user_id": 1 }, "room": { "group_id": 1, "name": "testing", "id": 1 }, "stanza_type": "muc_message", "date": "2013-11-14T23:20:13Z 424967", "stanza_data": { "body": "ElasticSearch FTW" } } ElasticSearch CouchDB Wednesday, November 20, 13
  5. (allthethings) ElasticSearch { "_index": "muc-2013.11", "_type": "document", "_id": "b0952da8-faa1-48f7-b1df-a8b2fb24bdfe", "_version":

    1, "exists": true, "_source": { "from": { "nick": "Zuhaib Siddique", "group_id": 1, "user_id": 1 }, "room": { "group_id": 1, "name": "testing", "id": 1 }, "stanza_type": "muc_message", "date": "2013-11-14T23:20:13Z 424967", "_id": "b0952da8-faa1-48f7-b1df-a8b2fb24bdfe", "stanza_data": { "body": "ElasticSearch FTW" } } } { "id": "b0952da8-faa1-48f7-b1df-a8b2fb24bdfe", "from": { "nick": "Zuhaib Siddique", "group_id": 1, "user_id": 1 }, "room": { "group_id": 1, "name": "testing", "id": 1 }, "stanza_type": "muc_message", "date": "2013-11-14T23:20:13Z 424967", "stanza_data": { "body": "ElasticSearch FTW" } } ElasticSearch CouchDB Wednesday, November 20, 13
  6. •Spin up EC2 Instance •Install Oracle Java 7 •Create Provision

    IOPs EBS •Install and configure ElasticSearch •??? •Profit! Behind the Scenes Wednesday, November 20, 13
  7. # Elasticsearch nodes = partial_search(:node, "role:elasticsearch_server AND chef_environment:#{node.chef_environment}", :keys =>

    { 'hostname' => [ 'hostname' ] }) if nodes.empty? Chef::Log.error "site.json - No Elasticsearch servers found" else es_nodes = nodes.map {|n| { 'host' => n['hostname'], 'port' => 9200 } } data["elasticsearch"] = { "connections" => es_nodes.sort_by {|n| n['host'] } } end Wednesday, November 20, 13
  8. site.json "elasticsearch": { "connections": [ { “host": "esindex-c1", "port": 9200

    }, ... { "host": "esindex-e3", "port": 9200 } ] } Wednesday, November 20, 13