Permalink
Browse files

fixed a bug in elasticsearch.in.sh (conf dir was pointing to work dir…

…), rakefile is a little cleaner and easier to understand, adding notes for upcoming blog post
  • Loading branch information...
1 parent 0aa2b10 commit 22da1180761f2f88d5855836ba848cf932046b6e @thedatachef thedatachef committed Jan 23, 2011
Showing with 38 additions and 17 deletions.
  1. +12 −13 Rakefile
  2. +1 −1 config/elasticsearch.in.sh
  3. +25 −3 notes.txt
View
@@ -1,13 +1,12 @@
#!/usr/bin/env ruby
require 'rubygems'
-require 'wukong'
require 'configliere' ; Configliere.use(:commandline, :env_var, :define)
WORK_DIR=File.expand_path(File.dirname(__FILE__))
Settings.define :src, :default => "#{WORK_DIR}/src", :description => "Java source dir"
Settings.define :target, :default => "#{WORK_DIR}/build", :description => "Build target, this is where compiled classes live"
-Settings.define :main_class, :default => "ElasticBulkLoader", :description => "Main java class to run"
+Settings.define :jar_name, :default => "wonderdog", :description => "Name of the target jar"
Settings.define :hadoop_home, :default => "/usr/lib/hadoop", :description => "Path to hadoop installation", :env_var => "HADOOP_HOME"
Settings.define :es_home, :default => "/usr/local/share/elasticsearch", :description => "Path to elasticsearch installation",:env_var => "ES_HOME"
Settings.resolve!
@@ -31,20 +30,20 @@ end
def srcs options
sources = Dir[
- "#{options.src}/*.java",
+ "#{options.src}/**/*.java",
].inject([]){|sources, src| sources << src; sources}
sources.join(' ')
end
-#
-# FIXME: Needs to be idempotent ...
-#
-task :compile do
- puts "Compiling #{options.src} ..."
- snakeized = options.main_class.underscore
- mkdir_p File.join(options.target, snakeized)
- system "javac -cp #{classpath(options)} -d #{options.target}/#{snakeized} #{srcs(options)}"
- system "jar -cvf #{options.target}/#{snakeized}.jar -C #{options.target}/#{snakeized} . "
+jar_dir = File.join(options.target, options.jar_name)
+directory jar_dir
+
+task :compile => jar_dir do
+ sh "javac -cp #{classpath(options)} -d #{jar_dir} #{srcs(options)}"
+end
+
+task :jar => :compile do
+ sh "jar -cvf #{jar_dir}.jar -C #{jar_dir} . "
end
-task :default => [:compile]
+task :default => [:jar]
@@ -1,4 +1,4 @@
-export ES_CONF_DIR=${ES_WORK_DIR-/etc/elasticsearch}
+export ES_CONF_DIR=${ES_CONF_DIR-/etc/elasticsearch}
export ES_WORK_DIR=${ES_WORK_DIR-/mnt/elasticsearch/work}
export ES_DATA_DIR=${ES_DATA_DIR-/mnt/elasticsearch/data}
View
@@ -1,10 +1,32 @@
-<h2>Install and start ElasticSearch</h2>
+<h2>Getting Started with ElasticSearch</h2>
<pre class="brush: bash">
$: wget http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.14.2.zip
$: sudo mv elasticsearch-0.14.2 /usr/local/share/
$: sudo ln -s /usr/local/share/elasticsearch-0.14.2 /usr/local/share/elasticsearch
-$: /usr/local/share/elasticsearch/bin/elasticsearch
</pre>
-You'll probably want to change the configuration for your particular setup but that should at least get you started.
+Next you'll want to make sure there is an 'elasticsearch' user and that there are suitable data, work, and log directories that 'elasticsearch' owns:
+
+<pre class="brush: bash">
+$: sudo useradd elasticsearch
+$: sudo mkdir -p /var/log/elasticsearch /var/run/elasticsearch/{data,work}
+$: sudo chown -R elasticsearch /var/{log,run}/elasticsearch
+</pre>
+
+Go ahead and copy the example configuration:
+
+<pre class="brush: bash">
+$: sudo mkdir -p /etc/elasticsearch
+$: sudo cp config/elasticsearch-example.yml /etc/elasticsearch/elasticsearch.yml
+$: sudo cp config/logging.yml /etc/elasticsearch/
+$: sudo cp config/elasticsearch.in.sh /etc/elasticsearch/
+</pre>
+
+and make changes to 'elasticsearch.yml' such that it points to the correct data, work, and log directories. Also, you'll want to change the number of 'recovery_after_nodes' and 'expected_nodes' in elasticsearch.yml to however many nodes (machines) you actually expect to have in your cluster. You'll probably also want to do a quick once-over of elasticsearch.in.sh and make sure the jvm settings, etc are sane for your particular setup. Finally, to startup do:
+
+<pre class="brush: bash">
+sudo -u elasticsearch /usr/local/share/elasticsearch/bin/elasticsearch -Des.config=/etc/elasticsearch/elasticsearch.yml
+</pre>
+
+You should now have a happily running (reasonably configured) elasticsearch data node.

0 comments on commit 22da118

Please sign in to comment.