From 6ef10893e498f730bf4b70cbd8a0588ce43ae168 Mon Sep 17 00:00:00 2001 From: bitflicker64 Date: Sun, 15 Feb 2026 18:06:20 +0530 Subject: [PATCH 1/6] docker: migrate from host to bridge networking Replace network_mode: host with explicit port mappings and add configuration volumes for PD, Store, and Server services to support macOS/Windows Docker. - Remove host network mode from all services - Add explicit port mappings (8620, 8520, 8080) - Add configuration directories with volume mounts - Update healthcheck endpoints - Add PD peers environment variable Enables HugeGraph cluster to run on all Docker platforms. --- docker/docker-compose.yml | 19 ++- docker/pd-conf/application.yml | 72 +++++++++ docker/pd-conf/application.yml.template | 72 +++++++++ docker/pd-conf/log4j2.xml | 135 ++++++++++++++++ docker/pd-conf/verify-license.json | 6 + docker/server-conf/computer.yaml | 39 +++++ .../server-conf/graphs/hugegraph.properties | 11 ++ .../server-conf/gremlin-driver-settings.yaml | 25 +++ docker/server-conf/gremlin-server.yaml | 127 +++++++++++++++ docker/server-conf/log4j2.xml | 144 ++++++++++++++++++ docker/server-conf/remote-objects.yaml | 29 ++++ docker/server-conf/remote.yaml | 25 +++ docker/server-conf/rest-server.properties | 60 ++++++++ docker/store-conf/application-pd.yml | 34 +++++ docker/store-conf/application.yml | 32 ++++ docker/store-conf/log4j2.xml | 137 +++++++++++++++++ 16 files changed, 963 insertions(+), 4 deletions(-) create mode 100644 docker/pd-conf/application.yml create mode 100644 docker/pd-conf/application.yml.template create mode 100644 docker/pd-conf/log4j2.xml create mode 100644 docker/pd-conf/verify-license.json create mode 100644 docker/server-conf/computer.yaml create mode 100644 docker/server-conf/graphs/hugegraph.properties create mode 100644 docker/server-conf/gremlin-driver-settings.yaml create mode 100644 docker/server-conf/gremlin-server.yaml create mode 100644 docker/server-conf/log4j2.xml create mode 100644 docker/server-conf/remote-objects.yaml create mode 100644 docker/server-conf/remote.yaml create mode 100644 docker/server-conf/rest-server.properties create mode 100644 docker/store-conf/application-pd.yml create mode 100644 docker/store-conf/application.yml create mode 100644 docker/store-conf/log4j2.xml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 0c90c1e451..efc26862ad 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -22,18 +22,22 @@ services: image: hugegraph/pd container_name: pd hostname: pd - network_mode: host + ports: + - "8620:8620" healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8620"] + test: ["CMD", "curl", "-f", "http://localhost:8620/v1/health"] interval: 10s timeout: 5s retries: 3 + volumes: + - ./pd-conf:/hugegraph-pd/conf store: image: hugegraph/store container_name: store hostname: store - network_mode: host + ports: + - "8520:8520" depends_on: pd: condition: service_healthy @@ -42,12 +46,17 @@ services: interval: 10s timeout: 5s retries: 3 + volumes: + - ./store-conf/application.yml:/hugegraph-store/conf/application.yml server: image: hugegraph/server container_name: server hostname: server - network_mode: host + ports: + - "8080:8080" + environment: + - hugegraph.pd.peers=pd:8686 depends_on: store: condition: service_healthy @@ -56,3 +65,5 @@ services: interval: 10s timeout: 5s retries: 3 + volumes: + - ./server-conf:/hugegraph-server/conf diff --git a/docker/pd-conf/application.yml b/docker/pd-conf/application.yml new file mode 100644 index 0000000000..81115d5dac --- /dev/null +++ b/docker/pd-conf/application.yml @@ -0,0 +1,72 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +logging: + config: 'file:./conf/log4j2.xml' +# TODO: handle the license file later (PDConfig) +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8686 + host: pd + +server: + # REST service port number + port: 8620 + +pd: + data-path: ./pd_data + patrol-interval: 1800 + initial-store-count: 1 + initial-store-list: store:8500 + +raft: + address: pd:8610 + peers-list: pd:8610 + +store: + # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds + max-down-time: 172800 + # Specifies whether to enable store monitoring data storage + monitor_data_enabled: true + # The interval between monitoring data, minute, hour, second + # default: 1 min * 1 day = 1440 + monitor_data_interval: 1 minute + # Retention time of monitoring data is 1 day; day, month, year + monitor_data_retention: 1 day + +partition: + # Default number of replicas per partition + default-shard-count: 1 + # The default maximum number of replicas per machine + # the initial number of partitions= store-max-shard-count * store-number / default-shard-count + store-max-shard-count: 12 diff --git a/docker/pd-conf/application.yml.template b/docker/pd-conf/application.yml.template new file mode 100644 index 0000000000..8b8f0d63c5 --- /dev/null +++ b/docker/pd-conf/application.yml.template @@ -0,0 +1,72 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd +logging: + config: file:./conf/log4j2.xml + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + port: $GRPC_PORT$ + # grpc's service address, + # Note: You need to change to the local actual Iv 4 address when deploying. + host: $GRPC_HOST$ + netty-server: + max-inbound-message-size: 100MB + +server: + port : $SERVER_PORT$ + +pd: + # Cluster ID: to distinguish different PD clusters + + patrol-interval: 2147483647 + data-path: $PD_DATA_PATH$ + +raft: + address: $RAFT_ADDRESS$ + # raft cluster + peers-list: $RAFT_PEERS_LIST$ + # The interval between snapshot generation, in seconds + snapshotInterval: 300 + metrics: true +store: + # If the store heartbeat timeout period exceeds this time, the store is temporarily unavailable and the leader is transferred to another replica in seconds + keepAlive-timeout: 60 + # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds + max-down-time: 1800 +partition: + # The default total number of partitions + default-total-count: 30 + # Default number of replicas per partition + default-shard-count: 3 + +discovery: + # After the client registers, the maximum number of heartbeats is not reached, and after that, the + previous registration information will be deleted + heartbeat-try-count: 3 diff --git a/docker/pd-conf/log4j2.xml b/docker/pd-conf/log4j2.xml new file mode 100644 index 0000000000..a804948703 --- /dev/null +++ b/docker/pd-conf/log4j2.xml @@ -0,0 +1,135 @@ + + + + + + + + logs + hugegraph-pd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/pd-conf/verify-license.json b/docker/pd-conf/verify-license.json new file mode 100644 index 0000000000..868ccbebbb --- /dev/null +++ b/docker/pd-conf/verify-license.json @@ -0,0 +1,6 @@ +{ + "subject": "hugegraph-license", + "public_alias": "publiccert", + "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", + "publickey_path": "/public-certs.store" +} diff --git a/docker/server-conf/computer.yaml b/docker/server-conf/computer.yaml new file mode 100644 index 0000000000..a3274ec761 --- /dev/null +++ b/docker/server-conf/computer.yaml @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# common parameters +common: { + worker_heap: 10000, + vertex_input_dir: /data, + workers: 51, + zookeeper_list: "127.0.0.1:2181", + max_edges_per_segment: 10485760, + edges_immutable: true, + partitions: 255, + compute_threads: 5, + input_threads: 5, + message_async: false, + message_queue_size: 1000, + message_send_threads: 10, + messages_per_segment: 104857600, + hugegraph_url: "http://server:8080", + hugegraph_name: hugegraph, + hugegraph_timeout: 60 +} + +env: { + computer_home: /home/computer +} diff --git a/docker/server-conf/graphs/hugegraph.properties b/docker/server-conf/graphs/hugegraph.properties new file mode 100644 index 0000000000..d21d462046 --- /dev/null +++ b/docker/server-conf/graphs/hugegraph.properties @@ -0,0 +1,11 @@ +gremlin.graph=org.apache.hugegraph.HugeFactory +backend=hstore +serializer=binary +store=hugegraph +pd.peers=pd:8686 +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 +search.text_analyzer=jieba +search.text_analyzer_mode=INDEX diff --git a/docker/server-conf/gremlin-driver-settings.yaml b/docker/server-conf/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..7ef456e5b0 --- /dev/null +++ b/docker/server-conf/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [server] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/server-conf/gremlin-server.yaml b/docker/server-conf/gremlin-server.yaml new file mode 100644 index 0000000000..32135163fd --- /dev/null +++ b/docker/server-conf/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +#host: 127.0.0.1 +#port: 8182 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/docker/server-conf/log4j2.xml b/docker/server-conf/log4j2.xml new file mode 100644 index 0000000000..f1dd7e8395 --- /dev/null +++ b/docker/server-conf/log4j2.xml @@ -0,0 +1,144 @@ + + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/server-conf/remote-objects.yaml b/docker/server-conf/remote-objects.yaml new file mode 100644 index 0000000000..c3b59ff5da --- /dev/null +++ b/docker/server-conf/remote-objects.yaml @@ -0,0 +1,29 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [server] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} + diff --git a/docker/server-conf/remote.yaml b/docker/server-conf/remote.yaml new file mode 100644 index 0000000000..7ef456e5b0 --- /dev/null +++ b/docker/server-conf/remote.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [server] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/server-conf/rest-server.properties b/docker/server-conf/rest-server.properties new file mode 100644 index 0000000000..235b19336d --- /dev/null +++ b/docker/server-conf/rest-server.properties @@ -0,0 +1,60 @@ +# bind url +# could use '0.0.0.0' or specified (real)IP to expose external network access +restserver.url=http://0.0.0.0:8080 +#restserver.enable_graphspaces_filter=false +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +#gremlinserver.url=http://127.0.0.1:8182 + +graphs=./conf/graphs + +# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 +batch.max_write_ratio=80 +batch.max_write_threads=0 + +# configuration of arthas +arthas.telnet_port=8562 +arthas.http_port=8561 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# for StandardAuthenticator mode +#auth.graph_store=hugegraph +# auth client config +#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 + +# for ConfigAuthenticator mode +#auth.admin_token= +#auth.user_tokens=[] + +# TODO: Deprecated & removed later (useless from version 1.5.0) +# rpc server configs for multi graph-servers or raft-servers +#rpc.server_host=127.0.0.1 +#rpc.server_port=8091 +#rpc.server_timeout=30 + +# rpc client configs (like enable to keep cache consistency) +#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash + +# raft group initial peers +#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 + +# lightweight load balancing (beta) +server.id=server-1 +server.role=master + +# slow query log +log.slow_query_threshold=1000 + +# jvm(in-heap) memory usage monitor, set 1 to disable it +memory_monitor.threshold=0.85 +memory_monitor.period=2000 diff --git a/docker/store-conf/application-pd.yml b/docker/store-conf/application-pd.yml new file mode 100644 index 0000000000..0315c4b4fe --- /dev/null +++ b/docker/store-conf/application-pd.yml @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +rocksdb: + # rocksdb total memory usage, force flush to disk when reaching this value + total_memory_size: 32000000000 + # memtable size used by rocksdb + write_buffer_size: 32000000 + # For each rocksdb, the number of memtables reaches this value for writing to disk. + min_write_buffer_number_to_merge: 16 diff --git a/docker/store-conf/application.yml b/docker/store-conf/application.yml new file mode 100644 index 0000000000..d0585912c7 --- /dev/null +++ b/docker/store-conf/application.yml @@ -0,0 +1,32 @@ +pdserver: + address: pd:8686 + +grpc: + host: store + port: 8500 + netty-server: + max-inbound-message-size: 1000MB + +raft: + disruptorBufferSize: 1024 + address: store:8510 + max-log-file-size: 600000000000 + snapshotInterval: 1800 + +server: + port: 8520 + +app: + data-path: ./storage + +spring: + application: + name: store-node-grpc-server + profiles: + active: default + include: pd + +logging: + config: 'file:./conf/log4j2.xml' + level: + root: info diff --git a/docker/store-conf/log4j2.xml b/docker/store-conf/log4j2.xml new file mode 100644 index 0000000000..388d09e2fd --- /dev/null +++ b/docker/store-conf/log4j2.xml @@ -0,0 +1,137 @@ + + + + + + + + logs + hugegraph-store + raft-hugegraph-store + audit-hugegraph-store + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3c2ba6e6d374745b0f508ca0faf390a0a53b048f Mon Sep 17 00:00:00 2001 From: bitflicker64 Date: Sun, 15 Feb 2026 18:51:30 +0530 Subject: [PATCH 2/6] chore: add Apache license headers to config files --- docker/server-conf/graphs/hugegraph.properties | 17 +++++++++++++++++ docker/server-conf/rest-server.properties | 17 +++++++++++++++++ docker/store-conf/application.yml | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/docker/server-conf/graphs/hugegraph.properties b/docker/server-conf/graphs/hugegraph.properties index d21d462046..7e756bfcba 100644 --- a/docker/server-conf/graphs/hugegraph.properties +++ b/docker/server-conf/graphs/hugegraph.properties @@ -1,3 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + gremlin.graph=org.apache.hugegraph.HugeFactory backend=hstore serializer=binary diff --git a/docker/server-conf/rest-server.properties b/docker/server-conf/rest-server.properties index 235b19336d..5798ee6c83 100644 --- a/docker/server-conf/rest-server.properties +++ b/docker/server-conf/rest-server.properties @@ -1,3 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + # bind url # could use '0.0.0.0' or specified (real)IP to expose external network access restserver.url=http://0.0.0.0:8080 diff --git a/docker/store-conf/application.yml b/docker/store-conf/application.yml index d0585912c7..0a9dfa7829 100644 --- a/docker/store-conf/application.yml +++ b/docker/store-conf/application.yml @@ -1,3 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + pdserver: address: pd:8686 From afa63f05abbf045bd5a194df302082a8058c2ea6 Mon Sep 17 00:00:00 2001 From: bitflicker64 Date: Thu, 19 Feb 2026 00:33:51 +0530 Subject: [PATCH 3/6] --- --- docker/docker-compose.yml | 93 ++++++++--- docker/pd-conf/application.yml | 72 --------- docker/pd-conf/application.yml.template | 72 --------- docker/pd-conf/log4j2.xml | 135 ---------------- docker/pd-conf/verify-license.json | 6 - docker/server-conf/computer.yaml | 39 ----- .../server-conf/graphs/hugegraph.properties | 28 ---- .../server-conf/gremlin-driver-settings.yaml | 25 --- docker/server-conf/gremlin-server.yaml | 127 --------------- docker/server-conf/log4j2.xml | 144 ------------------ docker/server-conf/remote-objects.yaml | 29 ---- docker/server-conf/remote.yaml | 25 --- docker/server-conf/rest-server.properties | 77 ---------- docker/store-conf/application-pd.yml | 34 ----- docker/store-conf/application.yml | 49 ------ docker/store-conf/log4j2.xml | 137 ----------------- .../hg-pd-dist/docker/docker-entrypoint.sh | 69 ++++++++- .../docker/docker-entrypoint.sh | 70 ++++++--- .../hg-store-dist/docker/docker-entrypoint.sh | 64 +++++++- 19 files changed, 249 insertions(+), 1046 deletions(-) delete mode 100644 docker/pd-conf/application.yml delete mode 100644 docker/pd-conf/application.yml.template delete mode 100644 docker/pd-conf/log4j2.xml delete mode 100644 docker/pd-conf/verify-license.json delete mode 100644 docker/server-conf/computer.yaml delete mode 100644 docker/server-conf/graphs/hugegraph.properties delete mode 100644 docker/server-conf/gremlin-driver-settings.yaml delete mode 100644 docker/server-conf/gremlin-server.yaml delete mode 100644 docker/server-conf/log4j2.xml delete mode 100644 docker/server-conf/remote-objects.yaml delete mode 100644 docker/server-conf/remote.yaml delete mode 100644 docker/server-conf/rest-server.properties delete mode 100644 docker/store-conf/application-pd.yml delete mode 100644 docker/store-conf/application.yml delete mode 100644 docker/store-conf/log4j2.xml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index efc26862ad..85fbfca552 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,55 +15,98 @@ # limitations under the License. # -version: "3" +name: hugegraph-single + +networks: + hg-net: + driver: bridge + +volumes: + hg-pd-data: + hg-store-data: services: pd: - image: hugegraph/pd - container_name: pd + build: + context: .. + dockerfile: hugegraph-pd/Dockerfile + image: hugegraph/pd:${HUGEGRAPH_VERSION:-1.7.0} + container_name: hg-pd hostname: pd + restart: unless-stopped + networks: [hg-net] + environment: + HG_PD_GRPC_HOST: pd + HG_PD_GRPC_PORT: "8686" + HG_PD_REST_PORT: "8620" + HG_PD_RAFT_ADDRESS: pd:8610 + HG_PD_RAFT_PEERS_LIST: pd:8610 + HG_PD_INITIAL_STORE_LIST: store:8500 + HG_PD_DATA_PATH: /hugegraph-pd/pd_data +# HG_PD_INITIAL_STORE_COUNT: "1" ports: - "8620:8620" + - "8686:8686" + volumes: + - hg-pd-data:/hugegraph-pd/pd_data healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8620/v1/health"] + test: ["CMD-SHELL", "curl -fsS http://localhost:8620/v1/health >/dev/null || exit 1"] interval: 10s timeout: 5s - retries: 3 - volumes: - - ./pd-conf:/hugegraph-pd/conf + retries: 12 store: - image: hugegraph/store - container_name: store + build: + context: .. + dockerfile: hugegraph-store/Dockerfile + image: hugegraph/store:${HUGEGRAPH_VERSION:-1.7.0} + container_name: hg-store hostname: store - ports: - - "8520:8520" + restart: unless-stopped + networks: [hg-net] depends_on: pd: condition: service_healthy + environment: + environment: + HG_STORE_PD_ADDRESS: pd:8686 + HG_STORE_GRPC_HOST: store + HG_STORE_GRPC_PORT: "8500" + HG_STORE_REST_PORT: "8520" + HG_STORE_RAFT_ADDRESS: store:8510 + HG_STORE_DATA_PATH: /hugegraph-store/storage + ports: + - "8520:8520" + - "8500:8500" + - "8510:8510" + volumes: + - hg-store-data:/hugegraph-store/storage healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8520"] + test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null || exit 1"] interval: 10s timeout: 5s - retries: 3 - volumes: - - ./store-conf/application.yml:/hugegraph-store/conf/application.yml + retries: 12 server: - image: hugegraph/server - container_name: server + build: + context: .. + dockerfile: hugegraph-server/Dockerfile-hstore + image: hugegraph/server:${HUGEGRAPH_VERSION:-1.7.0} + container_name: hg-server hostname: server - ports: - - "8080:8080" - environment: - - hugegraph.pd.peers=pd:8686 + restart: unless-stopped + networks: [hg-net] depends_on: store: condition: service_healthy + environment: + HG_GRAPH: hugegraph + HG_SERVER_BACKEND: hstore + HG_SERVER_PD_PEERS: pd:8686 + ports: + - "8080:8080" healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8080"] + test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null || exit 1"] interval: 10s timeout: 5s - retries: 3 - volumes: - - ./server-conf:/hugegraph-server/conf + retries: 20 diff --git a/docker/pd-conf/application.yml b/docker/pd-conf/application.yml deleted file mode 100644 index 81115d5dac..0000000000 --- a/docker/pd-conf/application.yml +++ /dev/null @@ -1,72 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -logging: - config: 'file:./conf/log4j2.xml' -# TODO: handle the license file later (PDConfig) -license: - verify-path: ./conf/verify-license.json - license-path: ./conf/hugegraph.license -grpc: - port: 8686 - host: pd - -server: - # REST service port number - port: 8620 - -pd: - data-path: ./pd_data - patrol-interval: 1800 - initial-store-count: 1 - initial-store-list: store:8500 - -raft: - address: pd:8610 - peers-list: pd:8610 - -store: - # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds - max-down-time: 172800 - # Specifies whether to enable store monitoring data storage - monitor_data_enabled: true - # The interval between monitoring data, minute, hour, second - # default: 1 min * 1 day = 1440 - monitor_data_interval: 1 minute - # Retention time of monitoring data is 1 day; day, month, year - monitor_data_retention: 1 day - -partition: - # Default number of replicas per partition - default-shard-count: 1 - # The default maximum number of replicas per machine - # the initial number of partitions= store-max-shard-count * store-number / default-shard-count - store-max-shard-count: 12 diff --git a/docker/pd-conf/application.yml.template b/docker/pd-conf/application.yml.template deleted file mode 100644 index 8b8f0d63c5..0000000000 --- a/docker/pd-conf/application.yml.template +++ /dev/null @@ -1,72 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd -logging: - config: file:./conf/log4j2.xml - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - port: $GRPC_PORT$ - # grpc's service address, - # Note: You need to change to the local actual Iv 4 address when deploying. - host: $GRPC_HOST$ - netty-server: - max-inbound-message-size: 100MB - -server: - port : $SERVER_PORT$ - -pd: - # Cluster ID: to distinguish different PD clusters - - patrol-interval: 2147483647 - data-path: $PD_DATA_PATH$ - -raft: - address: $RAFT_ADDRESS$ - # raft cluster - peers-list: $RAFT_PEERS_LIST$ - # The interval between snapshot generation, in seconds - snapshotInterval: 300 - metrics: true -store: - # If the store heartbeat timeout period exceeds this time, the store is temporarily unavailable and the leader is transferred to another replica in seconds - keepAlive-timeout: 60 - # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds - max-down-time: 1800 -partition: - # The default total number of partitions - default-total-count: 30 - # Default number of replicas per partition - default-shard-count: 3 - -discovery: - # After the client registers, the maximum number of heartbeats is not reached, and after that, the - previous registration information will be deleted - heartbeat-try-count: 3 diff --git a/docker/pd-conf/log4j2.xml b/docker/pd-conf/log4j2.xml deleted file mode 100644 index a804948703..0000000000 --- a/docker/pd-conf/log4j2.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - logs - hugegraph-pd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/pd-conf/verify-license.json b/docker/pd-conf/verify-license.json deleted file mode 100644 index 868ccbebbb..0000000000 --- a/docker/pd-conf/verify-license.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "subject": "hugegraph-license", - "public_alias": "publiccert", - "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", - "publickey_path": "/public-certs.store" -} diff --git a/docker/server-conf/computer.yaml b/docker/server-conf/computer.yaml deleted file mode 100644 index a3274ec761..0000000000 --- a/docker/server-conf/computer.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# common parameters -common: { - worker_heap: 10000, - vertex_input_dir: /data, - workers: 51, - zookeeper_list: "127.0.0.1:2181", - max_edges_per_segment: 10485760, - edges_immutable: true, - partitions: 255, - compute_threads: 5, - input_threads: 5, - message_async: false, - message_queue_size: 1000, - message_send_threads: 10, - messages_per_segment: 104857600, - hugegraph_url: "http://server:8080", - hugegraph_name: hugegraph, - hugegraph_timeout: 60 -} - -env: { - computer_home: /home/computer -} diff --git a/docker/server-conf/graphs/hugegraph.properties b/docker/server-conf/graphs/hugegraph.properties deleted file mode 100644 index 7e756bfcba..0000000000 --- a/docker/server-conf/graphs/hugegraph.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -gremlin.graph=org.apache.hugegraph.HugeFactory -backend=hstore -serializer=binary -store=hugegraph -pd.peers=pd:8686 -task.scheduler_type=local -task.schedule_period=10 -task.retry=0 -task.wait_timeout=10 -search.text_analyzer=jieba -search.text_analyzer_mode=INDEX diff --git a/docker/server-conf/gremlin-driver-settings.yaml b/docker/server-conf/gremlin-driver-settings.yaml deleted file mode 100644 index 7ef456e5b0..0000000000 --- a/docker/server-conf/gremlin-driver-settings.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [server] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/docker/server-conf/gremlin-server.yaml b/docker/server-conf/gremlin-server.yaml deleted file mode 100644 index 32135163fd..0000000000 --- a/docker/server-conf/gremlin-server.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# host and port of gremlin server, need to be consistent with host and port in rest-server.properties -#host: 127.0.0.1 -#port: 8182 - -# timeout in ms of gremlin query -evaluationTimeout: 30000 - -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -# don't set graph at here, this happens after support for dynamically adding graph -graphs: { -} -scriptEngines: { - gremlin-groovy: { - staticImports: [ - org.opencypher.gremlin.process.traversal.CustomPredicates.*', - org.opencypher.gremlin.traversal.CustomFunctions.* - ], - plugins: { - org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { - classImports: [ - java.lang.Math, - org.apache.hugegraph.backend.id.IdGenerator, - org.apache.hugegraph.type.define.Directions, - org.apache.hugegraph.type.define.NodeRole, - org.apache.hugegraph.masterelection.GlobalMasterInfo, - org.apache.hugegraph.util.DateUtil, - org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, - org.apache.hugegraph.traversal.algorithm.CountTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, - org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, - org.apache.hugegraph.traversal.algorithm.HugeTraverser, - org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, - org.apache.hugegraph.traversal.algorithm.KneighborTraverser, - org.apache.hugegraph.traversal.algorithm.KoutTraverser, - org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, - org.apache.hugegraph.traversal.algorithm.PathsTraverser, - org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, - org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, - org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, - org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, - org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, - org.apache.hugegraph.traversal.optimize.ConditionP, - org.apache.hugegraph.traversal.optimize.Text, - org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.opencypher.gremlin.traversal.CustomFunctions, - org.opencypher.gremlin.traversal.CustomPredicate - ], - methodImports: [ - java.lang.Math#*, - org.opencypher.gremlin.traversal.CustomPredicate#*, - org.opencypher.gremlin.traversal.CustomFunctions#* - ] - }, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/empty-sample.groovy] - } - } - } -} -serializers: - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } -metrics: { - consoleReporter: {enabled: false, interval: 180000}, - csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, - jmxReporter: {enabled: false}, - slf4jReporter: {enabled: false, interval: 180000}, - gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, - graphiteReporter: {enabled: false, interval: 180000} -} -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 65536 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 -ssl: { - enabled: false -} diff --git a/docker/server-conf/log4j2.xml b/docker/server-conf/log4j2.xml deleted file mode 100644 index f1dd7e8395..0000000000 --- a/docker/server-conf/log4j2.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - logs - hugegraph-server - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/server-conf/remote-objects.yaml b/docker/server-conf/remote-objects.yaml deleted file mode 100644 index c3b59ff5da..0000000000 --- a/docker/server-conf/remote-objects.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [server] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [ - org.apache.hugegraph.io.HugeGraphIoRegistry, - org.apache.hugegraph.io.HugeGraphIoRegistry - ] - } -} - diff --git a/docker/server-conf/remote.yaml b/docker/server-conf/remote.yaml deleted file mode 100644 index 7ef456e5b0..0000000000 --- a/docker/server-conf/remote.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [server] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/docker/server-conf/rest-server.properties b/docker/server-conf/rest-server.properties deleted file mode 100644 index 5798ee6c83..0000000000 --- a/docker/server-conf/rest-server.properties +++ /dev/null @@ -1,77 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# bind url -# could use '0.0.0.0' or specified (real)IP to expose external network access -restserver.url=http://0.0.0.0:8080 -#restserver.enable_graphspaces_filter=false -# gremlin server url, need to be consistent with host and port in gremlin-server.yaml -#gremlinserver.url=http://127.0.0.1:8182 - -graphs=./conf/graphs - -# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 -batch.max_write_ratio=80 -batch.max_write_threads=0 - -# configuration of arthas -arthas.telnet_port=8562 -arthas.http_port=8561 -arthas.ip=127.0.0.1 -arthas.disabled_commands=jad - -# authentication configs -# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or -# 'org.apache.hugegraph.auth.ConfigAuthenticator' -#auth.authenticator= - -# for StandardAuthenticator mode -#auth.graph_store=hugegraph -# auth client config -#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 - -# for ConfigAuthenticator mode -#auth.admin_token= -#auth.user_tokens=[] - -# TODO: Deprecated & removed later (useless from version 1.5.0) -# rpc server configs for multi graph-servers or raft-servers -#rpc.server_host=127.0.0.1 -#rpc.server_port=8091 -#rpc.server_timeout=30 - -# rpc client configs (like enable to keep cache consistency) -#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 -#rpc.client_connect_timeout=20 -#rpc.client_reconnect_period=10 -#rpc.client_read_timeout=40 -#rpc.client_retries=3 -#rpc.client_load_balancer=consistentHash - -# raft group initial peers -#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 - -# lightweight load balancing (beta) -server.id=server-1 -server.role=master - -# slow query log -log.slow_query_threshold=1000 - -# jvm(in-heap) memory usage monitor, set 1 to disable it -memory_monitor.threshold=0.85 -memory_monitor.period=2000 diff --git a/docker/store-conf/application-pd.yml b/docker/store-conf/application-pd.yml deleted file mode 100644 index 0315c4b4fe..0000000000 --- a/docker/store-conf/application-pd.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -rocksdb: - # rocksdb total memory usage, force flush to disk when reaching this value - total_memory_size: 32000000000 - # memtable size used by rocksdb - write_buffer_size: 32000000 - # For each rocksdb, the number of memtables reaches this value for writing to disk. - min_write_buffer_number_to_merge: 16 diff --git a/docker/store-conf/application.yml b/docker/store-conf/application.yml deleted file mode 100644 index 0a9dfa7829..0000000000 --- a/docker/store-conf/application.yml +++ /dev/null @@ -1,49 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -pdserver: - address: pd:8686 - -grpc: - host: store - port: 8500 - netty-server: - max-inbound-message-size: 1000MB - -raft: - disruptorBufferSize: 1024 - address: store:8510 - max-log-file-size: 600000000000 - snapshotInterval: 1800 - -server: - port: 8520 - -app: - data-path: ./storage - -spring: - application: - name: store-node-grpc-server - profiles: - active: default - include: pd - -logging: - config: 'file:./conf/log4j2.xml' - level: - root: info diff --git a/docker/store-conf/log4j2.xml b/docker/store-conf/log4j2.xml deleted file mode 100644 index 388d09e2fd..0000000000 --- a/docker/store-conf/log4j2.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - logs - hugegraph-store - raft-hugegraph-store - audit-hugegraph-store - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh index fd894d5518..0e93c184dd 100644 --- a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -15,8 +15,73 @@ # See the License for the specific language governing permissions and # limitations under the License. # +set -euo pipefail -# start hugegraph pd -./bin/start-hugegraph-pd.sh -j "$JAVA_OPTS" +log() { echo "[hugegraph-pd-entrypoint] $*"; } +fail_on_deprecated() { + local old_name="$1" new_name="$2" + if [[ -n "${!old_name:-}" ]]; then + echo "ERROR: deprecated env '${old_name}' detected. Use '${new_name}' instead." >&2 + exit 2 + fi +} + +require_env() { + local name="$1" + if [[ -z "${!name:-}" ]]; then + echo "ERROR: missing required env '${name}'" >&2; exit 2 + fi +} + +json_escape() { + local s="$1" + s=${s//\\/\\\\}; s=${s//\"/\\\"}; s=${s//$'\n'/} + printf "%s" "$s" +} + +# ── Guard deprecated vars ───────────────────────────────────────────── +fail_on_deprecated "GRPC_HOST" "HG_PD_GRPC_HOST" +fail_on_deprecated "RAFT_ADDRESS" "HG_PD_RAFT_ADDRESS" +fail_on_deprecated "RAFT_PEERS" "HG_PD_RAFT_PEERS_LIST" +fail_on_deprecated "PD_INITIAL_STORE_LIST" "HG_PD_INITIAL_STORE_LIST" + +# ── Required vars ───────────────────────────────────────────────────── +require_env "HG_PD_GRPC_HOST" +require_env "HG_PD_RAFT_ADDRESS" +require_env "HG_PD_RAFT_PEERS_LIST" +require_env "HG_PD_INITIAL_STORE_LIST" + +# ── Defaults ────────────────────────────────────────────────────────── +: "${HG_PD_GRPC_PORT:=8686}" +: "${HG_PD_REST_PORT:=8620}" +: "${HG_PD_DATA_PATH:=/hugegraph-pd/pd_data}" +: "${HG_PD_INITIAL_STORE_COUNT:=1}" + +# ── Build SPRING_APPLICATION_JSON ───────────────────────────────────── +SPRING_APPLICATION_JSON="$(cat <&2 + exit 2 + fi +} + +set_prop() { + local key="$1" val="$2" file="$3" + if grep -q -E "^[[:space:]]*${key}[[:space:]]*=" "${file}"; then + sed -ri "s#^([[:space:]]*${key}[[:space:]]*=).*#\\1${val}#" "${file}" + else + echo "${key}=${val}" >> "${file}" + fi +} -if [ ! -f "${DOCKER_FOLDER}/${INIT_FLAG_FILE}" ]; then - # wait for storage backend - ./bin/wait-storage.sh - if [ -z "$PASSWORD" ]; then - echo "init hugegraph with non-auth mode" +# ── Guard deprecated vars ───────────────────────────────────────────── +fail_on_deprecated "BACKEND" "HG_SERVER_BACKEND" +fail_on_deprecated "PD_PEERS" "HG_SERVER_PD_PEERS" + +# ── Map env → properties file ───────────────────────────────────────── +[[ -n "${HG_SERVER_BACKEND:-}" ]] && set_prop "backend" "${HG_SERVER_BACKEND}" "${GRAPH_CONF}" +[[ -n "${HG_SERVER_PD_PEERS:-}" ]] && set_prop "pd.peers" "${HG_SERVER_PD_PEERS}" "${GRAPH_CONF}" + +# ── Build wait-storage env ───────────────────────────────────────────── +WAIT_ENV=() +[[ -n "${HG_SERVER_BACKEND:-}" ]] && WAIT_ENV+=("hugegraph.backend=${HG_SERVER_BACKEND}") +[[ -n "${HG_SERVER_PD_PEERS:-}" ]] && WAIT_ENV+=("hugegraph.pd.peers=${HG_SERVER_PD_PEERS}") + +# ── Init store (once) ───────────────────────────────────────────────── +if [[ ! -f "${DOCKER_FOLDER}/${INIT_FLAG_FILE}" ]]; then + if (( ${#WAIT_ENV[@]} > 0 )); then + env "${WAIT_ENV[@]}" ./bin/wait-storage.sh + else + ./bin/wait-storage.sh + fi + + if [[ -z "${PASSWORD:-}" ]]; then + log "init hugegraph with non-auth mode" ./bin/init-store.sh else - echo "init hugegraph with auth mode" + log "init hugegraph with auth mode" ./bin/enable-auth.sh - echo "$PASSWORD" | ./bin/init-store.sh + echo "${PASSWORD}" | ./bin/init-store.sh fi - # create a flag file to avoid re-init when restarting - touch ${DOCKER_FOLDER}/${INIT_FLAG_FILE} + touch "${DOCKER_FOLDER}/${INIT_FLAG_FILE}" else - echo "Hugegraph Initialization already done. Skipping re-init..." + log "HugeGraph initialization already done. Skipping re-init..." fi -# start hugegraph-server -# remove "-g zgc" now, which is only available on ARM-Mac with java > 13 -./bin/start-hugegraph.sh -j "$JAVA_OPTS" - +./bin/start-hugegraph.sh -j "${JAVA_OPTS:-}" tail -f /dev/null diff --git a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh index 5aa77621dc..548244d806 100644 --- a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh +++ b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh @@ -15,8 +15,68 @@ # See the License for the specific language governing permissions and # limitations under the License. # +set -euo pipefail -# start hugegraph store -./bin/start-hugegraph-store.sh -j "$JAVA_OPTS" +log() { echo "[hugegraph-store-entrypoint] $*"; } +fail_on_deprecated() { + local old_name="$1" new_name="$2" + if [[ -n "${!old_name:-}" ]]; then + echo "ERROR: deprecated env '${old_name}' detected. Use '${new_name}' instead." >&2 + exit 2 + fi +} + +require_env() { + local name="$1" + if [[ -z "${!name:-}" ]]; then + echo "ERROR: missing required env '${name}'" >&2; exit 2 + fi +} + +json_escape() { + local s="$1" + s=${s//\\/\\\\}; s=${s//\"/\\\"}; s=${s//$'\n'/} + printf "%s" "$s" +} + +# ── Guard deprecated vars ───────────────────────────────────────────── +fail_on_deprecated "PD_ADDRESS" "HG_STORE_PD_ADDRESS" +fail_on_deprecated "GRPC_HOST" "HG_STORE_GRPC_HOST" +fail_on_deprecated "RAFT_ADDRESS" "HG_STORE_RAFT_ADDRESS" +fail_on_deprecated "RAFT_PEERS" "HG_PD_RAFT_PEERS_LIST" + +# ── Required vars ───────────────────────────────────────────────────── +require_env "HG_STORE_PD_ADDRESS" +require_env "HG_STORE_GRPC_HOST" +require_env "HG_STORE_RAFT_ADDRESS" + +# ── Defaults ────────────────────────────────────────────────────────── +: "${HG_STORE_GRPC_PORT:=8500}" +: "${HG_STORE_REST_PORT:=8520}" +: "${HG_STORE_DATA_PATH:=/hugegraph-store/storage}" + +# ── Build SPRING_APPLICATION_JSON ───────────────────────────────────── +SPRING_APPLICATION_JSON="$(cat < Date: Fri, 20 Feb 2026 17:11:06 +0530 Subject: [PATCH 4/6] fix: ARM64 compatibility in wait-storage.sh - use curl instead of gremlin-console --- docker/docker-compose.yml | 13 ++++----- .../hg-pd-dist/docker/docker-entrypoint.sh | 3 +-- .../src/assembly/static/bin/wait-storage.sh | 27 ++++++++++++++++--- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 85fbfca552..29abc2e59d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -43,7 +43,6 @@ services: HG_PD_RAFT_PEERS_LIST: pd:8610 HG_PD_INITIAL_STORE_LIST: store:8500 HG_PD_DATA_PATH: /hugegraph-pd/pd_data -# HG_PD_INITIAL_STORE_COUNT: "1" ports: - "8620:8620" - "8686:8686" @@ -54,6 +53,7 @@ services: interval: 10s timeout: 5s retries: 12 + start_period: 20s store: build: @@ -68,7 +68,6 @@ services: pd: condition: service_healthy environment: - environment: HG_STORE_PD_ADDRESS: pd:8686 HG_STORE_GRPC_HOST: store HG_STORE_GRPC_PORT: "8500" @@ -82,10 +81,11 @@ services: volumes: - hg-store-data:/hugegraph-store/storage healthcheck: - test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null || exit 1"] + test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null && curl -fsS http://pd:8620/v1/health >/dev/null || exit 1"] interval: 10s - timeout: 5s - retries: 12 + timeout: 10s + retries: 30 + start_period: 30s server: build: @@ -109,4 +109,5 @@ services: test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null || exit 1"] interval: 10s timeout: 5s - retries: 20 + retries: 30 + start_period: 60s diff --git a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh index 0e93c184dd..53f688e564 100644 --- a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -67,8 +67,7 @@ SPRING_APPLICATION_JSON="$(cat < /dev/null; then if [ -n "${WAIT_STORAGE_TIMEOUT_S:-}" ]; then - timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c \ - "until bin/gremlin-console.sh -- -e $DETECT_STORAGE > /dev/null 2>&1; do echo \"Hugegraph server are waiting for storage backend...\"; sleep 5; done" + # Extract pd.peers from config or environment + PD_PEERS="${hugegraph_pd_peers:-}" + if [ -z "$PD_PEERS" ]; then + PD_PEERS=$(grep -E "^\s*pd\.peers\s*=" "$GRAPH_CONF" | sed 's/.*=\s*//' | tr -d ' ') + fi + + if [ -n "$PD_PEERS" ]; then + # Convert gRPC address to REST address (8686 -> 8620) + PD_REST=$(echo "$PD_PEERS" | sed 's/:8686/:8620/g' | cut -d',' -f1) + echo "Waiting for PD REST endpoint at $PD_REST..." + + timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c " + until curl -fsS http://${PD_REST}/v1/health >/dev/null 2>&1; do + echo 'Hugegraph server are waiting for storage backend...' + sleep 5 + done + echo 'PD is reachable, waiting extra 10s for store registration...' + sleep 10 + echo 'Storage backend is ready!' + " || echo "Warning: Timeout waiting for storage, proceeding anyway..." + else + echo "No pd.peers configured, skipping storage wait..." + fi fi fi From 6e024d2491ade33094672745cd39a8cc66bc8d6f Mon Sep 17 00:00:00 2001 From: bitflicker64 Date: Sat, 21 Feb 2026 14:33:12 +0530 Subject: [PATCH 5/6] Fix Docker configuration: remove deprecated checks, simplify healthchecks, remove unused detect-storage script --- docker/docker-compose.yml | 3 +-- .../hg-pd-dist/docker/docker-entrypoint.sh | 1 - .../docker/scripts/detect-storage.groovy | 26 ------------------- .../hg-store-dist/docker/docker-entrypoint.sh | 1 - 4 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 29abc2e59d..83e8fdb874 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -81,7 +81,7 @@ services: volumes: - hg-store-data:/hugegraph-store/storage healthcheck: - test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null && curl -fsS http://pd:8620/v1/health >/dev/null || exit 1"] + test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null || exit 1"] interval: 10s timeout: 10s retries: 30 @@ -100,7 +100,6 @@ services: store: condition: service_healthy environment: - HG_GRAPH: hugegraph HG_SERVER_BACKEND: hstore HG_SERVER_PD_PEERS: pd:8686 ports: diff --git a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh index 53f688e564..c998859efe 100644 --- a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -56,7 +56,6 @@ require_env "HG_PD_INITIAL_STORE_LIST" : "${HG_PD_GRPC_PORT:=8686}" : "${HG_PD_REST_PORT:=8620}" : "${HG_PD_DATA_PATH:=/hugegraph-pd/pd_data}" -: "${HG_PD_INITIAL_STORE_COUNT:=1}" # ── Build SPRING_APPLICATION_JSON ───────────────────────────────────── SPRING_APPLICATION_JSON="$(cat < Date: Tue, 24 Feb 2026 13:53:48 +0530 Subject: [PATCH 6/6] Decouple compose from local builds; bind-mount updated entrypoint scripts --- docker/docker-compose.dev.yml | 109 ++++++++++++++++++ docker/docker-compose.yml | 56 ++++++--- .../hg-pd-dist/docker/docker-entrypoint.sh | 33 +++--- .../docker/docker-entrypoint.sh | 40 ++++--- .../docker/scripts/detect-storage.groovy | 26 +++++ .../src/assembly/static/bin/wait-partition.sh | 34 ++++++ .../src/assembly/static/bin/wait-storage.sh | 8 +- .../hg-store-dist/docker/docker-entrypoint.sh | 22 ++-- 8 files changed, 268 insertions(+), 60 deletions(-) create mode 100644 docker/docker-compose.dev.yml mode change 100644 => 100755 hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh mode change 100644 => 100755 hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh create mode 100644 hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy create mode 100755 hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-partition.sh mode change 100644 => 100755 hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh mode change 100644 => 100755 hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml new file mode 100644 index 0000000000..77bcbfd53e --- /dev/null +++ b/docker/docker-compose.dev.yml @@ -0,0 +1,109 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: hugegraph-single + +networks: + hg-net: + driver: bridge + +volumes: + hg-pd-data: + hg-store-data: + +services: + pd: + build: + context: .. + dockerfile: hugegraph-pd/Dockerfile + image: hugegraph/pd:${HUGEGRAPH_VERSION:-latest} + container_name: hg-pd + hostname: pd + restart: unless-stopped + networks: [hg-net] + environment: + HG_PD_GRPC_HOST: pd + HG_PD_GRPC_PORT: "8686" + HG_PD_REST_PORT: "8620" + HG_PD_RAFT_ADDRESS: pd:8610 + HG_PD_RAFT_PEERS_LIST: pd:8610 + HG_PD_INITIAL_STORE_LIST: store:8500 + HG_PD_DATA_PATH: /hugegraph-pd/pd_data + ports: + - "8620:8620" + volumes: + - hg-pd-data:/hugegraph-pd/pd_data + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost:8620/v1/health >/dev/null || exit 1"] + interval: 10s + timeout: 5s + retries: 12 + start_period: 20s + + store: + build: + context: .. + dockerfile: hugegraph-store/Dockerfile + image: hugegraph/store:${HUGEGRAPH_VERSION:-latest} + container_name: hg-store + hostname: store + restart: unless-stopped + networks: [hg-net] + depends_on: + pd: + condition: service_healthy + environment: + HG_STORE_PD_ADDRESS: pd:8686 + HG_STORE_GRPC_HOST: store + HG_STORE_GRPC_PORT: "8500" + HG_STORE_REST_PORT: "8520" + HG_STORE_RAFT_ADDRESS: store:8510 + HG_STORE_DATA_PATH: /hugegraph-store/storage + ports: + - "8520:8520" + volumes: + - hg-store-data:/hugegraph-store/storage + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null || exit 1"] + interval: 10s + timeout: 10s + retries: 30 + start_period: 30s + + server: + build: + context: .. + dockerfile: hugegraph-server/Dockerfile-hstore + image: hugegraph/server:${HUGEGRAPH_VERSION:-latest} + container_name: hg-server + hostname: server + restart: unless-stopped + networks: [hg-net] + depends_on: + store: + condition: service_healthy + environment: + HG_SERVER_BACKEND: hstore + HG_SERVER_PD_PEERS: pd:8686 + ports: + - "8080:8080" + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null || exit 1"] + interval: 10s + timeout: 5s + retries: 30 + start_period: 60s diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 83e8fdb874..90a5dd5c74 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -26,15 +26,17 @@ volumes: hg-store-data: services: + pd: - build: - context: .. - dockerfile: hugegraph-pd/Dockerfile - image: hugegraph/pd:${HUGEGRAPH_VERSION:-1.7.0} + image: hugegraph/pd:${HUGEGRAPH_VERSION:-latest} + pull_policy: always container_name: hg-pd hostname: pd restart: unless-stopped networks: [hg-net] + + entrypoint: ["/hugegraph-pd/docker-entrypoint.sh"] + environment: HG_PD_GRPC_HOST: pd HG_PD_GRPC_PORT: "8686" @@ -43,30 +45,36 @@ services: HG_PD_RAFT_PEERS_LIST: pd:8610 HG_PD_INITIAL_STORE_LIST: store:8500 HG_PD_DATA_PATH: /hugegraph-pd/pd_data + ports: - "8620:8620" - - "8686:8686" + volumes: - hg-pd-data:/hugegraph-pd/pd_data + - ../hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh:/hugegraph-pd/docker-entrypoint.sh + healthcheck: - test: ["CMD-SHELL", "curl -fsS http://localhost:8620/v1/health >/dev/null || exit 1"] + test: ["CMD-SHELL", "curl -fsS http://localhost:8620/ >/dev/null || exit 1"] interval: 10s timeout: 5s retries: 12 - start_period: 20s + start_period: 30s + store: - build: - context: .. - dockerfile: hugegraph-store/Dockerfile - image: hugegraph/store:${HUGEGRAPH_VERSION:-1.7.0} + image: hugegraph/store:${HUGEGRAPH_VERSION:-latest} + pull_policy: always container_name: hg-store hostname: store restart: unless-stopped networks: [hg-net] + + entrypoint: ["/hugegraph-store/docker-entrypoint.sh"] + depends_on: pd: condition: service_healthy + environment: HG_STORE_PD_ADDRESS: pd:8686 HG_STORE_GRPC_HOST: store @@ -74,36 +82,48 @@ services: HG_STORE_REST_PORT: "8520" HG_STORE_RAFT_ADDRESS: store:8510 HG_STORE_DATA_PATH: /hugegraph-store/storage + ports: - "8520:8520" - - "8500:8500" - - "8510:8510" + volumes: - hg-store-data:/hugegraph-store/storage + - ../hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh:/hugegraph-store/docker-entrypoint.sh + healthcheck: test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null || exit 1"] interval: 10s timeout: 10s retries: 30 - start_period: 30s + start_period: 60s + server: - build: - context: .. - dockerfile: hugegraph-server/Dockerfile-hstore - image: hugegraph/server:${HUGEGRAPH_VERSION:-1.7.0} + image: hugegraph/server:${HUGEGRAPH_VERSION:-latest} + pull_policy: always container_name: hg-server hostname: server restart: unless-stopped networks: [hg-net] + + entrypoint: ["/hugegraph-server/docker-entrypoint.sh"] + depends_on: store: condition: service_healthy + environment: HG_SERVER_BACKEND: hstore HG_SERVER_PD_PEERS: pd:8686 + ports: - "8080:8080" + + volumes: + - ../hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:/hugegraph-server/docker-entrypoint.sh + - ../hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh:/hugegraph-server/bin/wait-storage.sh + - ../hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-partition.sh:/hugegraph-server/bin/wait-partition.sh + healthcheck: test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null || exit 1"] interval: 10s diff --git a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh old mode 100644 new mode 100755 index c998859efe..d1ae5c3c3a --- a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -19,14 +19,6 @@ set -euo pipefail log() { echo "[hugegraph-pd-entrypoint] $*"; } -fail_on_deprecated() { - local old_name="$1" new_name="$2" - if [[ -n "${!old_name:-}" ]]; then - echo "ERROR: deprecated env '${old_name}' detected. Use '${new_name}' instead." >&2 - exit 2 - fi -} - require_env() { local name="$1" if [[ -z "${!name:-}" ]]; then @@ -40,11 +32,19 @@ json_escape() { printf "%s" "$s" } -# ── Guard deprecated vars ───────────────────────────────────────────── -fail_on_deprecated "GRPC_HOST" "HG_PD_GRPC_HOST" -fail_on_deprecated "RAFT_ADDRESS" "HG_PD_RAFT_ADDRESS" -fail_on_deprecated "RAFT_PEERS" "HG_PD_RAFT_PEERS_LIST" -fail_on_deprecated "PD_INITIAL_STORE_LIST" "HG_PD_INITIAL_STORE_LIST" +migrate_env() { + local old_name="$1" new_name="$2" + + if [[ -n "${!old_name:-}" && -z "${!new_name:-}" ]]; then + log "WARN: deprecated env '${old_name}' detected; mapping to '${new_name}'" + export "${new_name}=${!old_name}" + fi +} + +migrate_env "GRPC_HOST" "HG_PD_GRPC_HOST" +migrate_env "RAFT_ADDRESS" "HG_PD_RAFT_ADDRESS" +migrate_env "RAFT_PEERS" "HG_PD_RAFT_PEERS_LIST" +migrate_env "PD_INITIAL_STORE_LIST" "HG_PD_INITIAL_STORE_LIST" # ── Required vars ───────────────────────────────────────────────────── require_env "HG_PD_GRPC_HOST" @@ -52,12 +52,11 @@ require_env "HG_PD_RAFT_ADDRESS" require_env "HG_PD_RAFT_PEERS_LIST" require_env "HG_PD_INITIAL_STORE_LIST" -# ── Defaults ────────────────────────────────────────────────────────── : "${HG_PD_GRPC_PORT:=8686}" : "${HG_PD_REST_PORT:=8620}" : "${HG_PD_DATA_PATH:=/hugegraph-pd/pd_data}" +: "${HG_PD_INITIAL_STORE_COUNT:=1}" -# ── Build SPRING_APPLICATION_JSON ───────────────────────────────────── SPRING_APPLICATION_JSON="$(cat <&2 - exit 2 - fi -} - set_prop() { local key="$1" val="$2" file="$3" - if grep -q -E "^[[:space:]]*${key}[[:space:]]*=" "${file}"; then - sed -ri "s#^([[:space:]]*${key}[[:space:]]*=).*#\\1${val}#" "${file}" + local esc_key esc_val + + esc_key=$(printf '%s' "$key" | sed -e 's/[][(){}.^$*+?|\\/]/\\&/g') + esc_val=$(printf '%s' "$val" | sed -e 's/[&|\\]/\\&/g') + + if grep -qE "^[[:space:]]*${esc_key}[[:space:]]*=" "${file}"; then + sed -ri "s|^([[:space:]]*${esc_key}[[:space:]]*=).*|\\1${esc_val}|" "${file}" else - echo "${key}=${val}" >> "${file}" + printf '%s=%s\n' "$key" "$val" >> "${file}" + fi +} + +migrate_env() { + local old_name="$1" new_name="$2" + + if [[ -n "${!old_name:-}" && -z "${!new_name:-}" ]]; then + log "WARN: deprecated env '${old_name}' detected; mapping to '${new_name}'" + export "${new_name}=${!old_name}" fi } -# ── Guard deprecated vars ───────────────────────────────────────────── -fail_on_deprecated "BACKEND" "HG_SERVER_BACKEND" -fail_on_deprecated "PD_PEERS" "HG_SERVER_PD_PEERS" +migrate_env "BACKEND" "HG_SERVER_BACKEND" +migrate_env "PD_PEERS" "HG_SERVER_PD_PEERS" # ── Map env → properties file ───────────────────────────────────────── [[ -n "${HG_SERVER_BACKEND:-}" ]] && set_prop "backend" "${HG_SERVER_BACKEND}" "${GRAPH_CONF}" @@ -77,4 +82,11 @@ else fi ./bin/start-hugegraph.sh -j "${JAVA_OPTS:-}" + +STORE_REST="${STORE_REST:-hg-store:8520}" +export STORE_REST + +# Post-startup cluster stabilization check +./bin/wait-partition.sh || log "WARN: partitions not assigned yet" + tail -f /dev/null diff --git a/hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy b/hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy new file mode 100644 index 0000000000..104bd7c8ff --- /dev/null +++ b/hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.hugegraph.HugeFactory +import org.apache.hugegraph.dist.RegisterUtil + +// register all the backend to avoid changes if needs to support other backend +RegisterUtil.registerPlugins() +RegisterUtil.registerRocksDB() +RegisterUtil.registerHBase() + +graph = HugeFactory.open('./conf/graphs/hugegraph.properties') diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-partition.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-partition.sh new file mode 100755 index 0000000000..d472a198cc --- /dev/null +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-partition.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +set -euo pipefail + +: "${STORE_REST:?STORE_REST not set}" + +timeout "${WAIT_PARTITION_TIMEOUT_S:-60}s" bash -c ' +until curl -fsS "http://${STORE_REST}/v1/partitions" 2>/dev/null | \ + grep -q "\"partitionCount\":[1-9]" +do + echo "Waiting for partition assignment..." + sleep 5 +done +' + +echo "Partitions detected:" +URL="http://${STORE_REST}/v1/partitions" +echo "$URL" +curl -v "$URL" diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh old mode 100644 new mode 100755 index 781eb4948a..d56c13ff8a --- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh @@ -78,7 +78,13 @@ if env | grep '^hugegraph\.' > /dev/null; then if [ -n "$PD_PEERS" ]; then # Convert gRPC address to REST address (8686 -> 8620) - PD_REST=$(echo "$PD_PEERS" | sed 's/:8686/:8620/g' | cut -d',' -f1) + : "${HG_SERVER_PD_REST_ENDPOINT:=}" + + if [ -n "${HG_SERVER_PD_REST_ENDPOINT}" ]; then + PD_REST="${HG_SERVER_PD_REST_ENDPOINT}" + else + PD_REST=$(echo "$PD_PEERS" | sed 's/:8686/:8620/g' | cut -d',' -f1) + fi echo "Waiting for PD REST endpoint at $PD_REST..." timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c " diff --git a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh old mode 100644 new mode 100755 index c528b38736..1bdaaafc5a --- a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh +++ b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh @@ -19,14 +19,6 @@ set -euo pipefail log() { echo "[hugegraph-store-entrypoint] $*"; } -fail_on_deprecated() { - local old_name="$1" new_name="$2" - if [[ -n "${!old_name:-}" ]]; then - echo "ERROR: deprecated env '${old_name}' detected. Use '${new_name}' instead." >&2 - exit 2 - fi -} - require_env() { local name="$1" if [[ -z "${!name:-}" ]]; then @@ -41,10 +33,18 @@ json_escape() { } # ── Guard deprecated vars ───────────────────────────────────────────── -fail_on_deprecated "PD_ADDRESS" "HG_STORE_PD_ADDRESS" -fail_on_deprecated "GRPC_HOST" "HG_STORE_GRPC_HOST" -fail_on_deprecated "RAFT_ADDRESS" "HG_STORE_RAFT_ADDRESS" +migrate_env() { + local old_name="$1" new_name="$2" + + if [[ -n "${!old_name:-}" && -z "${!new_name:-}" ]]; then + log "WARN: deprecated env '${old_name}' detected; mapping to '${new_name}'" + export "${new_name}=${!old_name}" + fi +} +migrate_env "PD_ADDRESS" "HG_STORE_PD_ADDRESS" +migrate_env "GRPC_HOST" "HG_STORE_GRPC_HOST" +migrate_env "RAFT_ADDRESS" "HG_STORE_RAFT_ADDRESS" # ── Required vars ───────────────────────────────────────────────────── require_env "HG_STORE_PD_ADDRESS" require_env "HG_STORE_GRPC_HOST"