Skip to content
Permalink
Browse files
Move auth-related config options to Server & API region
Change-Id: I735663c4b4960a107f4af6991111d6b583314cd4
  • Loading branch information
Linary authored and javeme committed Nov 22, 2018
1 parent 6d2eb22 commit f1bd3eb0d81bade9df0fabc2a2e078bc2bb32fcf
Showing 4 changed files with 74 additions and 39 deletions.
@@ -69,6 +69,8 @@ System.out.println(">>>> query all edges: size=" + g.E().toList().size());

其实这一段groovy脚本几乎就是Java代码,不同之处仅在于变量的定义可以不写类型声明,以及每一行末尾的分号可以去掉。

> g.V() 是获取所有的顶点,g.E() 是获取所有的边,toList() 是把结果存到一个 List 中,参考[TinkerPop Terminal Steps](http://tinkerpop.apache.org/docs/current/reference/#terminal-steps)。
下面进入gremlin-console,并传入该脚本令其执行:

```bash
@@ -299,4 +301,4 @@ gremlin> :> @script
==>6
```

更多关于gremlin-console的使用,请参考[Tinkerpop官网](http://tinkerpop.apache.org/docs/current/reference/)
更多关于gremlin-console的使用,请参考[Tinkerpop官网](http://tinkerpop.apache.org/docs/current/reference/)
@@ -1,42 +1,67 @@
## HugeGraph 配置项

### Gremlin Server 配置项

config option | default value | descrition
---------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------
host | 127.0.0.1 | The host or ip of Gremlin Server.
port | 8182 | The listening port of Gremlin Server.
scriptEvaluationTimeout | 30000 | The timeout for gremlin script execution(millisecond).
channelizer | org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer | Indicates the protocol which the Gremlin Server provides service.
graphs | hugegraph: conf/hugegraph.properties | The map of graphs with name and config file path.
authentication | authenticator: com.baidu.hugegraph.auth.StandardAuthenticator, config: {tokens: conf/rest-server.properties} | The authenticator and config(contains tokens path) of authentication mechanism

> 对应配置文件`gremlin-server.yaml`
### Rest Server & API 配置项

config option | default value | descrition
---------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------
restserver.url | http://127.0.0.1:8080 | The url for listening of rest-api server.
graphs | [hugegraph:conf/hugegraph.properties] | The map of graphs' name and config file.
gremlinserver.url | http://127.0.0.1:8182 | The url used to connect gremlin server from rest-api server.
batch.max_edges_per_batch | 500 | The maximum number of edges submitted per batch.
batch.max_vertices_per_batch | 500 | The maximum number of vertices submitted per batch.
batch.max_write_ratio | 50 | The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0.
batch.max_write_threads | 0 | The maximum threads for batch writing, if the value is 0, the actual value will be set to batch.max_write_ratio * total-rest-threads.
exception.allow_trace | false | Whether to allow exception trace stack.
auth.authenticator | | The class path of authenticator implemention. e.g., com.baidu.hugegraph.auth.StandardAuthenticator
auth.admin_token | 162f7848-0b6d-4faf-b557-3a0797869c55 | Token for administrator operations.
auth.user_tokens | [hugegraph:9fd95c9c-711b-415b-b85f-d4df46ba5c31] | The map of user tokens with name and password.

> 对应配置文件`rest-server.properties`
### 基本配置项

config option | default value | descrition
--------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------
backend | rocksdb | The data store type, available values are [memory, rocksdb, cassandra, scylladb, mysql]
serializer | binary | The serializer for backend store, available values are [text, binary, cassandra, mysql]
store | hugegraph | The database name like Cassandra Keyspace.
store.graph | graph | The graph table name, which store vertex, edge and property.
store.schema | schema | The schema table name, which store meta data.
vertex.default_label | vertex | The default vertex label.
vertex.tx_capacity | 10000 | The max size(items) of vertices(uncommitted) in transaction.
edge.tx_capacity | 10000 | The max size(items) of edges(uncommitted) in transaction.
graph.cache_capacity | 10485760 | The max cache size(items) of graph data(vertex/edge).
graph.cache_expire | 600 | The expire time in seconds of graph data(vertex/edge).
gremlin.graph | com.baidu.hugegraph.HugeFactory | Gremlin entrence to create graph.
schema.cache_capacity | 1048576 | The max cache size(items) of schema data.
schema.illegal_name_regex | .*\s+$|~.* | The regex specified the illegal format for schema name.
snowflake.datecenter_id | 0 | The datacenter id of snowflake id generator.
snowflake.force_string | false | Whether to force the snowflake long id to be a string.
snowflake.worker_id | 0 | The worker id of snowflake id generator.
rate_limit | 0 | The max rate(items/s) to add/update/delete vertices/edges.
auth.admin_token | 162f7848-0b6d-4faf-b557-3a0797869c55 | Token for administrator operations.
auth.require_authentication | false | Whether to enable authentication.
auth.user_tokens | [hugegraph:9fd95c9c-711b-415b-b85f-d4df46ba5c31] | The map of user tokens with name and password.

### API 配置项

config option | default value | descrition
---------------------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------
restserver.url | http://127.0.0.1:8080 | The url for listening of rest-api server.
graphs | [hugegraph:conf/hugegraph.properties] | The map of graphs' name and config file.
gremlinserver.url | http://127.0.0.1:8182 | The url of gremlin server.
batch.max_edges_per_batch | 500 | The maximum number of edges submitted per batch.
batch.max_vertices_per_batch | 500 | The maximum number of vertices submitted per batch.
batch.max_write_ratio | 50 | The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0.
batch.max_write_threads | 0 | The maximum threads for batch writing, if the value is 0, the actual value will be set to batch.max_write_ratio * total-rest-threads.
exception.allow_trace | false | Whether to allow exception trace stack.
config option | default value | descrition
-------------------------------- | ------------------------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
backend | rocksdb | The data store type, available values are [memory, rocksdb, cassandra, scylladb, hbase, mysql]
serializer | binary | The serializer for backend store, available values are [text, binary, cassandra, hbase, mysql]
store | hugegraph | The database name like Cassandra Keyspace.
store.graph | graph | The graph table name, which store vertex, edge and property.
store.schema | schema | The schema table name, which store meta data.
store.system | system | The system table name, which store system data.
vertex.default_label | vertex | The default vertex label.
vertex.check_customzied_id_exist | true | Whether to check the vertices exist for those using customized id strategy
vertex.tx_capacity | 10000 | The max size(items) of vertices(uncommitted) in transaction.
vertex.cache_capacity | 10000000 | The max cache size(items) of vertex cache.
vertex.cache_expire | 600 | The expire time in seconds of vertex cache.
edge.tx_capacity | 10000 | The max size(items) of edges(uncommitted) in transaction.
edge.cache_capacity | 1000000 | The max cache size(items) of edge cache.
edge.cache_expire | 600 | The expire time in seconds of edge cache.
gremlin.graph | com.baidu.hugegraph.HugeFactory | Gremlin entrence to create graph.
schema.cache_capacity | 100000 | The max cache size(items) of schema data.
schema.illegal_name_regex | .*\s+$|~.* | The regex specified the illegal format for schema name.
schema.sync_deletion | false | Whether to delete schema synchronously.
task.wait_timeout | 10 | Timeout in seconds for waiting for the task to complete,such as when truncating or clearing the backend.
search.text_analyzer | ikanalyzer | Choose a text analyzer for searching the vertex/edge properties, available type are [word, ansj, hanlp, smartcn, jieba, jcseg, mmseg4j, ikanalyzer]
search.text_analyzer_mode | smart | Specify the mode for the text analyzer, the available mode of analyzer are {word: [MaximumMatching, ReverseMaximumMatching, MinimumMatching, ReverseMinimumMatching, BidirectionalMaximumMatching, BidirectionalMinimumMatching, BidirectionalMaximumMinimumMatching, FullSegmentation, MinimalWordCount, MaxNgramScore, PureEnglish], ansj: [BaseAnalysis, IndexAnalysis, ToAnalysis, NlpAnalysis], hanlp: [standard, nlp, index, nShort, shortest, speed], smartcn: [], jieba: [SEARCH, INDEX], jcseg: [Simple, Complex], mmseg4j: [Simple, Complex, MaxWord], ikanalyzer: [smart, max_word]}
snowflake.datecenter_id | 0 | The datacenter id of snowflake id generator.
snowflake.force_string | false | Whether to force the snowflake long id to be a string.
snowflake.worker_id | 0 | The worker id of snowflake id generator.
rate_limit | 0 | The max rate(items/s) to add/update/delete vertices/edges.

> 基本配置项及后端配置项对应配置文件:{graph-name}.properties,如`hugegraph.properties`
### Cassandra & ScyllaDB 后端配置项

@@ -51,6 +76,7 @@ cassandra.keyspace.replication | 3 | The keyspace replication facto
cassandra.username | | The username to use to login to cassandra cluster.
cassandra.password | | The password corresponding to cassandra.username.
cassandra.compression_type | none | The compression algorithm of cassandra transport: none/snappy/lz4.
cassandra.jmx_port=7199 | 7199 | The port of JMX API service for cassandra.

### RocksDB 后端配置项

@@ -84,6 +110,13 @@ rocksdb.use_direct_reads | false | Enable the OS t
rocksdb.wal_path | rocksdb-data | The path for storing WAL of RocksDB.
rocksdb.write_buffer_size | 134217728 | Amount of data in bytes to build up in memory.

### HBase 后端配置项

config option | default value | descrition
------------------------ | --------------------------- | -------------------------------------------------------------------------------
hbase.hosts | localhost | The hostname or ip address of HBase zookeeper.
hbase.port | 2181 | The port address of HBase zookeeper.

### MySQL 后端配置项

config option | default value | descrition
@@ -330,4 +330,4 @@ public class BatchExample {

### 4.5 Example示例说明

示例说明见[HugeGraph-Client基本API介绍](/clients/hugegraph-client.html)
示例说明见[HugeGraph-Client基本API介绍](/clients/hugegraph-client.md)
@@ -138,9 +138,9 @@ graph.schema().propertyKey("price").asInt().ifNotExist().create()
**在这里有几点需要说明**

1、上述语句是`groovy`语言形式(类似但不是`java`)的`gremlin`语句,这些`gremlin`语句会被发送到`HugeGraphServer`上执行。
关于`gremlin`本身可以参考[Gremlin Query Language](/language/hugegraph-gremlin.html)或[Tinkerpop官网](http://tinkerpop.apache.org/);
关于`gremlin`本身可以参考[Gremlin Query Language](/language/hugegraph-gremlin.md)或[Tinkerpop官网](http://tinkerpop.apache.org/);

2、上述语句是通过`graph.schema()`获取到`SchemaManager`对象后操作元数据,通过`gremlin`语句操作Schema可参考文档[HugeGraph-Client](/clients/hugegraph-client.html),
2、上述语句是通过`graph.schema()`获取到`SchemaManager`对象后操作元数据,通过`gremlin`语句操作Schema可参考文档[HugeGraph-Client](/clients/hugegraph-client.md),
需要注意的是`HugeGraph-Client``java`语法,大体上与`gremlin`风格是一致的,具体的差异见文档`HugeGraph-Client`中的说明。

3、在`HugeGraph-Studio`的输入框中,用户可以直接使用两个变量`graph``g`,其中`graph`就是当前连接的图对象,可使用该对象对图做各种增删改查操作;

0 comments on commit f1bd3eb

Please sign in to comment.