1. Problem description
1.1 Unable to start via sudo -u presto
-
When using a lower version of Presto, under the root user, use the following command to switch to the presto user and start the Presto service:
sudo -u presto /install_dir/bin/launcher start # 或直接restart,包含stop和start操作 sudo -u presto /install_dir/bin/launcher restart
-
When testing Presto version 0.280, use this method to start the Presto service as usual
-
From the simple startup details, the service starts successfully, and the process number of PrestoServer is 26113
Not running Started as 26113
-
But
jps | grep ”PrestoServer"
when it passed, it was found that there was no corresponding process, that is, the Presto service did not actually start successfully -
At the same time, a line of error log was found in launcher.log
ERROR: [Errno 2] No such file or directory
1.2 Add -v
Get Error Details
-
In the startup command,
-v
options are added to view the error details, and finally the following error message appears in the launcher.log:ERROR: [Errno 2] No such file or directory Traceback (most recent call last): File "install_path/bin/launcher.py", line 449, in main handle_command(command, o) File "install_path/bin/launcher.py", line 332, in handle_command start(process, options) File "install_path/bin/launcher.py", line 286, in start os.execvpe(args[0], args, env) File "/usr/lib64/python2.7/os.py", line 353, in execvpe _execvpe(file, args, env) File "/usr/lib64/python2.7/os.py", line 380, in _execvpe func(fullname, *argrest) OSError: [Errno 2] No such file or directory
-
According to the error stack, read install_path/bin/launcher.py, and finally found that an error may be reported when executing
java -cp ...
the command to start the Presto service['java', '-cp', 'install_path/lib/*', '-server', '-Xmx45G', '-Xms45G', '-XX:+UseG1GC', '-XX:G1HeapRegionSize=32M', '-XX:+UseGCOverheadLimit', '-XX:+ExplicitGCInvokesConcurrent', '-XX:+ExitOnOutOfMemoryError', '-XX:+PrintGCDetails', '-XX:+PrintGCDateStamps', '-Xloggc:/data/presto/var/log/gc.log', '-XX:+UseGCLogFileRotation', '-XX:NumberOfGCLogFiles=8', '-XX:GCLogFileSize=24M', '-XX:+PrintGCApplicationStoppedTime', '-Dlog.output-file=/data/presto/var/log/server.log', '-Dnode.data-dir=/data/presto', '-Dnode.id=worker-10-102-147-2', '-Dnode.environment=production', '-Dlog.enable-console=false', '-Dlog.levels-file=install_path/etc/log.properties', '-Dconfig=install_path/etc/config.properties', 'com.facebook.presto.server.PrestoServer']
-
At the same time, the author found that switching directly to the presto user and then starting the Presto service can be successful
1.3 Missing the real cause
- Although there are similar problems found on the Internet: OSError: [Errno 2] No such file or directory #7879 , Presto's contributor also gave a possible reason
- But the author thinks that there should be no problem with the installation of JDK, because the installation of JDK is installed together with system operation and maintenance when the system is reinstalled
2. Troubleshooting
2.1 Seek help for system operation and maintenance
- Since I am not very familiar with Python, the same startup method did not encounter this problem before, and this is a newly installed physical machine, so I asked my colleagues in system operation and maintenance to help troubleshoot the problem
- After some investigation of the system operation and maintenance, they also suspected that the JDK was installed incorrectly, which resulted in the
java
command not being found when using sudo to start the Presto service - In the end, the system operation and maintenance found out the reason:
java
The JDK service they helped install is purely to simulate the manual installation of JDK, and will not generate soft links for commands in the /usr/bin directory- Although /usr/bin is under secure_path in /etc/sudoers,
java
the command is not - The previous machine can start the service through sudo -u presto because there is
java
a soft link of the command in /usr/bin
- For specific reason analysis, you can refer to the previous blog: How to manage multiple JDK versions on Linux
2.2 Solutions
- Use big data operation and maintenance's own JDK script installation method, specify the JDK version, and
yum install
install JDK 8 by - This installation method will automatically create soft links for various commands in the /usr/bin directory, including
java
,javac
etc.