报错信息:
WrapperSimpleApp: Encountered an error running main: java.nio.file.AccessDeniedException: /opt/module/sonar/sonarqube-7.5/temp/conf/es/elasticsearch.yml java.nio.file.AccessDeniedException: /opt/module/sonar/sonarqube-7.5/temp/conf/es/elasticsearch.yml 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.implDelete(UnixFileSystemProvider.java:244) at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) at java.nio.file.Files.delete(Files.java:1126) at org.sonar.process.FileUtils2$DeleteRecursivelyFileVisitor.visitFile(FileUtils2.java:186) at org.sonar.process.FileUtils2$DeleteRecursivelyFileVisitor.visitFile(FileUtils2.java:181) at java.nio.file.Files.walkFileTree(Files.java:2670) at java.nio.file.Files.walkFileTree(Files.java:2742) at org.sonar.process.FileUtils2.deleteDirectoryImpl(FileUtils2.java:143) at org.sonar.process.FileUtils2.deleteDirectory(FileUtils2.java:112) at org.sonar.application.AppFileSystem$CleanTempDirFileVisitor.visitFile(AppFileSystem.java:117) at org.sonar.application.AppFileSystem$CleanTempDirFileVisitor.visitFile(AppFileSystem.java:101) at java.nio.file.Files.walkFileTree(Files.java:2670) at org.sonar.application.AppFileSystem.createOrCleanTempDirectory(AppFileSystem.java:96) at org.sonar.application.AppFileSystem.reset(AppFileSystem.java:62) at org.sonar.application.App.start(App.java:55) at org.sonar.application.App.main(App.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)
sonar集成了es,es启动的时候不能用root账号,所以只能新建其它账号,但是启动的时候不能用sudo,否则es还是起不来,但是正常启动的时候会报权限不足错误。
解决方案,对需要权限的文件针对该账号赋予权限,如下:
使用root用户对sonar用户授权:
chown -R sonar:sonar /opt/module/sonar/sonarqube-7.5