OrientDB教程

OrientDB 安装

OrientDB 安装文件有两个版本-
社区版-OrientDB 社区版由 Apache 在 0.2 许可下作为开源发布 企业版-OrientDB 企业版是作为专有软件发布的,它建立在社区版的基础上。它是社区版的扩展。
本章讲解OrientDB社区版的安装过程,因为它是开源的。

先决条件

社区版和企业版都可以在任何实现 Java 虚拟机 (JVM) 的操作系统上运行。 OrientDB 需要 Java 1.7 或更高版本。
使用以下步骤将 OrientDB 下载并安装到您的系统中。

步骤 1-下载 OrientDB 二进制设置文件

OrientDB 带有内置的安装文件,用于在您的系统上安装数据库。它为不同的操作系统提供了不同的预编译二进制包(tarred 或压缩包)。您可以从 下载 OrientDB 链接下载 OrientDB 文件。
以下截图显示了 OrientDB 的下载页面。您可以通过单击合适的操作系统图标下载压缩或 tar 文件。
OrientDB 下载页面
下载时,您将在 Downloads 文件夹中获得二进制包。

第 2 步-提取并安装 OrientDB

以下是针对不同操作系统提取和安装 OrientDB 的过程。

在 Linux 中

下载后,您将在 Downloads 文件夹中获得 orientdb-community-2.1.9.tar.gz 文件。您可以使用以下命令来提取 tarred 文件。
$ tar –zxvf orientdb-community-2.1.9.tar.gz 
您可以使用以下命令将所有 OrientDB 库文件从 orientdbcommunity-2.1.9 移动到/opt/orientdb/ 目录。这里我们使用的是超级用户命令(sudo),因此您必须提供超级用户密码才能执行以下命令。
$ sudo mv orientdb-community-2.1.9 /opt/orientdb
您可以使用以下命令注册 orientdb命令和Orient服务器。
$ export ORIENTDB_HoME = /opt/orientdb 
$ export PATH = $PATH:$ORIENTDB_HOME/bin

在 Windows 中

下载后,您将在 Downloads 文件夹中获得 orientdb-community-2.1.9.zip 文件。使用 zip 提取器提取 zip 文件。 将解压后的文件夹移动到 C:\ 目录中。 使用以下给定值创建两个环境变量 ORIENTDB_HOME 和 PATH 变量。
ORIENT_HOME = C:\orientdb-community-2.1.9 
PATH = C:\orientdb-community-2.1.9\bin

步骤 3-将 OrientDB 服务器配置为服务

按照上述步骤,您可以使用 OrientDB 的桌面版本。您可以使用以下步骤将 OrientDB 数据库服务器作为服务启动。该过程会有所不同,具体取决于您的操作系统。

在 Linux 中

OrientDB 提供了一个名为 orientdb.sh 的脚本文件来将数据库作为守护进程运行。您可以在 OrientDB 安装目录的 bin/directory 中找到它,即 $ORIENTDB_HOME/bin/orientdb.sh。
在运行脚本文件之前,您必须编辑 orientdb.sh 文件以定义两个变量。一个是 ORIENTDB_DIR,它定义了安装目录的路径( /opt/orientdb),第二个是 ORIENTDB_USER,它定义了你想要运行的用户名OrientDB 如下。
ORIENTDB_DIR = "/opt/orientdb" 
ORIENTDB_USER = "<username you want to run OrientDB>" 
使用以下命令将 orientdb.sh文件复制到 /etc/init.d/目录中,用于初始化和运行脚本。这里我们使用的是超级用户命令(sudo),因此您必须提供超级用户密码才能执行以下命令。
$ sudo cp $ORIENTDB_HOME/bin/orientdb.sh /etc/init.d/orientdb
使用以下命令将console.sh文件从OrientDB安装目录 $ORIENTDB_HOME/bin复制到系统bin目录 /usr/bin访问东方数据库的控制台。
$ sudo cp $ ORIENTDB_HOME/bin/console.sh /usr/bin/orientdb
使用以下命令启动 ORIENTDB 数据库服务器作为服务。在这里,您必须提供您在 orientdb.sh 文件中提到的相应用户密码才能启动服务器。
$ service orientdb start
使用以下命令了解 OrientDB 服务器守护程序正在运行的 PID。
$ service orientdb status
使用以下命令停止 OrientDB 服务器守护进程。在这里,您必须提供相应用户的密码,您在 orientdb.sh 文件中提到该密码以停止服务器。
$ service orientdb stop

在 Windows 中

OrientDB 是一个服务器应用程序,因此它必须在开始关闭 Java 虚拟机进程之前执行多项任务。如果您想手动关闭 OrientDB 服务器,则必须执行 shutdown.bat 文件。但是服务器实例没有正确停止,当系统突然关闭而不执行上述脚本时。由操作系统用一组指定信号控制的程序在Windows中称为 服务
我们必须使用 Apache Common Daemon,它允许 Windows 用户将 Java 应用程序包装为 Windows 服务。以下是Apache通用守护进程的下载和注册过程。
单击以下链接以获取 适用于 Windows 的 Apache 通用守护程序. 点击common-daemon-1.0.15-bin-windows下载。 解压缩 common-daemon-1.0.15-bin-windows 目录。解压后,您会在目录中找到prunsrv.exeprunmgr.exe 文件。在那些- prunsrv.exe 文件是用于将应用程序作为服务运行的服务应用程序。 prunmgr.exe 文件是用于监控和配置 windows 服务的应用程序。 转到 OrientDB 安装文件夹 → 创建一个新目录并将其命名为 service。 复制 prunsrv.exeprunmgr .exe 将其粘贴到服务目录中。 为了将 OrientDB 配置为 Windows 服务,您必须执行一个使用 prusrv.exe 作为 Windows 服务的简短脚本。 在定义 Windows 服务之前,您必须根据服务的名称重命名 prunsrv 和 prunmgr。例如分别是 OrientDBGraph 和 OrientDBGraphw。这里的 OrientDBGraph 是服务的名称。 将以下脚本复制到名为 installService.bat 的文件中,并将其放入 %ORIENTDB_HOME%\service\ 目录中。
:: OrientDB Windows Service Installation 
@echo off 
rem Remove surrounding quotes from the first parameter 
set str=%~1 
rem Check JVM DLL location parameter 
if "%str%" == "" goto missingJVM 
set JVM_DLL=%str% 
rem Remove surrounding quotes from the second parameter 
set str=%~2 
rem Check OrientDB Home location parameter 
if "%str%" == "" goto missingOrientDBHome 
set ORIENTDB_HOME=%str%  
set CONFIG_FILE=%ORIENTDB_HOME%/config/orientdb-server-config.xml 
set LOG_FILE = %ORIENTDB_HOME%/config/orientdb-server-log.properties 
set LOG_CONSOLE_LEVEL = info 
set LOG_FILE_LEVEL = fine 
set WWW_PATH = %ORIENTDB_HOME%/www 
set ORIENTDB_ENCODING = UTF8 
set ORIENTDB_SETTINGS =-Dprofiler.enabled = true 
-Dcache.level1.enabled = false Dcache.level2.strategy = 1 
set JAVA_OPTS_SCRIPT =-XX:+HeapDumpOnOutOfMemoryError
  
rem Install service 
OrientDBGraphX.X.X.exe //IS--DisplayName="OrientDB GraphEd X.X.X" ^ 
--Description = "OrientDB Graph Edition, aka GraphEd, contains OrientDB server
integrated with the latest release of the TinkerPop Open Source technology 
stack supporting property graph data model." ^ 
--Startclass = com.orientechnologies.orient.server.OServerMain 
-Stopclass = com.orientechnologies.orient.server.OServerShutdownMain ^
 
--Classpath = "%ORIENTDB_HOME%\lib\*"--JvmOptions 
"Dfile.Encoding = %ORIENTDB_ENCODING%; Djava.util.logging.config.file = "%LOG_FILE%";
Dorientdb.config.file = "%CONFIG_FILE%";-Dorientdb.www.path = "%WWW_PATH%";
Dlog.console.level = %LOG_CONSOLE_LEVEL%;-Dlog.file.level = %LOG_FILE_LEVEL%;
Dorientdb.build.number = "@BUILD@";-DORIENTDB_HOME = %ORIENTDB_HOME%" ^ 
--StartMode = jvm--StartPath = "%ORIENTDB_HOME%\bin"--StopMode = jvm 
-StopPath = "%ORIENTDB_HOME%\bin"--Jvm = "%JVM_DLL%" 
-LogPath = "%ORIENTDB_HOME%\log"--Startup = auto  
EXIT /B  
:missingJVM 
echo Insert the JVM DLL location 
goto printUsage 
 
:missingOrientDBHome 
echo Insert the OrientDB Home
goto printUsage 
 
:printUsage 
echo usage: 
echo     installService JVM_DLL_location OrientDB_Home 
EXIT /B 
脚本需要两个参数-
jvm.dll 的位置,例如C:\ProgramFiles\java\jdk1.8.0_66\jre\bin\server\jvm.dll OrientDB 的安装位置,例如C:\orientdb-community-2.1.9 当您执行 OrientDBGraph.exe 文件(原始 prunsrv)并双击它时,就会安装该服务。 使用以下命令将服务安装到 Windows 中。
> Cd %ORIENTDB_HOME%\service 
> installService.bat "C:\Program Files\Java\jdk1.8.0_66\jre\bin\server
   \jvm.dll" C:\orientdb-community-2.1.9 
打开任务管理器服务,可以看到下面的截图,里面有注册的服务名。
任务管理器

步骤 4-验证 OrientDB 安装

此步骤使用以下步骤验证 OrientDB 数据库服务器安装。
运行服务器。 运行控制台。 经营工作室。
根据操作系统,这是唯一的。

在 Linux 中

按照给定的步骤在 Linux 中验证 OrientDB 安装。
运行服务器-您可以使用以下命令启动服务器。
$ cd $ORIENTDB_HOME/bin 
$ ./server.sh 
或者您可以使用以下命令将 OrientDB 服务器作为 UNIX 守护进程启动。
$ service orientdb start 
如果安装成功,您将收到以下输出。
          .                                           
          .`        `                                  
          ,      `:.                                   
         `,`    ,:`                                    
         .,.   :,,                                     
         .,,  ,,,                                      
    .    .,.:::::  ````                                 :::::::::     :::::::::    
    ,`   .::,,,,::.,,,,,,`;;                      .:    ::::::::::    :::    :::   
    `,.  ::,,,,,,,:.,,.`  `                       .:    :::      :::  :::     :::  
     ,,:,:,,,,,,,,::.   `        `         ``     .:    :::      :::  :::     :::  
      ,,:.,,,,,,,,,: `::, ,,   ::,::`   : :,::`  ::::   :::      :::  :::    :::   
       ,:,,,,,,,,,,::,:   ,,  :.    :   ::    :   .:    :::      :::  :::::::      
        :,,,,,,,,,,:,::   ,,  :      :  :     :   .:    :::      :::  :::::::::    
  `     :,,,,,,,,,,:,::,  ,, .::::::::  :     :   .:    :::      :::  :::     :::  
  `,...,,:,,,,,,,,,: .:,. ,, ,,         :     :   .:    :::      :::  :::     ::: 
    .,,,,::,,,,,,,:  `: , ,,  :     `   :     :   .:    :::      :::  :::     :::  
      ...,::,,,,::.. `:  .,,  :,    :   :     :   .:    :::::::::::   :::     :::  
           ,::::,,,. `:   ,,   :::::    :     :   .:    :::::::::     ::::::::::   
           ,,:` `,,.                                   
          ,,,    .,`                                   
         ,,.     `,                                          GRAPH DATABASE   
       ``        `.                                                           
                 ``                                          orientdb.com 
                 `    
         
2016-01-20 19:17:21:547 INFO  OrientDB auto-config DISKCACHE = 1, 
   649MB (heap = 494MB os = 4, 192MB disk = 199, 595MB) [orientechnologies] 
2016-01-20 19:17:21:816 INFO  Loading configuration from:
   /opt/orientdb/config/orientdb-server-config.xml... [OServerConfigurationLoaderXml] 
2016-01-20 19:17:22:213 INFO  OrientDB Server v2.1.9-SNAPSHOT 
   (build 2.1.x@r; 2016-01-07 10:51:24+0000) is starting up... [OServer] 
2016-01-20 19:17:22:220 INFO  Databases directory: /opt/orientdb/databases [OServer] 
2016-01-20 19:17:22:361 INFO  Port 0.0.0.0:2424 busy, 
   trying the next available... [OServerNetworkListener] 
2016-01-20 19:17:22:362 INFO  Listening binary connections on 0.0.0.0:2425 
   (protocol v.32, socket = default) [OServerNetworkListener] 
... 
2016-01-20 19:17:22:614 INFO  Installing Script interpreter. WARN:
   authenticated clients can execute any kind of code into the server 
   by using the following allowed languages: 
   [sql] [OServerSideScriptInterpreter] 
2016-01-20 19:17:22:615 INFO  OrientDB Server v2.1.9-SNAPSHOT 
   (build 2.1.x@r; 2016-01-07 10:51:24+0000) is active. [OServer] 
运行控制台-您可以使用以下命令在控制台下运行 OrientDB。
$ orientdb
如果安装成功,您将收到以下输出。
OrientDB console v.2.1.9-SNAPSHOT (build 2.1.x@r; 2016-01-07 10:51:24+0000) www.orientdb.com 
Type 'help' to display all the supported commands. 
Installing extensions for GREMLIN language v.2.6.0 
 
orientdb>
运行 Studio-启动服务器后,您可以在浏览器上使用以下 URL ( http://localhost:2480/)。您将获得以下屏幕截图。
运行工作室

在 Windows 中

按照给定的步骤在 Windows 中验证 OrientDB 安装。
运行服务器-您可以使用以下命令启动服务器。
> cd %ORIENTDB_HOME%\bin 
> ./server.bat
如果安装成功,您将收到以下输出。
          .                                           
          .`        `                                  
          ,      `:.                                   
         `,`    ,:`                                    
         .,.   :,,    
     .,,  ,,,                                      
    .    .,.:::::  ````                                 :::::::::     :::::::::    
    ,`   .::,,,,::.,,,,,,`;;                      .:    ::::::::::    :::    :::   
    `,.  ::,,,,,,,:.,,.`  `                       .:    :::      :::  :::     :::  
     ,,:,:,,,,,,,,::.   `        `         ``     .:    :::      :::  :::     :::  
      ,,:.,,,,,,,,,: `::, ,,   ::,::`   : :,::`  ::::   :::      :::  :::    :::   
       ,:,,,,,,,,,,::,:   ,,  :.    :   ::    :   .:    :::      :::  :::::::      
        :,,,,,,,,,,:,::   ,,  :      :  :     :   .:    :::      :::  :::::::::    
  `     :,,,,,,,,,,:,::,  ,, .::::::::  :     :   .:    :::      :::  :::     :::  
  `,...,,:,,,,,,,,,: .:,. ,, ,,         :     :   .:    :::      :::  :::     :::  
    .,,,,::,,,,,,,:  `: , ,,  :     `   :     :   .:    :::      :::  :::     :::  
      ...,::,,,,::.. `:  .,,  :,    :   :     :   .:    :::::::::::   :::     :::  
           ,::::,,,. `:   ,,   :::::    :     :   .:    :::::::::     ::::::::::   
           ,,:` `,,.                                   
          ,,,    .,`                                   
         ,,.     `,                                          GRAPH DATABASE   
       ``        `.                                                           
                 ``                                          orientdb.com 
                 `            
         
2016-01-20 19:17:21:547 INFO  OrientDB auto-config DISKCACHE = 1,649MB 
   (heap = 494MB os = 4, 192MB disk = 199, 595MB) [orientechnologies] 
2016-01-20 19:17:21:816 INFO  Loading configuration from: 
   /opt/orientdb/config/orientdb-server-config.xml... 
   [OServerConfigurationLoaderXml] 
... 
2016-01-20 19:17:22:615 INFO  OrientDB Server v2.1.9-SNAPSHOT 
   (build 2.1.x@r; 2016-01-07 10:51:24+0000) is active. [OServer] 
运行控制台-您可以使用以下命令在控制台下运行 OrientDB。
> %ORIENTDB_HOME%\bin\console.bat 
如果安装成功,您将收到以下输出。
OrientDB console v.2.1.9-SNAPSHOT (build 2.1.x@r; 2016-01-07 10:51:24+0000) www.orientdb.com 
Type 'help' to display all the supported commands. 
Installing extensions for GREMLIN language v.2.6.0 
 
orientdb\>
运行 Studio-启动服务器后,您可以在浏览器上使用以下 URL ( http://localhost:2480/)。您将获得以下屏幕截图。
运行工作室
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4