.
What is the OrientDB Console?
Sonatype Nexus Repository 3 (NXRM) can use several OrientDB databases. In very specific circumstances, these databases can be manipulated as advised by Sonatype Support.
This article describes how to open a special command-line interface for connecting to and working with the databases used by Nexus. This interface is known as the OrientDB Console.
Caution: Using the console incorrectly can cause irreparable harm to the databases.
Launching the OrientDB Console on Nexus Repository 3.2.1 and Newer
NXRM 3.2.1+ includes a single jar executable which can launch the OrientDB console.
Ensure the NXRM process has been gracefully stopped before connecting to the database using the console. Failure to ensure only a single process is accessing the database at once may result in irreparable harm to the database.
- As the operating system user account that owns the running Sonatype Nexus Repository process, start a terminal session on the host where Sonatype Nexus Repository is installed.
-
Change directories to a directory where the OS user has file write permission. A location that should have this write access is the data directory.
-
Launch the console using the same version of Java executable that Nexus is using, referencing the jar file that is included under your application directory:
Example: If an environment variable named NEXUS_HOME happened to contain the path to your application directory, then the command to launch would be:Unix
java -jar $NEXUS_HOME/lib/support/nexus-orient-console.jar
Windows
java -jar %NEXUS_HOME%\lib\support\nexus-orient-console.jar
Mac
$NEXUS_HOME/.install4j/jre.bundle/Contents/Home/jre/bin/java -jar $NEXUS_HOME/lib/support/nexus-orient-console.jar
You should be presented with a command-line interface such as this, ready to accept your commands:
OrientDB console v.2.2.16 www.orientdb.com Type 'help' to display all the supported commands. orientdb>
- When you are done your commands, type
exit
to quit the console.
Accessing the OrientDB Console in a Docker Container
If you normally run Nexus Repository in a Docker container with something like the following:
docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3
Then you should be able to get access to the shell as follows:
docker run -it -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3 /bin/bash
This is basically just running the same container with the same volume arguments but in interactive mode and telling it to start the shell instead of NXRM.
Once at a terminal in the container, it is recommended to cd /nexus-data
first, before launching the orientdb console, because this is one of few locations where the 'nexus' container OS user will have write access in the container.
Error creating history file Permission denied launching Orient Console
If the OrientDB Console is launched while in a directory where the OS user does not have write permission, OrientDB may fail to launch and trigger the following error:
Error creating history file
java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1023)
at com.orientechnologies.common.console.TTYConsoleReader.getHistoryFile(TTYConsoleReader.java:554)
at com.orientechnologies.common.console.TTYConsoleReader.<init>(TTYConsoleReader.java:89)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.main(OConsoleDatabaseApp.java:143)
at org.sonatype.nexus.orient.console.Main.main(Main.java:63)
History file not found
java.io.FileNotFoundException: .orientdb_history (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileReader.<init>(FileReader.java:72)
at com.orientechnologies.common.console.TTYConsoleReader.<init>(TTYConsoleReader.java:92)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.main(OConsoleDatabaseApp.java:143)
at org.sonatype.nexus.orient.console.Main.main(Main.java:63)
Exception in thread "main" com.orientechnologies.common.exception.OSystemException: Cannot access to the input stream. Check permissions of running process
at com.orientechnologies.common.console.TTYConsoleReader.<init>(TTYConsoleReader.java:112)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.main(OConsoleDatabaseApp.java:143)
at org.sonatype.nexus.orient.console.Main.main(Main.java:63)
Solution
First change to a directory where your user can successfully create a .orientdb_history file, then launch the OrientDB console.