Graphs Directory Configuration#
Overview#
The graphs option in rest-server.properties points to a directory containing one .properties file per graph. Every major server component — GraphManager, InitStore, and StandardAuthenticator — reads this directory through the same shared utility, ConfigUtil.scanGraphsDir().
Default value: ./conf/graphs
Defined in: ServerOptions.GRAPHS
How the Directory Is Scanned#
ConfigUtil.scanGraphsDir(path) is the single entry point for reading the graphs directory:
- Validates and normalizes the path to block traversal attacks.
- Lists all
*.propertiesfiles in the directory. - Strips the
.propertiessuffix to derive each graph's name. - Returns a
Map<graphName, absoluteConfigFilePath>.
Graph names are therefore determined entirely by filename — hugegraph.properties → graph name hugegraph.
Component-by-Component Consumption#
GraphManager (runtime graph loading)#
On startup, GraphManager reads ServerOptions.GRAPHS into this.graphsDir and, when GRAPH_LOAD_FROM_LOCAL_CONFIG is true, calls ConfigUtil.scanGraphsDir() to discover and load all graphs . Each discovered config file is opened via GraphFactory.open() inside loadGraph(), which also injects server-level properties (e.g., RAFT_GROUP_PEERS, PD peers) into the per-graph config before loading.
The directory is rescanned on reload as well , so dropping or adding a .properties file to the directory is picked up without a full JVM restart.
InitStore (backend initialization)#
InitStore.main() accepts conf/rest-server.properties as its sole argument (passed by init-store.sh), then:
- Reads
ServerOptions.GRAPHSfrom the REST config . - Calls
ConfigUtil.scanGraphsDir()to get the full graph→config map . - Opens and initializes each graph's backend store, skipping any
hstore-backed graphs . - Calls
StandardAuthenticator.initAdminUserIfNeeded(restConf)after all backends are ready .
Initialization can be skipped entirely by setting INIT_STORE_ENABLED=false (default true) in rest-server.properties , which is the correct setting for PD/HStore deployments.
StandardAuthenticator (admin bootstrap)#
StandardAuthenticator.setup() calls ConfigUtil.scanGraphsDir(config.get(ServerOptions.GRAPHS)) to locate the authentication graph, identified by ServerOptions.AUTH_GRAPH_STORE (default: "hugegraph"). It then opens that specific graph to read or write user/auth data .
initAdminUserIfNeeded(restConf) is a static bootstrap method called by InitStore (local backends) or GraphManager (PD deployments) to create the built-in admin account on first run.
Shell Script Entry Points#
| Script | Role |
|---|---|
init-store.sh | Invokes InitStore with conf/rest-server.properties |
start-hugegraph.sh | Passes rest-server.properties to hugegraph-server.sh, which forwards it to HugeGraphServerBootstrap |
Both scripts derive the conf/ path relative to their own location — no environment variable override is needed for standard deployments.
Data Flow Diagram#
Key Configuration Options#
| Option | Default | Purpose |
|---|---|---|
graphs | ./conf/graphs | Directory of per-graph .properties files |
init_store_enabled | true | Skip InitStore for PD/HStore deployments |
auth_graph_store | hugegraph | Which graph stores auth data |
graph_load_from_local_config | (see ServerOptions) | Toggle for GraphManager local loading |