issue while running elastic search - elasticsearch

org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Unable to initialize modules
Caused by: java.lang.IllegalStateException: Unable to initialize modules
Caused by: java.nio.file.FileSystemException: /Users/NiveditaKumari/Downloads/elasticsearch-5.6.0/modules/.DS_Store/plugin-descriptor.properties: Not a directory
I am not able to run elasticsearch , I am facing above issue

Check all files and folder in modules folder and remove .DS_Store
follow these steps
cd modules
ls -a
rm .DS_Store
You can take this image as reference:

Related

Relative path is not working in soring-boot application.yml

#I am working on windows machine. I have file under test folder and accessing it in application.yml file but it's not working.
FYI: Absolute path for the same is working.
application.yml
jwk-path: ..\test\resources\xyz.json
error:
Caused by: java.io.FileNotFoundException: ..\test\resources\xyz.json (The system cannot find the path specified)
Normally when you run tests from IDE, it will try to load from the "root project". Can you try src/test/resources/xyz.json instead?

NiFi Build Errors

I'm trying to build Apache NiFi after cloning it from https://github.com/apache/nifi and it keeps failing on the tests on the nifi-standard-processors project. I opened up the output file in the surefire-reports directory and there's the below error that it can't run program "cmd" in directory /var/test, because no such file or directory exists. The first time I ran the install it didn't exist, but I created it and I still get the error message. I do a sanity check every time to make sure the directory still does exist. Does anyone have any idea what might be causing this issue? I'm only taking a very few steps to do this. They are posted below. I'm logged on as root on a CentOS Linux VM. Thanks in advance for any help.
Steps:
cd /tmp
git clone https://github.com/apache/nifi
cd nifi
mvn clean install
[main] ERROR org.apache.nifi.processors.standard.ExecuteProcess - ExecuteProcess[id=a8d6b3a3-befa-4b74-a962-330bd021ec7b] Failed to create process due to java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory: java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory
I believe this is due to a recent commit "solving" this ticket[1]. I actually already reopened[2] it due to failures on TravisCI and the contributor is currently working on a fix.
In order to build now, you can tell maven to "skip tests" by running the command with the proper flag: mvn clean install -Dmaven.test.skip=true
[1] https://issues.apache.org/jira/browse/NIFI-2905
[2] https://issues.apache.org/jira/browse/NIFI-2905?focusedCommentId=15603258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15603258

Elasticsearch: Changing data directory on an Amazon Linux Machine

I have installed Elasticsearch on an Amazon Linux Machine using the latest rpm package from their website. After thatt, I have attached an EBS volume and created a directory on this volume. I want this directory to be the data directory of Elasticsearch. So, I started the elasticsearch service first with defaults. I created a new directory in the user ec2-user home directory
mkdir my_data
Then I changed the path.data in the /etc/elasticsearch/elasticsearch.yml file to point to this new directory
path.data: /home/ec2-user/my_data
Then I changed the ownership of this directory:
sudo chown -R elasticsearch:elasticsearch /home/ec2-user/my_data
So, currently the permissions look like this
[ec2-user#ip-XXXXXX ~]$ ls -lrt
total 28632
drwxrwxr-x 2 elasticsearch elasticsearch 4096 Feb 4 06:18 my_data
However, when I try to start elasticsearch, I get the error:
Starting elasticsearch: Exception in thread "main" java.lang.IllegalStateException: Unable to access 'path.data' (/home/ec2-user/my_data)
Likely root cause: java.nio.file.AccessDeniedException: /home/ec2-user/my_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.bootstrap.Security.ensureDirectoryExists(Security.java:337)
at org.elasticsearch.bootstrap.Security.addPath(Security.java:314)
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:256)
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:212)
at org.elasticsearch.bootstrap.Security.configure(Security.java:118)
at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:196)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:167)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
[FAILED]
I found it surprising, but in the latest version of Elasticsearch, if you create a data directory inside home of other user, ES is unable to access it. Though logically it is perfect too. What i suggest that you either mount an external hard disk for elasticsearch or create a data directory inside /home/ on the parallel of ec2-user. so you directory should have a path /home/my-data and it will work like a charm. :)
Thanks ,
Bharvi
In case this helps anyone with the problem that I was seeing...
This seems to be an oddity with java.nio.file.Files.createDirectories. The doc says "Unlike the createDirectory method, an exception is not thrown if the directory could not be created because it already exists." In your case, the folder exists so you should not get an exception. But the check for existence done in UnixFileSystemProvider is via mkdir which will throw an access-denied exception before it throws an already-exists exception. The access-denied exception which you are seeing then is not that elasticsearch doesn't have access to /home/ec2-user/my_data but rather that it doesn't have access to make that directory. So the solution is to fix the permission problem that is preventing elasticsearch from making the directory /home/ec2-user/my_data. For you this would be to make /home/ec2-user writeable by elasticsearch or to create a path like /home/ec2-user/my_data_holder/my_data and then make /home/ec2-user/my_data_holder writeable by elasticsearch.

Elasticsearch crashes when updated data path

Elasticsearch setup works fine with default configurations.
But when updated its path.data setting from elasticsearch.yml file it crashes with below error
[2015-11-19 12:39:56,194][ERROR][bootstrap ] Exception
java.lang.IllegalStateException: Unable to access 'path.data' (/home/hadoop/bigdata/data/elasticsearch)
at org.elasticsearch.bootstrap.Security.addPath(Security.java:197)
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:170)
at org.elasticsearch.bootstrap.Security.configure(Security.java:100)
at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:181)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:159)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Caused by: java.nio.file.AccessDeniedException: /home/hadoop/bigdata/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.checkAccess(UnixFileSystemProvider.java:308)
at java.nio.file.Files.createDirectories(Files.java:702)
at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:218)
at org.elasticsearch.bootstrap.Security.addPath(Security.java:195)
... 6 more
I have copied elasticsearch directory from /var/lib location with preserved mode. But no success.
Can anybody please help me to come out of this error
Thanks,
Sanjay Bhosale
This error is coming because of not setting permissions for user "elasticsearch" to access the folder.
Try making "elasticsearch" user(default user of elasticsearch) the owner of the folder using below commands -
sudo chown elasticsearch: /home/hadoop/bigdata/data/elasticsearch
In addition to ensure that the user elasticsearch is the owner and group of the data folder, the user should also have permission (+x) to traverse each level of the path to the configured data path (in your case, /home/hadoop/bigdata/data/elasticsearch).
That is, if the parent directory of the Elasticsearch path.data is not owned by user elasticsearch (as in your case, the parent folder belongs to user hadoop), then you should check each level of the parent directory, to ensure it be set with o+x permission (with chmod) to guarantee permission to the user elasticsearch (i.e., others).
I have learned this solution from other's question: Elasticsearch cannot open log file: Permission denied.

Jenkins - java.io.IOException: Cannot run program "/usr/local/bin/bash"

I am using Jenkings in Linux_Machine_1. It have around 20 jobs(successfully running jobs)
I copied .jenkins folder to Linux_Machine_2. I started Jenkins in Linux_Machine_2.
I tried to run one of the jobs and I am getting below error:
Started by user anonymous
Building in workspace /home/portaldev/.jenkins/workspace/Trunk_Build
[Trunk_Build] $ /usr/local/bin/bash -xe /tmp/hudson1846171411013031358.sh
FATAL: command execution failed
java.io.IOException: Cannot run program "/usr/local/bin/bash" (in directory "/home/portaldev/.jenkins/workspace/Trunk_Build"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:763)
at hudson.Launcher$ProcStarter.start(Launcher.java:353)
at hudson.Launcher$ProcStarter.join(Launcher.java:360)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:91)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
at hudson.model.Run.execute(Run.java:1576)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:241)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
... 16 more
Build step 'Execute shell' marked build as failure
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
After I created simple job Test_Job (no build scripts) in the Linux_Machine_2. And build, even I am getting same type of error.
I tried by execute permission to all .jenkins folder
chmod +x .jenkings/
Even same out error output.
I run which bash and it gave output /bin/bash.
say ls -l /usr/local/bin/bash on machine 1 to see if there's a symbolic link from /usr/local/bin/bash to /bin/bash. if yes, then create the same link on machine 2:
cd /usr/local/bin
ln -s /bin/bash .

Resources