Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
| var express = require('express'); | |
| var sys = require('sys'); | |
| var oauth = require('oauth'); | |
| var app = express.createServer(); | |
| var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY"; | |
| var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET"; | |
| function consumer() { |
| # [Thu Jun 9 17:00:23 2011] Protocol: http, Server: 192.168.5.103:9200 | |
| curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' | |
| # [Thu Jun 9 17:00:23 2011] Response: | |
| # { | |
| # "ok" : true, | |
| # "acknowledged" : true | |
| # } | |
| # [Thu Jun 9 17:00:31 2011] Protocol: http, Server: 192.168.5.103:9200 |
| JavaScript Value | JavaScript Type | Java Type | Is Scriptable | Is Function |
|---|---|---|---|---|
{a:1, b:['x','y']} |
object |
org.mozilla.javascript.NativeObject |
+ | - |
[1,2,3] |
object |
org.mozilla.javascript.NativeArray |
+ | - |
1 |
number |
java.lang.Double |
- | - |
1.2345 |
number |
java.lang.Double |
- | - |
NaN |
number |
java.lang.Double |
- | - |
Infinity |
number |
java.lang.Double |
- | - |
-Infinity |
number |
java.lang.Double |
- | - |
true |
boolean |
java.lang.Boolean |
- |
| cd ~ | |
| sudo yum update | |
| sudo yum install java-1.7.0-openjdk.i686 -y | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| mv elasticsearch-* elasticsearch | |
| sudo mv elasticsearch /usr/local/share |
| /* | |
| * Licensed to Jörg Prante and xbib under one or more contributor | |
| * license agreements. See the NOTICE.txt file distributed with this work | |
| * for additional information regarding copyright ownership. | |
| * | |
| * Copyright (C) 2012 Jörg Prante and xbib | |
| * | |
| * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU Affero General Public License as published | |
| * by the Free Software Foundation; either version 3 of the License, or |
Yesterday I upgraded our running elasticsearch cluster on a site which serves a few million search requests a day, with zero downtime. I've been asked to describe the process, hence this blogpost.
To make it more complicated, the cluster was running elasticsearch version 0.17.8 (released 6 Oct 2011) and I upgraded it to the latest 0.19.10. There have been 21 releases between those two versions, with a lot of functional changes, so I needed to be ready to roll back if necessary.
- elasticsearch
We run elasticsearch on two biggish boxes: 16 cores plus 32GB of RAM. All indices have 1 replica, so all data is stored on both boxes (about 45GB of data). The primary data for our main indices is also stored in our database. We have a few other indices whose data is stored only in elasticsearch, but are updated once daily only. Finally, we store our sessions in elasticsearch, but active sessions are cached in memcached.
| import java.util.ArrayList; | |
| import java.util.List; | |
| import org.easymock.EasyMock; | |
| import org.easymock.IExpectationSetters; | |
| import org.json.JSONArray; | |
| import org.json.JSONObject; | |
| import twitter4j.Paging; | |
| import twitter4j.RateLimitStatus; |