I followed;
How To Install Elasticsearch on an Ubuntu VPS
Coming to;
Test your Elasticsearch install
Performed;
⟫ cd /usr/share/elasticsearch/
⟫ sudo chmod u+x ./bin/elasticsearch
⟫ ./bin/elasticsearch
./bin/elasticsearchsatimis@ub1404dkpc1a03:/usr/share/elasticsearch⟫ log4j:WARN No appenders could be found for logger (node).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
{0.90.7}: Initialization Failed ...
ElasticSearchIllegalStateException[Failed to obtain node lock, is the following location writable?: [/usr/share/elasticsearch/data/elasticsearch]]
IOException[failed to obtain lock on /usr/share/elasticsearch/data/elasticsearch/nodes/49]
IOException[Cannot create directory: /usr/share/elasticsearch/data/elasticsearch/nodes/49]
First of all, that tutorial tells you to download ES 0.90.7. That's a really old release. Pick a more recent one instead. IIRC the latest is 1.7.
The error message says that /usr/share/elasticsearch/data/elasticsearch isn't writable to the current user. You can fix that by e.g. running ES as root (not recommended) or changing ownership and/or permissions for the directory in question so that the user you want to run ES as has sufficient permissions.
I wonder how you ended up in this situation in the first place though. Did you unpack the archive as root and attempt to run ES as yourself? If you unpack the archive as yourself that files will automatically have sane permissions.
Have another round on a newly cloned VM. Install elasticsearch-1.7.0.deb
It went through without problem except;
⟫ cd /usr/share/elasticsearch/
⟫ ./bin/elasticsearch
Failed to configure logging...
org.elasticsearch.ElasticsearchException: Failed to load logging configuration
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:92)
at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:131)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:216)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:97)
at java.nio.file.Files.readAttributes(Files.java:1686)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:109)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69)
at java.nio.file.Files.walkFileTree(Files.java:2602)
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:126)
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:126)
... 4 more
log4j:WARN No appenders could be found for logger (node).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
{1.7.0}: Initialization Failed ...
ElasticsearchIllegalStateException[Failed to created node environment]
AccessDeniedException[/usr/share/elasticsearch/data]
org.elasticsearch.ElasticsearchIllegalStateException: Failed to created node environment
at org.elasticsearch.node.internal.InternalNode.(InternalNode.java:167)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:77)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:245)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:383)
at java.nio.file.Files.createDirectory(Files.java:630)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:734)
at java.nio.file.Files.createDirectories(Files.java:720)
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:132)
at org.elasticsearch.node.internal.InternalNode.(InternalNode.java:165)
... 4 more
Other steps went through without problem same as described on that article
Previously running;
⟫ cd /usr/share/elasticsearch/
⟫ ./bin/elasticsearch
Failed to configure logging...
org.elasticsearch.ElasticsearchException: Failed to load logging configuration
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:92)
at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:131)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:216)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: java.nio.file.NoSuchFileException: /usr/share
.....
....
What does the error indicate?
Where can I find tutorial and examples on using "Elasticsearch"?
The Debian package is installed with a directory layout that isn't compatible with the way of starting ES that you've tried. Use the init script as I described earlier.
Where can I find tutorial and examples on using "Elasticsearch"?
Have you read the documentation available at elastic.co?
Thanks for your advice and link. I found them before but haven't gone through them in detail. Also before posting I have been searching a while on Internet and found many documentations, such as;
10 Minute Walk Through
ElasticSearch in 5 minutes
Discover the ElasticSearch search engine - First-time Visitors
Uses of Elasticsearch, and Things to Learn
etc. including many video on Youtube
As a beginner I hesitate where shall I start first after installing Elasticsearch? avoiding going to the wrong direction. What will be the typical application of ES?
ES is used for a lot of things, including full-text search of blog, newspaper articles, source code, and logs. Presumably you had some kind of idea of what you wanted to do with ES when you started looking into it.
Yes, I have data in my computer built in past years and they are continue to increase daily. The data are documentation which I used for building websites, new computers, use on applications/software which I leant and used previously etc. How can I use ES to search those data to find out what I need? Rather than screening directory to directory reading the tiles on files retained in each directory etc. This will be my first start using ES.
There are of course already lots of programs for indexing and searching data in local files so I'm assuming you want to use ES as a learning exercise and/or have something to hack on.
You'd have to write a program that scans your local disk, extracts text and other relevant information from the files you find (Apache Tika can help you with that), and posts the text to ES together with information about the path to the file from which the text was extracted.
Under above directories there are subdirectories. Most the files under them are .txt files and some .pdf files. Besides I couldn't forecast what will be searched in future.
So... write a program that traverses these directories and locates files, collects the text content of them (using e.g. Apache Tika to process the PDFs) and post each file as a document to ES. I don't know what else to describe without writing the code for you.
I wouldn't be terribly surprised if someone has already done something very similar.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.