Closed jwilber closed 6 years ago
Your elasticsearch is probably not running. Elasticsearch listens on port 9200.
@jwilber Where are you running this, in EC2 or on Vagrant? Or locally?
In the file aws/ec2_bootstra.sh, we run the following code to install and test Elasticsearch. Can you run this in your console and tell me what happens? I pasted code for EC2 and Vagrant below, but you will have to alter the paths if you are running this on your local machine.
For EC2:
#
# Install ElasticSearch in the elasticsearch directory in the root of our project, and the Elasticsearch for Hadoop package
#
echo "Downloading and installing Elasticsearch version 5.5.1 ..." | tee -a $LOG_FILE
curl -Lko /tmp/elasticsearch-5.5.1.tar.gz https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.tar.gz
mkdir /home/ubuntu/elasticsearch
cd /home/ubuntu
tar -xvzf /tmp/elasticsearch-5.5.1.tar.gz -C elasticsearch --strip-components=1
sudo chown -R ubuntu /home/ubuntu/elasticsearch
sudo chgrp -R ubuntu /home/ubuntu/elasticsearch
sudo mkdir -p /home/ubuntu/elasticsearch/logs
sudo chown -R ubuntu /home/ubuntu/elasticsearch/logs
sudo chgrp -R ubuntu /home/ubuntu/elasticsearch/logs
# Run elasticsearch
echo "Running Elasticsearch as a daemon ..." | tee -a $LOG_FILE
sudo -u ubuntu /home/ubuntu/elasticsearch/bin/elasticsearch -d # re-run if you shutdown your computer
# Run a query to test - it will error but should return json
echo "Testing Elasticsearch with a query ..." | tee -a $LOG_FILE
curl 'localhost:9200/agile_data_science/on_time_performance/_search?q=Origin:ATL&pretty'
For Vagrant:
echo "curl -sLko /tmp/elasticsearch-5.2.1.tar.gz https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.1.tar.gz"
curl -sLko /tmp/elasticsearch-5.2.1.tar.gz https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.1.tar.gz
mkdir /home/vagrant/elasticsearch
cd /home/vagrant
tar -xvzf /tmp/elasticsearch-5.2.1.tar.gz -C elasticsearch --strip-components=1
sudo chown -R vagrant /home/vagrant/elasticsearch
sudo chgrp -R vagrant /home/vagrant/elasticsearch
sudo mkdir -p /home/vagrant/elasticsearch/logs
sudo chown -R vagrant /home/vagrant/elasticsearch/logs
sudo chgrp -R vagrant /home/vagrant/elasticsearch/logs
# Run elasticsearch
sudo -u vagrant /home/vagrant/elasticsearch/bin/elasticsearch -d # re-run if you shutdown your computer
# Run a query to test - it will error but should return json
echo "Testing Elasticsearch with a query ..." | tee -a $LOG_FILE
curl 'localhost:9200/agile_data_science/on_time_performance/_search?q=Origin:ATL&pretty'
I had similar problem in Vagrant and executing this step helped:
sudo -u vagrant /home/vagrant/elasticsearch/bin/elasticsearch
Closing for staleness. If you re-encounter this, please re-open/re-submit.
elasticsearch doesn't seem to be working for me. I'm running code from ch02.
On ec2 I am running
bash ch02/elasticsearch.sh
and obtain:curl: (7) Failed to connect to localhost port 9200: Connection refused
Running
yields this error:
I've never used elasticsearch and am unsure how to proceed. Any help is appreciated!