Installing Elasticsearch on OSX Mavericks - elasticsearch

I'm trying to install Elasticsearch 1.1.0 on OSX Mavericks but i got the following errors when i'm trying to start:
:> ./elasticsearch
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.Version
at org.elasticsearch.bootstrap.Bootstrap.buildErrorMessage(Bootstrap.java:252)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:236)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Also when i'm executing the same command with -v arg, i got this error:
:> ./elasticsearch -v
Exception in thread "main" java.lang.NoSuchFieldError: LUCENE_36
at org.elasticsearch.Version.<clinit>(Version.java:42)
Here's my environment:
Java version
>: java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
Instalation path (downloaded .tar.gz archive from elasticsearch download page and extracted here):
/usr/local/elasticsearch-1.1.0
ENV vars:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
CLASSPATH=/usr/local/elasticsearch-1.1.0/lib/*.jar:/usr/local/elasticsearch-1.1.0/lib/sigar/*.jar
UPDATE
i finally make it working, unfortunally not sure how because i tried a lot of changes :). But here's a list of changes i made that can help:
i removed jdk and jre and reinstalled on a clean env.
http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096855
i deleted all the cache dirs.I suppose this can be the 'cause' for that it's working now
~/Library/Caches
/Library/Caches
i removed CLASSPATH env var.
ES_PATH and ES_HOME env vars are not set either, but i think this is not so important.
Note: now it's working also if i'm installing with brew.
Thanks.

You should really consider using brew. It's a great tool that will take care of dependencies, version control and much more.
To install Elasticsearch using brew, simply:
brew update
brew install elasticsearch
Boom! Done.
After that follow Elasticsearch instructions :
To have launchd start Elasticsearch at login:
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
Then to load Elasticsearch now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Or, if you don't want/need launchctl, you can just run:
elasticsearch

As there are not very good instructions for actually "installing" it onto a Mac:
Short Version:
Install Java (prefer latest supported release)
Set JAVA_HOME environment variable.
Download Elasticsearch version (tar or zip).
Extract Elasticsearch from the downloaded file.
Run bin/elasticsearch from the extracted directory.
Long version:
Download Java
Only need the JRE if you will not be writing code on the same machine.
I assume that you are getting the latest JDK, which is currently JDK 8 (as you appear to have, and I have installed working on my machine).
Download and extract Elasticsearch and extract it into some directory.
For example: mkdir -p ~/dev/elasticsearch
Optionally move the downloaded file to there:
mv Downloads/elasticsearch* ~/dev/elasticsearch
Extract the downloaded file:
cd ~/dev/elasticsearch (if you moved it in step 2)
If it's the zip, then unzip elasticsearch-1.1.0.zip (or if you don't want to cd into the directory, then just run unzip elasticsearch-1.1.0.zip -d ~/dev/elasticsearch)
If it's the tar, then tar -xvf elasticsearch-1.1.0.tar.gz (or if you don't want to cd into the directory, then just run tar -xvf elasticsearch-1.1.0.tar.gz -C ~/dev/elasticsearch)
Cleanup (if you want) by removing the downloaded file:
rm elasticsearch-1.1.0.*
Open your .bash_profile file for your bash profile settings:
vi ~/.bash_profile
In the file, export your environment variable(s)
export ES_HOME=~/dev/elasticsearch/elasticsearch-1.1.0
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
export PATH=$ES_HOME/bin:$JAVA_HOME/bin:$PATH
Close and re-open your Terminal OR
Run source ~/.bash_profile to update the environment variables
Run Elasticsearch:
elasticsearch
The more traditional way to run it is to do pretty much all of the above, but not add $ES_HOME/bin to the PATH. Then, just go to ES_PATH (cd $ES_PATH, then bin/elasticsearch) or run $ES_PATH/bin/elasticsearch.
Note: Do not setup your CLASSPATH without a very good reason. The scripts will do that for you.

You should try to using brew with last update:
brew update
And install Cask java:
brew cask install java
After that you can install elasticsearch:
brew install elasticsearch
And to have launched start elasticsearch now use:
brew services start elasticsearch
Or you can just run:
elasticsearch

To update ElasticSearch, just run brew upgrade elasticsearch

Update your java
brew update
brew cask install java
Install it with homebrew
brew install elasticsearch

install gpg &&
install java or jdk
1-Import the repository’s GPG key:
wget -qO - https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
2-this is code repository elasticserach in linux for download
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
3-link download elasticsearch
https://www.elastic.co/downloads/elasticsearch
if error
"Job for elasticsearch.service failed because a timeout was exceeded.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details."
solution:
1-sudo journalctl -f
2-sudo systemctl enable elasticsearch.service
3-sudo systemctl start elasticsearch

Related

nvm with yarn Yarn requires Node.js 4.0 or higher to be installed

I have nvm:
nvm ls
v8.11.3
v8.11.4
-> v11.1.0
default -> 8.11.4 (-> v8.11.4)
node -> stable (-> v11.1.0) (default)
stable -> 11.1 (-> v11.1.0) (default)
I installed yarn with:
sudo apt-get install --no-install-recommends yarn
I also added in .bashrc alias node=nodejs. But when I try yarn install I see:
Yarn requires Node.js 4.0 or higher to be installed.
How can I fix it?
This gist helped on this problem.
Run the following commands
echo "==> Installing Yarn package manager"
rm -rf ~/.yarn
curl -o- -L https://yarnpkg.com/install.sh | bash
# Yarn configurations
export PATH="$HOME/.yarn/bin:$PATH"
yarn config set prefix ~/.yarn -g
And add the following in ~/.bashrc
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
It should then work properly without the warning after restarting the shell.
First uninstall the nodejs package:
sudo apt remove nodejs
Ubuntu 16.04 contains a version of Node.js in its default repositories that can be used to easily provide a consistent experience across multiple systems. At the time of writing, the version in the repositories is v4.2.6. This will not be the latest version, but it should be quite stable and sufficient for quick experimentation with the language.
In order to get this version, we just have to use the apt package manager. We should refresh our local package index first, and then install from the repositories:
sudo apt-get update
sudo apt-get install nodejs
If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you’ll also want to also install npm, which is the Node.js package manager. You can do this by typing:
sudo apt-get install npm
This will allow you to easily install modules and packages to use with Node.js.
Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejs instead of node. Keep this in mind as you are running software.
To check which version of Node.js you have installed after these initial steps, type:
nodejs -v
Screenshot for nodejs version
I just want to mention that my configuration file looked something like that
export PATH=$PATH:`yarn global bin`
#NVM INITIALIZATION STUFF
(yarn docs recommended $PATH)
the export was before my nvm initialization. Which meant node was not available during the runtime of that line. So I just switched my configuration file to be
#NVM INITIALIZATION STUFF
export PATH=$PATH:`yarn global bin`
I had the same issue. by putting nvm path above yarn path didn't solve the issue then I looked up for a solution in man page and solve the issue by setting default node version on a shell.
Current lts version is v14.17.6 so i install it use it and set default node version on a shell.
nvm install --lts
nvm use --lts
nvm alias default <version>
Additional you can set always default to the latest available node version on a shell by running below command.
nvm alias node <version>

Error "Failed to retrieve data from /webhdfs/v1/?op=LISTSTATUS: Server Error" when using hadoop

I opened up localhost:9870 and try to upload a txt file to the hdfs.
I see the error message below
Failed to retrieve data from /webhdfs/v1/?op=LISTSTATUS: Server Error
I had the same issue with JDK 9.
The fix for me was to add this line in hadoop-env.sh
export HADOOP_OPTS="--add-modules java.activation"
Thats because java.activation package is deprecated in Java 9.
I got this to work with OpenJDK 13 by downloading hadoop 2.9.2 and copying the activation-1.1.jar file from that download into the $HADOOP_HOME/share/hadoop/yarn folder you're using for Hadoop 3. Then you have to run stop-dfs.sh and stop-yarn.sh and then start them both again. No need to edit any config files with this method since it will automatically be added to the classpath.
Just solved such a problem, I have multiple java versions and hadoop3.1.0.
you need to specify the java home variable in etc/hadoop/hadoop-env.sh, and the java version should be 1.8.
This occurs due to conflicting versions of Java and OpenJDK installed as a dependency of Homebrew. So it would be nice to uninstall Java. using the commands below
Uninstall java
#!/bin/bash
sudo rm -rvf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
sudo rm -rvf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rvf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rvf /Library/LaunchAgents/com.oracle.java.Java-Updater.plist
sudo rm -rvf /Library/PrivilegedHelperTools/com.oracle.java.JavaUpdateHelper
sudo rm -rvf /Library/LaunchDaemons/com.oracle.java.JavaUpdateHelper.plist
sudo rm -rvf /Library/Preferences/com.oracle.java.Helper-Tool.plist
you can check with [this link][1]
Create symlink to point to Homebrew open JDK dependency
sudo ln -sfn $(brew --prefix)/opt/openjdk#11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
Check for Java path using
$ /usr/libexec/java_home
It generates a path like this
/opt/homebrew/Cellar/openjdk#11/11.0.18/libexec/openjdk.jdk/Contents/Home
update the Hadoop environment file with the OpenJDK path by using this command in the terminal
$cd /opt/homebrew/Cellar/hadoop/3.3.1/libexec/etc/hadoop
$code hadoop-env.sh
update the JAVA_HOME path with the following
export JAVA_HOME=/opt/homebrew/Cellar/openjdk#11/11.0.18/libexec/openjdk.jdk/Contents/Home
Bonus: Check your java path with echo $JAVA_HOME

How could I install Elasticsearch 1.2.1 with homebrew

I need old Elasticsearch for my work. but I couldn't install Elasticsearch 1.2.1 with brew
Development environment
$ brew --version
Homebrew 0.9.5 (git revision 567b; last commit 2015-12-23)
The procedure I tried
I tried the following process
$ brew search elasticsearch
elasticsearch ✔ homebrew/versions/elasticsearch20
homebrew/versions/elasticsearch17 ✔
There is no elasticsearch10.
So, I tracked down this guidance.
Homebrew install specific version of formula?
And typed this command.
$ brew info elasticsearch
elasticsearch: stable 2.1.1, HEAD
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
/usr/local/Cellar/elasticsearch/2.1.1 (52 files, 31M)
Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/elasticsearch.rb
==> Caveats
Data: /usr/local/var/elasticsearch/elasticsearch_kent/
Logs: /usr/local/var/log/elasticsearch/elasticsearch_kent.log
Plugins: /usr/local/Cellar/elasticsearch/2.1.1/libexec/plugins/
Config: /usr/local/etc/elasticsearch/
To have launchd start elasticsearch at login:
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
Then to load elasticsearch now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Or, if you don't want/need launchctl, you can just run:
elasticsearch
And also typed this command, however couldn't find out a key to installing elasticsearch version 1.2.1
$ brew versions elasticsearch
Error: The `versions` command is no longer supported.
You can use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
Or use `brew log` to browse the git history.
I need some help to bridge myself to installing elasticsearch 1.2.1 with brew.
Could you steer my steps?
If you're just trying to do this for local development, then it's probably easier to just download and untar Elasticsearch into a directory.
$ cd /path/to/install/at
$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.2.1.tar.gz
$ tar -xf elasticsearch-1.2.1.tar.gz
$ cd elasticsearch-1.2.1
Once untarred, you can optionally delete the tarball:
$ rm elasticsearch-1.2.1.tar.gz
From there, it's just a matter of configuring (as desired) and starting Elasticsearch.
$ vi config/elasticsearch.yml
$ bin/elasticsearch
Note: Elasticsearch 1.2.1 is an extremely old version. I strongly recommend that you upgrade to a more recent release to gain reliability and security. For example, ES 1.2.1 uses MVEL scripting, which is bad at best.
For your production scenario (after New Years, of course), you can easily perform a rolling restart from ES 1.2.1 to ES 1.7.4 to gain a lot of features and stability without much risk. If you have dedicated master nodes, then I recommend starting with them first to get a few extra benefits upfront.

Using mongodump: "mongodump: command not found"

I'm trying to get a dump of my local database and it seems I should be using:
mongodump --host localhost:3002
However, the terminal then tells me:
-bash: mongodump: command not found
Am I missing something? Or going about this the wrong way? I'm using it on Mac from the terminal.
I installed mongo (I think) using the following commands:
curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.5.tgz > mongodb.tgz
tar -zxvf mongodb.tgz
As of MongoDB 4.4 (released July 30, 2020), you may need to install mongodump separately because the MongoDB Database Tools (which comprises mongodump, mongorestore, and more) has become its own project.
I found this out because I upgraded to MongoDB 4.4 today and mongodump stopped working.
$ mongodump
zsh: command not found: mongodump
I'm on macOS and installed MongoDB via Homebrew. To get mongodump and friends back, I installed the MongoDB Database Tools via Homebrew:
brew tap mongodb/brew
brew install mongodb-database-tools
If you're on a different OS, this should help:
MongoDB Database Tools Installation
brew tap mongodb/brew; brew install mongodb-community
will also install mongodump.
If you don't have the brew command, you really should consider install Homebrew
If you just extracted the .tgz file, the mongodump command is not available in your PATH. Go to your /bin/ subdirectory inside the directory where you have extracted mongodb.tgz, the mongodump binary should be there. Now you can execute:
./mongodump --host localhost:3002
It's much better though to install MongoDB with a package manager. Read this page:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
and use, for example, Homebrew to install MongoDB and have all the necessary binaries in PATH.
brew tap mongodb/brew
brew install mongodb-database-tools
For using mongodump, mongo-tools library has to be installed from os package manager.
It's probably just not in your path, it should be in the same directory as your "mongod", and you can then run it with:
/path/to/bin/mongodump --host localhost:3002
It's in the official MongoDB docs now. For example, to install the 3.2 version:
brew tap mongodb/brew
brew install mongodb-community#3.2
Then follow the steps to update your PATH environment variable.
You have to install mongo-tools to have mongodump.
sudo apt-get install mongo-tools
For Windows Users
You can download the MongoDB Database Tools from here
And you can read the installation guide here

unable to install elasticsearch plugin

I've downloaded elastic search plugin from
https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.0.3-0.18.6.zip
I've unzipped the folder and I know i'm supposed to put the 3 jar files in the lib/ directory (of play itself or of the application I'm creating or that of elasticsearch). but which lib/ directory shall i put it in? also, what shall i do next. i tried to understand the documentation on the website but i didn't.
I'll really appreciate any help as I've been trying for 2 days to install this plugin. I'm using play 1.2.4
Using current homebrew installation (March 2016 -- 2.2.0_1 version) resulted in the plugin executable not being linked, therefore i had to do:
$ ~HOMEBREW_ROOT/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin install mobz/elasticsearch-head
MAC OS - with brew elasticsearch base install
Install the elasticsearch package with brew :
brew install elasticsearch
Install the elasticsearch_head plugin to get a simple browser :
cd /usr/local/Cellar/elasticsearch/1.4.0/
sudo bin/plugin -install mobz/elasticsearch-head
open "http://127.0.0.1:9200/_plugin/head/"
Grab the plugin script path by using this command on Mac OS
brew info elasticsearch
Then, use the plugin script path to install:
/usr/local/Cellar/elasticsearch/2.3.3/libexec/bin/plugin install some/es-plugin
Download elastic search deb file from this link elastic search
and once installed then check elastic search status like sudo service elasticsearch status
To view elastic search index in GUI, run this command from your /usr/share directory
sudo elasticsearch/bin/plugin -install mobz/elasticsearch-head
open "http://localhost:9200/_plugin/head/"
Try the builtin bin/plugin utility:
% bin/plugin -url https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.0.3-0.18.6.zip -install elasticsearch-suggest
-> Installing elasticsearch-suggest...
Trying https://github.com/downloads/spinscale/elasticsearch-suggest-plugin/elasticsearch-suggest-0.0.3-0.18.6.zip...
Downloading ..............................................................................DONE
Installed elasticsearch-suggest
% find plugins/elasticsearch-suggest
plugins/elasticsearch-suggest
plugins/elasticsearch-suggest/elasticsearch-suggest-0.0.3.jar
plugins/elasticsearch-suggest/lucene-misc-3.5.0.jar
plugins/elasticsearch-suggest/lucene-spellchecker-3.5.0.jar
%
In one line:
sudo /usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head
For ElasticSearch 7.10 in Ubuntu:
cd /usr/share/elasticsearch
sudo bin/elasticsearch-plugin install analysis-phonetic

Resources