在 Ubuntu 22.04|20.04|18.04 上安装和配置 OrientDB
在本教程中,我将向您展示如何在 Ubuntu 22.04|20.04|18.04 服务器上安装 OrientDB。 OrientDB是世界领先的用Java编写的开源NoSQL多模型数据库管理系统。它是最通用的 DBMS,在一个多模型产品中支持图形、文档、反应式、全文、地理空间和键值模型。
您可以在分布式(多主)设置中运行 OrientDB,并支持 SQL、ACID 事务、全文索引和反应式查询。要了解 OrientDB 的强大功能,请查看 OrientDB 与 MongoDB 文档数据库对比以及 OrientDB 与 Neo4j 对比流行的图形数据库。
在 Ubuntu 22.04|20.04|18.04 上安装和配置 OrientDB
在本指南中,我们将安装 OrientDB 社区版,该版本可作为二进制包下载。打开 OrientDB 下载页面。
步骤1:安装OrientDB依赖项。
Ubuntu 22.04|20.04|18.04 系统上需要 Java 才能运行 OrientDB 数据库系统。安装如下:
sudo apt update && sudo apt upgrade -y
sudo apt install apt-transport-https default-jdk-headless vim bash-completion
安装wget下载OriendDB安装文件:
sudo apt install vim wget curl
步骤 2:在 Ubuntu 22.04|20.04|18.04 LTS 上安装 OrientDB
安装 wget 后,下载存档文件。检查 Github 版本页面以获取最新版本。
export RELEASE=$(curl -s https://api.github.com/repos/orientechnologies/orientdb/releases/latest|grep tag_name|cut -d '"' -f 4)
wget https://repo1.maven.org/maven2/com/orientechnologies/orientdb-community/$RELEASE/orientdb-community-$RELEASE.tar.gz
解压文件:
tar xvf orientdb-community-$RELEASE.tar.gz
将生成的目录移至 /opt/orientdb
sudo mv orientdb-community-$RELEASE/ /opt/orientdb
添加系统用户来管理orientdb:
sudo groupadd -r orientdb
sudo useradd --system -g orientdb orientdb
sudo chown -R orientdb:orientdb /opt/orientdb
创建根密码:
cd /opt/orientdb/bin/
sudo ./server.sh
示例输出:
+---------------------------------------------------------------+
| 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 Studio 将在以下位置提供:
http://server_ip:2480/studio/index.html
步骤3:配置OrientDB systemd服务
OrientDB 的软件包包含基于 systemd 的发行版的服务描述符文件。 orientdb.service
放置在 bin 目录中。您可以使用locate命令来查找此完整路径:
$ sudo find /opt/orientdb -name orientdb.service
/opt/orientdb/bin/orientdb.service
将服务单元文件复制到 /etc/systemd/system/
目录。
sudo cp /opt/orientdb/bin/orientdb.service /etc/systemd/system/
编辑该文件以设置运行应用程序的用户和组。
sudo vim /etc/systemd/system/orientdb.service
它应该如下所示:
# Copyright (c) OrientDB LTD (http://http://orientdb.com/)
#
[Unit]
Description=OrientDB Server
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=orientdb
Group=orientdb
ExecStart=/opt/orientdb/bin/server.sh
设置数据目录权限:
sudo chown -R orientdb:orientdb /opt/orientdb/
启动orientdb服务:
sudo systemctl daemon-reload
sudo systemctl start orientdb
检查服务状态:
$ systemctl status orientdb
● orientdb.service - OrientDB Server
Loaded: loaded (/etc/systemd/system/orientdb.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2022-10-13 00:20:13 EAT; 32s ago
Main PID: 5399 (java)
Tasks: 23 (limit: 9460)
Memory: 196.8M
CPU: 3.526s
CGroup: /system.slice/orientdb.service
└─5399 /bin/java -server -Xms2G -Xmx2G -Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9 -Djava.util.logging.manager=co>
Oct 13 00:20:18 jammy server.sh[5399]: 2022-10-13 00:20:18:120 INFO DWL:OSystem: block size = 4096 bytes, maximum segment size = 1321 MB [DoubleWriteLogGL]
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:18:858 INFO Storage 'plocal:/opt/orientdb/databases/OSystem' is opened under OrientDB distribution : 3.2.10 (build 2486dd95b4df421b5de9a2e77>
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:545 INFO Listening binary connections on 0.0.0.0:2424 (protocol v.38, socket=default) [OServerNetworkListener]
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:554 INFO Listening http connections on 0.0.0.0:2480 (protocol v.10, socket=default) [OServerNetworkListener]
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:689 INFO Found ORIENTDB_ROOT_PASSWORD variable, using this value as root's password [OServer]
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:705 INFO Installing dynamic plugin 'orientdb-studio-3.2.10.zip'... [OServerPluginManager]
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:710 INFO Installing dynamic plugin 'orientdb-etl-3.2.10.jar'... [OServerPluginManager]
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:733 INFO [OVariableParser.resolveVariables] Property not found: distributed [orientechnologies]
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:757 WARNI Authenticated clients can execute any kind of code into the server by using the following allowed languages: [sql] [OServerSideS>
Oct 13 00:20:19 jammy server.sh[5399]: 2022-10-13 00:20:19:767 INFO OrientDB Studio available at http://192.168.200.8:2480/studio/index.html [OServer]
您的 orientdb 服务现在应该正在运行。使用以下命令打开用户界面:
http://server:2480/studio/index.html
http://192.168.200.8:2480/studio/index.html
使用之前配置的用户名root和密码登录。
感谢您使用我们的指南在 Ubuntu 22.04|20.04|18.04 Linux 系统上安装 OrientDB。
更多指南:
- 使用 Terraform 在 CloudSQL 数据库中创建用户并授予权限
- 学习 MySQL/MariaDB 数据库的最佳书籍