Orientdb 简明教程
OrientDB - Config Database
在本章中,你可以了解如何通过 OrientDB 命令行显示特定数据库的配置。此命令适用于本地和远程数据库。
In this chapter, you can learn how to display the configuration of a particular database through OrientDB command line. This command is applicable for both local and remote databases.
配置信息包含已启用或未启用的默认缓存、该缓存的大小、负载因子值、映射的最大内存、节点页大小、池的最小和最大大小等。
Configuration information contains default cache either enabled or not, the size of that cache, the load factor value, max memory for map, node page size, pool minimum and maximum size, etc.
以下语句是 config 数据库命令的基本语法。
The following statement is the basic syntax of the config database command.
CONFIG
Note − 您只能在连接到特定数据库后才能使用此命令。
Note − You can use this command only after connecting to a particular database.
Example
在本例中,我们将使用之前章节中创建的同名数据库“demo”。
In this example, we will use the same database named ‘demo’ that we created in the previous chapter.
您可以使用以下命令显示 demo 数据库的配置。
You can use the following command to display the configuration of demo database.
Orientdb {db = demo}> CONFIG
如果已成功执行,你将获得以下输出。
If it is successfully executed, you will get the following output.
LOCAL SERVER CONFIGURATION:
+---------------------------------------+-------------------------+
| NAME | VALUE |
+---------------------------------------+-------------------------+
| environment.dumpCfgAtStartup | false |
| environment.concurrent | true |
| environment.allowJVMShutdown | true |
| script.pool.maxSize | 20 |
| memory.useUnsafe | true |
| memory.directMemory.safeMode | true |
| memory.directMemory.trackMode | false |
|……………………………….. | |
| storage.lowestFreeListBound | 16 |
| network.binary.debug | false |
| network.http.maxLength | 1000000 |
| network.http.charset | utf-8 |
| network.http.jsonResponseError | true |
| network.http.json | false |
| tx.log.fileType | classic |
| tx.log.synch | false |
| tx.autoRetry | 1 |
| client.channel.minPool | 1 |
| storage.keepOpen | true |
| cache.local.enabled | true |
+---------------------------------------+-------------------------+
orientdb {db = demo}>
在以上列出的配置参数中,如果您希望更改任何参数值,可以直接使用命令行轻松地通过 config set 和 get 命令完成。
In the above list of configuration parameters, if you want to change any of the parameter value then you can do it from the command line easily using config set and get command.
Config Set
您可以使用命令更新配置变量的值。
You can update the configuration variable value by using the CONFIG SET command.
以下语句是 config set 命令的基本语法。
The following statement is the basic syntax of the config set command.
CONFIG SET <config-variable> <config-value>
Note − 您只能在连接到特定数据库后才能使用此命令。
Note − You can use this command only after connecting to a particular database.
Example
在本例中,我们将使用之前章节中创建的同名数据库“demo”。我们将把“tx.autoRetry”变量值修改为 5。
In this example, we will use the same database named ‘demo’ that we created in the previous chapter. We will modify the ‘tx.autoRetry’ variable value to 5.
您可以使用以下命令设置 demo 数据库的配置。
You can use the following command to set the configuration of demo database.
orientdb {db = demo}> CONFIG SET tx.autoRetry 5
如果已成功执行,你将获得以下输出。
If it is successfully executed, you will get the following output.
Local configuration value changed correctly
Config Get
您可以使用命令显示配置变量的值。
You can display the configuration variable value by using the CONFIG GET command.
以下语句是 config get 命令的基本语法。
The following statement is the basic syntax of the config get command.
CONFIG GET <config-variable>
Note − 您只能在连接到特定数据库后才能使用此命令。
Note − You can use this command only after connecting to a particular database.
Example
在本例中,我们将使用之前章节中创建的同名数据库“demo”。我们将尝试检索“tx.autoRetry”变量的值。
In this example, we will use the same database named ‘demo’ that we created in the previous chapter. We will try to retrieve the ‘tx.autoRetry’ variable value.
您可以使用以下命令显示 demo 数据库的配置。
You can use the following command to display the configuration of demo database.
orientdb {db = demo}> CONFIG GET tx.autoRetry
如果已成功执行,你将获得以下输出。
If it is successfully executed, you will get the following output.
Local configuration: tx.autoRetry = 5