新西兰服务器

Linux系统如何安装OrientDB


Linux系统如何安装OrientDB

发布时间:2022-01-24 11:21:21 来源:高防服务器网 阅读:83 作者:小新 栏目:开发技术

这篇文章将为大家详细讲解有关Linux系统如何安装OrientDB,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

OrientDB简介

OrientDB 是一个多模式的非关系型数据库管理系统。正如开发它的公司所说的“它是一个将图形关系与文档、键值对、反应性、面向对象和地理空间模型结合在一起的可扩展的、高性能的数据库”。

OrientDB 还支持 SQL ,经过扩展可以用来操作树和图。

Linux系统安装

Linux系统安装OrientDB具体步骤:

下载 OrientDB

我们可以从最新的服务端上通过输入下面的指令来下载最新版本的 OrientDB。

 $ wget -O orientdb-community-2.2.22.tar.gz http://orientdb.com/download.php?file=orientdb-community-2.2.22.tar.gz&os=linux

这里下载的是一个包含预编译二进制文件的压缩包,所以我们可以使用 tar 指令来操作解压它:

 $ tar -zxf orientdb-community-2.2.22.tar.gz

将从中提取出来的文件夹整体移动到 /opt:

 # mv orientdb-community-2.2.22 /opt/orientdb

启动 OrientDB 服务器

启动 OrientDB 服务器需要运行 orientdb/bin/ 目录下的 shell 脚本

 # /opt/orientdb/bin/server.sh

如果你是第一次开启 OrientDB 服务器,安装程序还会显示一些提示信息,以及提醒你设置 OrientDB 的 root 用户密码:

 +---------------------------------------------------------------+   | WARNING: FIRST RUN CONFIGURATION |   +---------------------------------------------------------------+   | This is the first time the server is running. Please type a |   | password of your choice for the 'root' user or leave it blank |   | to auto-generate it. |   | |   | To avoid this message set the environment variable or JVM |   | setting ORIENTDB_ROOT_PASSWORD to the root password to use. |   +---------------------------------------------------------------+   Root password [BLANK=auto generate it]: ********   Please confirm the root password: ********

在完成这些后,OrientDB 数据库服务器将成功启动:

 INFO OrientDB Server is active v2.2.22 (build fb2b7d321ea8a5a5b18a82237049804aace9e3de). [OServer]

从现在开始,我们需要用第二个终端来与 OrientDB 服务器进行交互。

若要强制停止 OrientDB 执行 Ctrl+C 即可。

配置守护进程

此时,我们可以认为 OrientDB 仅仅是一串 shell 脚本,可以用编辑器打开 /opt/orientdb/bin/orientdb.sh:

 # $EDITOR /opt/orientdb/bin/orientdb.sh

在它的首段,我们可以看到:

 #!/bin/sh   # OrientDB service script   #   # Copyright (c) OrientDB LTD (http://orientdb.com/)   # chkconfig: 2345 20 80   # description: OrientDb init script   # processname: orientdb.sh   # You have to SET the OrientDB installation directory here   ORIENTDB_DIR="YOUR_ORIENTDB_INSTALLATION_PATH"   ORIENTDB_USER="USER_YOU_WANT_ORIENTDB_RUN_WITH"

我们需要配置ORIENTDB_DIR 以及 ORIENTDB_USER.

然后创建一个用户,例如我们创建一个名为 orientdb 的用户,我们需要输入下面的指令:

 # useradd -r orientdb -s /sbin/nologin

orientdb 就是我们在 ORIENTDB_USER 处输入的用户。

再更改 /opt/orientdb 目录的所有权:

 # chown -R orientdb:orientdb /opt/orientdb

改变服务器配置文件的权限:

 # chmod 640 /opt/orientdb/config/orientdb-server-config.xml

下载系统守护进程服务

OrientDB 的压缩包包含一个服务文件 /opt/orientdb/bin/orientdb.service。我们将其复制到 /etc/systemd/system 文件夹下:

 # cp /opt/orientdb/bin/orientdb.service /etc/systemd/system

编辑该服务文件:

 # $EDITOR /etc/systemd/system/orientdb.service

其中 [service] 内容块看起来应该是这样的:

 [Service]   User=ORIENTDB_USER   Group=ORIENTDB_GROUP   ExecStart=$ORIENTDB_HOME/bin/server.sh

将其改成如下样式:

 [Service]   User=orientdb   Group=orientdb   ExecStart=/opt/orientdb/bin/server.sh

保存并退出。

重新加载系统守护进程:

 # systemctl daemon-reload

启动 OrientDB 并使其开机自启动:

 # systemctl start orientdb   # systemctl enable orientdb

确认 OrientDB 的状态:

 # systemctl status orientdb

上述指令应该会输出:

 ● orientdb.service - OrientDB Server   Loaded: loaded (/etc/systemd/system/orientdb.service; disabled; vendor preset: enabled)   Active: active (running) ...

关于“Linux系统如何安装OrientDB”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

[微信提示:高防服务器能助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

[图文来源于网络,不代表本站立场,如有侵权,请联系高防服务器网删除]
[