Initialization elastricsearch fail

Hi all,

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]

Please help. Thanks

satimis

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.

Hi,

Thanks for your advice.

I'll start another round. I installed Elastricsearch on a VM of VirtualBox. I just clone another VM for the new test.

I ran;
⟫ sudo dpkg -i elasticsearch-0.90.7.deb
to install the package.

Regards
satimis

Again, don't use ES 0.90.7. It's old. Use 1.7.

Yes, I'll download;
⟫ wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.0.deb

satimis

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

Regards
satimis

When using the Debian package, start and stop the service with the init script.

/etc/init.d/elasticsearch start
/etc/init.d/elasticsearch stop

Thanks.

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"?

Thanks

Regards
satimis

What does the error indicate?

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?

Regards
satimis

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.

Hi,

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.

Thanks

Regards
satimis

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.

Hi,

Could you please throw me some light how to start?

On my database, for example:
$ ls Satimis_Data_PC1A_20150606/Satimis_Document_20150606

Bill_n_Conference_20150422           Misc_HepB_HepC_n_Others_20120531_20150423
Cloud_Open_Source_20120902_20131224  Music_Photo_Video_20120531_20150422
ISO_n_Sofware_20100613_20150724      Old_n_New_Documents_20121228_20150606
Linux_Unix_BSD_20100614_20150606     Virtual_Mail_Boxes_Perdition_20120531cp
Misc_Document_20120531_20131220      Windows
Misc_Foods_20120531_20150606

$ ls Satimis_Data_PC1A_20150606/Web_Documents_n_ISP_20130114_20150606/

Finance_20121228_20130831   HKBN_broadband_20150606
Godaddy_20121228_20141231   Hostgator_20130831_20140620
GoPublic_20120531_20131220  Webpage_Design_20160606

etc.

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.

Thanks

Regards
satimis

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.