This is an automated email from the ASF dual-hosted git repository. vgalaxies pushed a commit to branch pd-store-docker in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
commit 7bea999d8897400083c6f80199f1e870ad669bff Author: V_Galaxy <[email protected]> AuthorDate: Sat May 18 23:18:26 2024 +0800 feat(dist): support docker deployment for PD and Store (#2529) Co-authored-by: imbajin <[email protected]> --- .github/PULL_REQUEST_TEMPLATE.md | 4 +- .github/workflows/stale.yml | 2 +- BUILDING.md | 37 ++--- CONTRIBUTING.md | 24 +-- README.md | 2 +- docker/configs/application-pd0.yml | 63 ++++++++ docker/configs/application-pd1.yml | 63 ++++++++ docker/configs/application-pd2.yml | 63 ++++++++ docker/configs/application-store0.yml | 57 +++++++ docker/configs/application-store1.yml | 57 +++++++ docker/configs/application-store2.yml | 57 +++++++ .../server1-conf/graphs/hugegraph.properties | 19 +++ .../server1-conf/gremlin-driver-settings.yaml | 25 +++ docker/configs/server1-conf/gremlin-server.yaml | 127 +++++++++++++++ docker/configs/server1-conf/log4j2.xml | 144 +++++++++++++++++ docker/configs/server1-conf/remote-objects.yaml | 30 ++++ docker/configs/server1-conf/remote.yaml | 25 +++ docker/configs/server1-conf/rest-server.properties | 28 ++++ .../server2-conf/graphs/hugegraph.properties | 19 +++ .../server2-conf/gremlin-driver-settings.yaml | 25 +++ docker/configs/server2-conf/gremlin-server.yaml | 127 +++++++++++++++ docker/configs/server2-conf/log4j2.xml | 144 +++++++++++++++++ docker/configs/server2-conf/remote-objects.yaml | 30 ++++ docker/configs/server2-conf/remote.yaml | 25 +++ docker/configs/server2-conf/rest-server.properties | 26 +++ .../server3-conf/graphs/hugegraph.properties | 19 +++ .../server3-conf/gremlin-driver-settings.yaml | 25 +++ docker/configs/server3-conf/gremlin-server.yaml | 127 +++++++++++++++ docker/configs/server3-conf/log4j2.xml | 144 +++++++++++++++++ docker/configs/server3-conf/remote-objects.yaml | 30 ++++ docker/configs/server3-conf/remote.yaml | 25 +++ docker/configs/server3-conf/rest-server.properties | 25 +++ docker/docker-compose-3pd-3store-3server.yml | 180 +++++++++++++++++++++ docker/docker-compose.yml | 58 +++++++ {hugegraph-server => hugegraph-pd}/Dockerfile | 28 ++-- .../hg-pd-dist}/docker/docker-entrypoint.sh | 28 +--- hugegraph-server/Dockerfile | 7 +- hugegraph-server/hugegraph-dist/docker/README.md | 6 +- .../hugegraph-dist/docker/docker-entrypoint.sh | 2 +- {hugegraph-server => hugegraph-store}/Dockerfile | 28 ++-- .../hg-store-dist}/docker/docker-entrypoint.sh | 28 +--- 41 files changed, 1859 insertions(+), 124 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c71e5e4a6..fbc6994ee 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -19,7 +19,7 @@ published) ## Purpose of the PR -- close #xxx <!-- or use "fix #xxx", "xxx" is the ID-link of related issue, e.g: close #1024 --> +- close #xxx <!-- or use "fix #xxx", "xxx" is the ID-link of related issue, e.g: close #1024 --> <!-- Please explain more context in this section, clarify why the changes are needed. @@ -30,7 +30,7 @@ e.g: ## Main Changes -<!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. These change logs are helpful for better ant faster reviews.) +<!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. These change logs are helpful for better and faster reviews.) For example: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6b8e11f4b..4f8484ce6 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -29,7 +29,7 @@ jobs: days-before-pr-stale: 30 days-before-pr-close: 180 operations-per-run: 10 - start-date: '2017-10-01T00:00:00Z' + start-date: '2016-10-01T00:00:00Z' exempt-all-assignees: true remove-stale-when-updated: true diff --git a/BUILDING.md b/BUILDING.md index d99dda447..b7342e68d 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,28 +1,35 @@ -Building hugegraph +Building HugeGraph -------------- Required: -* Java 8/11 -* Maven +* Java 11 +* Maven 3.5+ + +To build without executing tests: `mvn clean package -DskipTests` + +## Building in IDEA To build without executing tests: -``` -mvn clean -mvn package -DskipTests -``` +1. Click on "File" -> "Open", choose your project location. +2. Open maven view by click "View" -> "Tool Windows" -> "Maven Projects". +3. Choose root module "hugegraph: Distributed Graph Database", unfold the menu of "Lifecycle". +4. Click the "Toggle 'Skip Tests' Mode" button which is located on the top navibar of "Maven Projects" window to skip tests. +5. Double click "package" or "install" to build a project. + +Could also refer [Dev-In-IDEA](https://hugegraph.apache.org/docs/contribution-guidelines/hugegraph-server-idea-setup/) for more details. -## Building on Eclipse IDE -Note that this has only been tested on Eclipse Neon.2 Release (4.6.2) with m2e (1.7.0.20160603-1933) and m2e-wtp (1.3.1.20160831-1005) plugin. +## Building in Eclipse +> Note: this has only been tested on Eclipse Neon.2 Release (4.6.2) with m2e (1.7.0.20160603-1933) and m2e-wtp (1.3.1.20160831-1005) plugin. To build without executing tests: 1. Right-click on your project -> "Run As..." -> "Run Configurations..." 2. On "Goals", populate with `install` 3. Select the options `Update Snapshots` and `Skip Tests` -4. Before clicking "Run", make sure that Eclipse knows where `JAVA_HOME` is. On same window, go to "Environment" tab and click "New". +4. Before clicking "Run", make sure that Eclipse knows where `JAVA_HOME` is. In the same window, go to "Environment" tab and click "New". 5. Under "Name:", add `JAVA_HOME` 6. Under "Value:", add the path where `java` is located 7. Click "OK" @@ -32,13 +39,3 @@ To find the Java binary in your environment, run the appropriate command for you * Linux/macOS: `which java` * Windows: `for %i in (java.exe) do @echo. %~$PATH:i` -## Building on IDEA - -To build without executing tests: - -1. Click on "File" -> "Open", choose your project location. -2. Open maven view by click "View" -> "Tool Windows" -> "Maven Projects". -3. Choose root module "hugegraph: Distributed Graph Database", unfold the menu of "Lifecycle". -4. Click the "Toggle 'Skip Tests' Mode" button which is located on the top -navibar of "Maven Projects" window to skip tests. -5. Double click "package" or "install" to build project. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7c57c765e..07d993cdd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,9 @@ # How to Contribute to HugeGraph -Thanks for taking the time to contribute! As an open source project, HugeGraph is looking forward to be contributed from everyone, -and we are also grateful to all the contributors. +> Refer [website-doc](https://hugegraph.apache.org/docs/contribution-guidelines/) for the latest information. + +Thanks for taking the time to contribute! +As an open source project, HugeGraph is looking forward to being contributed from everyone, and we are also grateful to all the contributors. The following is a contribution guide for HugeGraph: @@ -15,7 +17,7 @@ We can contribute by reporting issues, submitting code patches or any other feed Before submitting the code, we need to do some preparation: -1. Sign up or login to GitHub: [https://github.com](https://github.com) +1. Sign up or login to GitHub: [https://github.com](https://github.com) 2. Fork HugeGraph repo from GitHub: [https://github.com/apache/incubator-hugegraph/fork](https://github.com/apache/incubator-hugegraph/fork) @@ -69,21 +71,21 @@ vim hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFacto # run test locally (optional) mvn test -Pcore-test,memory ``` -Note: In order to be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml). +Note: To be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml). ##### 3.2.1 Check licenses If we want to add new third-party dependencies to the `HugeGraph` project, we need to do the following things: 1. Find the third-party dependent repository, put the dependent `license` file into [./hugegraph-dist/release-docs/licenses/](https://github.com/apache/incubator-hugegraph/tree/master/hugegraph-dist/release-docs/licenses) path. 2. Declare the dependency in [./hugegraph-server/hugegraph-dist/release-docs/LICENSE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/LICENSE) `LICENSE` information. 3. Find the NOTICE file in the repository and append it to [./hugegraph-server/hugegraph-dist/release-docs/NOTICE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/NOTICE) file (skip this step if there is no NOTICE file). -4. Execute locally [./hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) to update the dependency list [known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt) (or manually update) . +4. Execute locally [./hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) to update the dependency list [known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt) (or manually update). **Example**: A new third-party dependency is introduced into the project -> `ant-1.9.1.jar` - The project source code is located at: https://github.com/apache/ant/tree/rel/1.9.1 - LICENSE file: https://github.com/apache/ant/blob/rel/1.9.1/LICENSE - NOTICE file: https://github.com/apache/ant/blob/rel/1.9.1/NOTICE -The license information of `ant-1.9.1.jar` needs to be specified in the LICENSE file, and the notice information needs to be specified in the NOTICE file. The detailed LICENSE file corresponding to ant-1.9.1.jar needs to be copied to our licenses/ directory. Finally update the known-dependencies.txt file. +The license information of `ant-1.9.1.jar` needs to be specified in the LICENSE file, and the notice information needs to be specified in the NOTICE file. The detailed LICENSE file corresponding to ant-1.9.1.jar needs to be copied to our licenses/ directory. Finally, update the known-dependencies.txt file. #### 3.3 Commit changes to git repo @@ -105,7 +107,7 @@ Fix bug: run deploy multiple times fix #ISSUE_ID ``` -> Please remember to fill in the issue id, which was generated by GitHub after issue creation. +> Please remember to fill in the issue id, which GitHub generated after issue creation. #### 3.4 Push commit to GitHub fork repo @@ -121,7 +123,7 @@ Note that since GitHub requires submitting code through `username + token` (inst ## 4. Create a Pull Request -Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, just click button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message. +Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, click the button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message. Note: please make sure the email address you used to submit the code is bound to the GitHub account. For how to bind the email address, please refer to https://github.com/settings/emails: <img width="1280" alt="image" src="https://user-images.githubusercontent.com/9625821/163522445-2a50a72a-dea2-434f-9868-3a0d40d0d037.png"> @@ -131,7 +133,7 @@ Note: please make sure the email address you used to submit the code is bound to Maintainers will start the code review after all the **automatic** checks are passed: - Check: Contributor License Agreement is signed -- Check: Travis CI builds is passed (automatically Test and Deploy) +- Check: Travis CI builds are passed (automatically Test and Deploy) The commit will be accepted and merged if there is no problem after review. @@ -171,8 +173,8 @@ And push it to GitHub fork repo again: git push -f origin bugfix-branch:bugfix-branch ``` -GitHub will automatically update the Pull Request after we push it, just wait for code review. +GitHub will automatically update the Pull Request after we push it, wait for code review. -Any question please contact to us through [[email protected]](mailto:[email protected]) or [other contact information](https://hugegraph.github.io/hugegraph-doc/). +For Any question, please contact us through [[email protected]](mailto:[email protected]) ([subscriber](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/) only) diff --git a/README.md b/README.md index 61930248a..cf64cd674 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ achieved through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful We can use `docker run -itd --name=graph -p 8080:8080 hugegraph/hugegraph` to quickly start an inner HugeGraph server with `RocksDB` (in backgrounds) for **test/dev**. You can visit [doc page](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#3-deploy) or -the [README](hugegraph-server/hugegraph-dist/docker/READEME.md) for more details. ([Docker Compose](./hugegraph-server/hugegraph-dist/docker/example)) +the [README](hugegraph-server/hugegraph-dist/docker/README.md) for more details. ([Docker Compose](./hugegraph-server/hugegraph-dist/docker/example)) > Note: > diff --git a/docker/configs/application-pd0.yml b/docker/configs/application-pd0.yml new file mode 100644 index 000000000..6531cbafb --- /dev/null +++ b/docker/configs/application-pd0.yml @@ -0,0 +1,63 @@ +# +# 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' +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8686 + host: 127.0.0.1 + +server: + port: 8620 + +pd: + data-path: ./pd_data + patrol-interval: 1800 + initial-store-count: 3 + initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 + +raft: + address: 127.0.0.1:8610 + peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 + +store: + max-down-time: 172800 + monitor_data_enabled: true + monitor_data_interval: 1 minute + monitor_data_retention: 1 day + initial-store-count: 1 + +partition: + default-shard-count: 1 + store-max-shard-count: 12 diff --git a/docker/configs/application-pd1.yml b/docker/configs/application-pd1.yml new file mode 100644 index 000000000..0cf9f5429 --- /dev/null +++ b/docker/configs/application-pd1.yml @@ -0,0 +1,63 @@ +# +# 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' +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8687 + host: 127.0.0.1 + +server: + port: 8621 + +pd: + data-path: ./pd_data + patrol-interval: 1800 + initial-store-count: 3 + initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 + +raft: + address: 127.0.0.1:8611 + peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 + +store: + max-down-time: 172800 + monitor_data_enabled: true + monitor_data_interval: 1 minute + monitor_data_retention: 1 day + initial-store-count: 1 + +partition: + default-shard-count: 1 + store-max-shard-count: 12 diff --git a/docker/configs/application-pd2.yml b/docker/configs/application-pd2.yml new file mode 100644 index 000000000..a0d2c79ea --- /dev/null +++ b/docker/configs/application-pd2.yml @@ -0,0 +1,63 @@ +# +# 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' +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8688 + host: 127.0.0.1 + +server: + port: 8622 + +pd: + data-path: ./pd_data + patrol-interval: 1800 + initial-store-count: 3 + initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 + +raft: + address: 127.0.0.1:8612 + peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 + +store: + max-down-time: 172800 + monitor_data_enabled: true + monitor_data_interval: 1 minute + monitor_data_retention: 1 day + initial-store-count: 1 + +partition: + default-shard-count: 1 + store-max-shard-count: 12 diff --git a/docker/configs/application-store0.yml b/docker/configs/application-store0.yml new file mode 100644 index 000000000..d093f1bfb --- /dev/null +++ b/docker/configs/application-store0.yml @@ -0,0 +1,57 @@ +# +# 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: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + host: 127.0.0.1 + port: 8500 + netty-server: + max-inbound-message-size: 1000MB +raft: + disruptorBufferSize: 1024 + address: 127.0.0.1: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/configs/application-store1.yml b/docker/configs/application-store1.yml new file mode 100644 index 000000000..0aeba62cf --- /dev/null +++ b/docker/configs/application-store1.yml @@ -0,0 +1,57 @@ +# +# 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: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + host: 127.0.0.1 + port: 8501 + netty-server: + max-inbound-message-size: 1000MB +raft: + disruptorBufferSize: 1024 + address: 127.0.0.1:8511 + max-log-file-size: 600000000000 + snapshotInterval: 1800 +server: + port: 8521 + +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/configs/application-store2.yml b/docker/configs/application-store2.yml new file mode 100644 index 000000000..e18dc62a3 --- /dev/null +++ b/docker/configs/application-store2.yml @@ -0,0 +1,57 @@ +# +# 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: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + host: 127.0.0.1 + port: 8502 + netty-server: + max-inbound-message-size: 1000MB +raft: + disruptorBufferSize: 1024 + address: 127.0.0.1:8512 + max-log-file-size: 600000000000 + snapshotInterval: 1800 +server: + port: 8522 + +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/configs/server1-conf/graphs/hugegraph.properties b/docker/configs/server1-conf/graphs/hugegraph.properties new file mode 100644 index 000000000..66cbccb73 --- /dev/null +++ b/docker/configs/server1-conf/graphs/hugegraph.properties @@ -0,0 +1,19 @@ +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +vertex.cache_type=l2 +edge.cache_type=l2 + +store=hugegraph +backend=hstore +serializer=binary + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 diff --git a/docker/configs/server1-conf/gremlin-driver-settings.yaml b/docker/configs/server1-conf/gremlin-driver-settings.yaml new file mode 100644 index 000000000..2f60ff837 --- /dev/null +++ b/docker/configs/server1-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: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server1-conf/gremlin-server.yaml b/docker/configs/server1-conf/gremlin-server.yaml new file mode 100644 index 000000000..df73386b2 --- /dev/null +++ b/docker/configs/server1-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: 8181 + +# 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/configs/server1-conf/log4j2.xml b/docker/configs/server1-conf/log4j2.xml new file mode 100644 index 000000000..f1dd7e839 --- /dev/null +++ b/docker/configs/server1-conf/log4j2.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<!-- Config will be auto loaded every 60s --> +<configuration status="error" monitorInterval="60"> + <properties> + <property name="LOG_PATH">logs</property> + <property name="FILE_NAME">hugegraph-server</property> + </properties> + + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + </Console> + + <!-- Normal server log config --> + <RollingRandomAccessFile name="file" fileName="${LOG_PATH}/${FILE_NAME}.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + <!-- Trigger after exceeding 1day or 50MB --> + <Policies> + <SizeBasedTriggeringPolicy size="50MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 5 files per day & auto delete after over 2GB or 100 files --> + <DefaultRolloverStrategy max="5"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.log"/> + <!-- Limit log amount & size --> + <IfAny> + <IfAccumulatedFileSize exceeds="2GB"/> + <IfAccumulatedFileCount exceeds="100"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + + <!-- Separate & compress audit log, buffer size is 512KB --> + <RollingRandomAccessFile name="audit" fileName="${LOG_PATH}/audit-${FILE_NAME}.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz" + bufferSize="524288" immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <!-- Use simple format for audit log to speed up --> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} - %m%n"/> + <!-- Trigger after exceeding 1hour or 500MB --> + <Policies> + <SizeBasedTriggeringPolicy size="500MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 2 files per hour & auto delete [after 60 days] or [over 5GB or 500 files] --> + <DefaultRolloverStrategy max="2"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.gz"/> + <IfLastModified age="60d"/> + <IfAny> + <IfAccumulatedFileSize exceeds="5GB"/> + <IfAccumulatedFileCount exceeds="500"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + + <!-- Slow query log config --> + <RollingRandomAccessFile name="slowQueryLog" fileName="${LOG_PATH}/slow_query.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/slow_query_log-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + <!-- Trigger after exceeding 1day or 50MB --> + <Policies> + <SizeBasedTriggeringPolicy size="50MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 5 files per day & auto delete after over 2GB or 100 files --> + <DefaultRolloverStrategy max="5"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.log"/> + <!-- Limit log amount & size --> + <IfAny> + <IfAccumulatedFileSize exceeds="2GB"/> + <IfAccumulatedFileCount exceeds="100"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + </appenders> + + <loggers> + <root level="INFO"> + <appender-ref ref="file"/> + </root> + <logger name="org.apache.cassandra" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.hadoop" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.zookeeper" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="com.datastax.driver" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="com.alipay.sofa" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="io.netty" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.commons" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <!-- Use mixed async way to output logs --> + <AsyncLogger name="org.apache.hugegraph" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.auth" level="INFO" additivity="false"> + <appender-ref ref="audit"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.api.filter.AuthenticationFilter" level="INFO" additivity="false"> + <appender-ref ref="audit"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.api.filter.AccessLogFilter" level="INFO" additivity="false"> + <appender-ref ref="slowQueryLog"/> + </AsyncLogger> + </loggers> +</configuration> diff --git a/docker/configs/server1-conf/remote-objects.yaml b/docker/configs/server1-conf/remote-objects.yaml new file mode 100644 index 000000000..94ebc9919 --- /dev/null +++ b/docker/configs/server1-conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# 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: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/docker/configs/server1-conf/remote.yaml b/docker/configs/server1-conf/remote.yaml new file mode 100644 index 000000000..2f60ff837 --- /dev/null +++ b/docker/configs/server1-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: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server1-conf/rest-server.properties b/docker/configs/server1-conf/rest-server.properties new file mode 100644 index 000000000..6e2257ce9 --- /dev/null +++ b/docker/configs/server1-conf/rest-server.properties @@ -0,0 +1,28 @@ +# bind url +restserver.url=http://127.0.0.1:8081 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8181 + +graphs=./conf/graphs + +# 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= + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8091 + +# lightweight load balancing (beta) +server.id=server-1 +server.role=master + +# slow query log +log.slow_query_threshold=1000 diff --git a/docker/configs/server2-conf/graphs/hugegraph.properties b/docker/configs/server2-conf/graphs/hugegraph.properties new file mode 100644 index 000000000..66cbccb73 --- /dev/null +++ b/docker/configs/server2-conf/graphs/hugegraph.properties @@ -0,0 +1,19 @@ +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +vertex.cache_type=l2 +edge.cache_type=l2 + +store=hugegraph +backend=hstore +serializer=binary + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 diff --git a/docker/configs/server2-conf/gremlin-driver-settings.yaml b/docker/configs/server2-conf/gremlin-driver-settings.yaml new file mode 100644 index 000000000..55f38ab97 --- /dev/null +++ b/docker/configs/server2-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: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server2-conf/gremlin-server.yaml b/docker/configs/server2-conf/gremlin-server.yaml new file mode 100644 index 000000000..048dded55 --- /dev/null +++ b/docker/configs/server2-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/configs/server2-conf/log4j2.xml b/docker/configs/server2-conf/log4j2.xml new file mode 100644 index 000000000..f1dd7e839 --- /dev/null +++ b/docker/configs/server2-conf/log4j2.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<!-- Config will be auto loaded every 60s --> +<configuration status="error" monitorInterval="60"> + <properties> + <property name="LOG_PATH">logs</property> + <property name="FILE_NAME">hugegraph-server</property> + </properties> + + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + </Console> + + <!-- Normal server log config --> + <RollingRandomAccessFile name="file" fileName="${LOG_PATH}/${FILE_NAME}.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + <!-- Trigger after exceeding 1day or 50MB --> + <Policies> + <SizeBasedTriggeringPolicy size="50MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 5 files per day & auto delete after over 2GB or 100 files --> + <DefaultRolloverStrategy max="5"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.log"/> + <!-- Limit log amount & size --> + <IfAny> + <IfAccumulatedFileSize exceeds="2GB"/> + <IfAccumulatedFileCount exceeds="100"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + + <!-- Separate & compress audit log, buffer size is 512KB --> + <RollingRandomAccessFile name="audit" fileName="${LOG_PATH}/audit-${FILE_NAME}.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz" + bufferSize="524288" immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <!-- Use simple format for audit log to speed up --> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} - %m%n"/> + <!-- Trigger after exceeding 1hour or 500MB --> + <Policies> + <SizeBasedTriggeringPolicy size="500MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 2 files per hour & auto delete [after 60 days] or [over 5GB or 500 files] --> + <DefaultRolloverStrategy max="2"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.gz"/> + <IfLastModified age="60d"/> + <IfAny> + <IfAccumulatedFileSize exceeds="5GB"/> + <IfAccumulatedFileCount exceeds="500"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + + <!-- Slow query log config --> + <RollingRandomAccessFile name="slowQueryLog" fileName="${LOG_PATH}/slow_query.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/slow_query_log-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + <!-- Trigger after exceeding 1day or 50MB --> + <Policies> + <SizeBasedTriggeringPolicy size="50MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 5 files per day & auto delete after over 2GB or 100 files --> + <DefaultRolloverStrategy max="5"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.log"/> + <!-- Limit log amount & size --> + <IfAny> + <IfAccumulatedFileSize exceeds="2GB"/> + <IfAccumulatedFileCount exceeds="100"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + </appenders> + + <loggers> + <root level="INFO"> + <appender-ref ref="file"/> + </root> + <logger name="org.apache.cassandra" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.hadoop" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.zookeeper" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="com.datastax.driver" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="com.alipay.sofa" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="io.netty" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.commons" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <!-- Use mixed async way to output logs --> + <AsyncLogger name="org.apache.hugegraph" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.auth" level="INFO" additivity="false"> + <appender-ref ref="audit"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.api.filter.AuthenticationFilter" level="INFO" additivity="false"> + <appender-ref ref="audit"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.api.filter.AccessLogFilter" level="INFO" additivity="false"> + <appender-ref ref="slowQueryLog"/> + </AsyncLogger> + </loggers> +</configuration> diff --git a/docker/configs/server2-conf/remote-objects.yaml b/docker/configs/server2-conf/remote-objects.yaml new file mode 100644 index 000000000..39679d8c3 --- /dev/null +++ b/docker/configs/server2-conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# 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: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/docker/configs/server2-conf/remote.yaml b/docker/configs/server2-conf/remote.yaml new file mode 100644 index 000000000..55f38ab97 --- /dev/null +++ b/docker/configs/server2-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: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server2-conf/rest-server.properties b/docker/configs/server2-conf/rest-server.properties new file mode 100644 index 000000000..e55fb6b63 --- /dev/null +++ b/docker/configs/server2-conf/rest-server.properties @@ -0,0 +1,26 @@ +# bind url +restserver.url=http://127.0.0.1:8082 +# 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 + +# configuration of arthas +arthas.telnet_port=8572 +arthas.http_port=8571 +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= + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8092 +#rpc.server_timeout=30 + +# lightweight load balancing (beta) +server.id=server-2 +server.role=worker diff --git a/docker/configs/server3-conf/graphs/hugegraph.properties b/docker/configs/server3-conf/graphs/hugegraph.properties new file mode 100644 index 000000000..66cbccb73 --- /dev/null +++ b/docker/configs/server3-conf/graphs/hugegraph.properties @@ -0,0 +1,19 @@ +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +vertex.cache_type=l2 +edge.cache_type=l2 + +store=hugegraph +backend=hstore +serializer=binary + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 diff --git a/docker/configs/server3-conf/gremlin-driver-settings.yaml b/docker/configs/server3-conf/gremlin-driver-settings.yaml new file mode 100644 index 000000000..00ef04669 --- /dev/null +++ b/docker/configs/server3-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: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server3-conf/gremlin-server.yaml b/docker/configs/server3-conf/gremlin-server.yaml new file mode 100644 index 000000000..e153926bc --- /dev/null +++ b/docker/configs/server3-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: 8183 + +# 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/configs/server3-conf/log4j2.xml b/docker/configs/server3-conf/log4j2.xml new file mode 100644 index 000000000..f1dd7e839 --- /dev/null +++ b/docker/configs/server3-conf/log4j2.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<!-- Config will be auto loaded every 60s --> +<configuration status="error" monitorInterval="60"> + <properties> + <property name="LOG_PATH">logs</property> + <property name="FILE_NAME">hugegraph-server</property> + </properties> + + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + </Console> + + <!-- Normal server log config --> + <RollingRandomAccessFile name="file" fileName="${LOG_PATH}/${FILE_NAME}.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + <!-- Trigger after exceeding 1day or 50MB --> + <Policies> + <SizeBasedTriggeringPolicy size="50MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 5 files per day & auto delete after over 2GB or 100 files --> + <DefaultRolloverStrategy max="5"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.log"/> + <!-- Limit log amount & size --> + <IfAny> + <IfAccumulatedFileSize exceeds="2GB"/> + <IfAccumulatedFileCount exceeds="100"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + + <!-- Separate & compress audit log, buffer size is 512KB --> + <RollingRandomAccessFile name="audit" fileName="${LOG_PATH}/audit-${FILE_NAME}.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz" + bufferSize="524288" immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <!-- Use simple format for audit log to speed up --> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} - %m%n"/> + <!-- Trigger after exceeding 1hour or 500MB --> + <Policies> + <SizeBasedTriggeringPolicy size="500MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 2 files per hour & auto delete [after 60 days] or [over 5GB or 500 files] --> + <DefaultRolloverStrategy max="2"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.gz"/> + <IfLastModified age="60d"/> + <IfAny> + <IfAccumulatedFileSize exceeds="5GB"/> + <IfAccumulatedFileCount exceeds="500"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + + <!-- Slow query log config --> + <RollingRandomAccessFile name="slowQueryLog" fileName="${LOG_PATH}/slow_query.log" + filePattern="${LOG_PATH}/$${date:yyyy-MM}/slow_query_log-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> + <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> + <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/> + <!-- Trigger after exceeding 1day or 50MB --> + <Policies> + <SizeBasedTriggeringPolicy size="50MB"/> + <TimeBasedTriggeringPolicy interval="1" modulate="true"/> + </Policies> + <!-- Keep 5 files per day & auto delete after over 2GB or 100 files --> + <DefaultRolloverStrategy max="5"> + <Delete basePath="${LOG_PATH}" maxDepth="2"> + <IfFileName glob="*/*.log"/> + <!-- Limit log amount & size --> + <IfAny> + <IfAccumulatedFileSize exceeds="2GB"/> + <IfAccumulatedFileCount exceeds="100"/> + </IfAny> + </Delete> + </DefaultRolloverStrategy> + </RollingRandomAccessFile> + </appenders> + + <loggers> + <root level="INFO"> + <appender-ref ref="file"/> + </root> + <logger name="org.apache.cassandra" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.hadoop" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.zookeeper" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="com.datastax.driver" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="com.alipay.sofa" level="WARN" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="io.netty" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <logger name="org.apache.commons" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </logger> + <!-- Use mixed async way to output logs --> + <AsyncLogger name="org.apache.hugegraph" level="INFO" additivity="false"> + <appender-ref ref="file"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.auth" level="INFO" additivity="false"> + <appender-ref ref="audit"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.api.filter.AuthenticationFilter" level="INFO" additivity="false"> + <appender-ref ref="audit"/> + </AsyncLogger> + <AsyncLogger name="org.apache.hugegraph.api.filter.AccessLogFilter" level="INFO" additivity="false"> + <appender-ref ref="slowQueryLog"/> + </AsyncLogger> + </loggers> +</configuration> diff --git a/docker/configs/server3-conf/remote-objects.yaml b/docker/configs/server3-conf/remote-objects.yaml new file mode 100644 index 000000000..ce99fcb2f --- /dev/null +++ b/docker/configs/server3-conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# 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: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/docker/configs/server3-conf/remote.yaml b/docker/configs/server3-conf/remote.yaml new file mode 100644 index 000000000..00ef04669 --- /dev/null +++ b/docker/configs/server3-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: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server3-conf/rest-server.properties b/docker/configs/server3-conf/rest-server.properties new file mode 100644 index 000000000..af1d7301d --- /dev/null +++ b/docker/configs/server3-conf/rest-server.properties @@ -0,0 +1,25 @@ +# bind url +restserver.url=http://127.0.0.1:8083 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8183 + +graphs=./conf/graphs + +# configuration of arthas +arthas.telnet_port=8582 +arthas.http_port=8581 +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= + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8093 + +# lightweight load balancing (beta) +server.id=server-3 +server.role=worker diff --git a/docker/docker-compose-3pd-3store-3server.yml b/docker/docker-compose-3pd-3store-3server.yml new file mode 100644 index 000000000..f704c1c0f --- /dev/null +++ b/docker/docker-compose-3pd-3store-3server.yml @@ -0,0 +1,180 @@ +# +# 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. +# + +# TODO: reuse the configs for same type containers +# User could modify the node nums and the port by themselves +version: "3" + +services: + pd0: + image: hugegraph/pd + container_name: pd0 + hostname: pd0 + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8620"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-pd0.yml:/hugegraph-pd/conf/application.yml + + pd1: + image: hugegraph/pd + container_name: pd1 + hostname: pd1 + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8621"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-pd1.yml:/hugegraph-pd/conf/application.yml + + pd2: + image: hugegraph/pd + container_name: pd2 + hostname: pd2 + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8622"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-pd2.yml:/hugegraph-pd/conf/application.yml + + store0: + image: hugegraph/store + container_name: store0 + hostname: store0 + network_mode: host + depends_on: + pd0: + condition: service_healthy + pd1: + condition: service_healthy + pd2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8520"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-store0.yml:/hugegraph-store/conf/application.yml + + store1: + image: hugegraph/store + container_name: store1 + hostname: store1 + network_mode: host + depends_on: + pd0: + condition: service_healthy + pd1: + condition: service_healthy + pd2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8521"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-store1.yml:/hugegraph-store/conf/application.yml + + store2: + image: hugegraph/store + container_name: store2 + hostname: store2 + network_mode: host + depends_on: + pd0: + condition: service_healthy + pd1: + condition: service_healthy + pd2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8522"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-store2.yml:/hugegraph-store/conf/application.yml + + server1: + image: hugegraph/server + container_name: server1 + hostname: server1 + network_mode: host + depends_on: + store0: + condition: service_healthy + store1: + condition: service_healthy + store2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8081"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/server1-conf:/hugegraph-server/conf + + server2: + image: hugegraph/server + container_name: server2 + hostname: server2 + network_mode: host + depends_on: + store0: + condition: service_healthy + store1: + condition: service_healthy + store2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8082"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/server2-conf:/hugegraph-server/conf + + server3: + image: hugegraph/server + container_name: server3 + hostname: server3 + network_mode: host + depends_on: + store0: + condition: service_healthy + store1: + condition: service_healthy + store2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8083"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/server3-conf:/hugegraph-server/conf diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..0c90c1e45 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,58 @@ +# +# 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. +# + +version: "3" + +services: + pd: + image: hugegraph/pd + container_name: pd + hostname: pd + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8620"] + interval: 10s + timeout: 5s + retries: 3 + + store: + image: hugegraph/store + container_name: store + hostname: store + network_mode: host + depends_on: + pd: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8520"] + interval: 10s + timeout: 5s + retries: 3 + + server: + image: hugegraph/server + container_name: server + hostname: server + network_mode: host + depends_on: + store: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080"] + interval: 10s + timeout: 5s + retries: 3 diff --git a/hugegraph-server/Dockerfile b/hugegraph-pd/Dockerfile similarity index 69% copy from hugegraph-server/Dockerfile copy to hugegraph-pd/Dockerfile index 8eef58c5f..b9cdb2209 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-pd/Dockerfile @@ -15,7 +15,7 @@ # limitations under the License. # -# Dockerfile for HugeGraph Server +# Dockerfile for HugeGraph PD # 1st stage: build source code FROM maven:3.9.0-eclipse-temurin-11 AS build @@ -23,21 +23,22 @@ COPY . /pkg WORKDIR /pkg ARG MAVEN_ARGS -RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm ./hugegraph-server/*.tar.gz +RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ + ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/dist/*.tar.gz && rm ./hugegraph-store/dist/*.tar.gz # 2nd stage: runtime env -# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 +# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 FROM openjdk:11-slim -COPY --from=build /pkg/hugegraph-server/apache-hugegraph-incubating-*/ /hugegraph-server/ +COPY --from=build /pkg/hugegraph-pd/dist/hugegraph-pd-*/ /hugegraph-pd/ LABEL maintainer="HugeGraph Docker Maintainers <[email protected]>" # TODO: use g1gc or zgc as default ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ - HUGEGRAPH_HOME="hugegraph" + HUGEGRAPH_HOME="hugegraph-pd" -#COPY . /hugegraph/hugegraph-server -WORKDIR /hugegraph-server/ +#COPY . /hugegraph/hugegraph-pd +WORKDIR /hugegraph-pd/ # 1. Install environment and init HugeGraph Sever RUN set -x \ @@ -52,17 +53,14 @@ RUN set -x \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && service cron start \ - && pwd && cd /hugegraph-server/ \ - && sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g" ./conf/rest-server.properties + && pwd && cd /hugegraph-pd/ # 2. Init docker script -COPY hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy ./scripts -COPY hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy ./scripts -COPY hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh . -RUN chmod 755 ./docker-entrypoint.sh +COPY hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh -EXPOSE 8080 -VOLUME /hugegraph-server +EXPOSE 8620 +VOLUME /hugegraph-pd ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["./docker-entrypoint.sh"] diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh similarity index 50% copy from hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh copy to hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh index efd6a4f8e..fd894d551 100644 --- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -16,31 +16,7 @@ # limitations under the License. # -# create a folder to save the docker-related file -DOCKER_FOLDER='./docker' -mkdir -p $DOCKER_FOLDER - -INIT_FLAG_FILE="init_complete" - -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" - ./bin/init-store.sh - else - echo "init hugegraph with auth mode" - ./bin/enable-auth.sh - echo "$PASSWORD" | ./bin/init-store.sh - fi - # create a flag file to avoid re-init when restarting - touch ${DOCKER_FOLDER}/${INIT_FLAG_FILE} -else - echo "Hugegraph Initialization already done. Skipping re-init..." -fi - -# start hugegraph -# remove "-g zgc" now, which is only available on ARM-Mac with java > 13 -./bin/start-hugegraph.sh -j "$JAVA_OPTS" +# start hugegraph pd +./bin/start-hugegraph-pd.sh -j "$JAVA_OPTS" tail -f /dev/null diff --git a/hugegraph-server/Dockerfile b/hugegraph-server/Dockerfile index 8eef58c5f..deb31fe0a 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-server/Dockerfile @@ -23,7 +23,8 @@ COPY . /pkg WORKDIR /pkg ARG MAVEN_ARGS -RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm ./hugegraph-server/*.tar.gz +RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ + ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/dist/*.tar.gz && rm ./hugegraph-store/dist/*.tar.gz # 2nd stage: runtime env # Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 @@ -34,7 +35,7 @@ LABEL maintainer="HugeGraph Docker Maintainers <[email protected]>" # TODO: use g1gc or zgc as default ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ - HUGEGRAPH_HOME="hugegraph" + HUGEGRAPH_HOME="hugegraph-server" #COPY . /hugegraph/hugegraph-server WORKDIR /hugegraph-server/ @@ -59,7 +60,7 @@ RUN set -x \ COPY hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy ./scripts COPY hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy ./scripts COPY hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh . -RUN chmod 755 ./docker-entrypoint.sh +RUN chmod 755 ./docker-entrypoint.sh EXPOSE 8080 VOLUME /hugegraph-server diff --git a/hugegraph-server/hugegraph-dist/docker/README.md b/hugegraph-server/hugegraph-dist/docker/README.md index b9547d498..69df6b43c 100644 --- a/hugegraph-server/hugegraph-dist/docker/README.md +++ b/hugegraph-server/hugegraph-dist/docker/README.md @@ -4,7 +4,7 @@ > > 1. The docker image of hugegraph is a convenience release, not official > distribution artifacts from ASF. You can find more details from [ASF Release > Distribution > Policy](https://infra.apache.org/release-distribution.html#dockerhub). > -> 2. Recommend to use `release tag`(like `1.2.0`) for the stable version. Use `latest` tag to experience the newest functions in development. +> 2. Recommend to use `release tag` (like `1.3.0`) for the stable version. Use `latest` tag to experience the newest functions in development. ## 1. Deploy @@ -35,7 +35,7 @@ If you want to customize the preloaded data, please mount the groovy scripts (no 1. Using docker run - Use `docker run -itd --name=graph -p 8080:8080 -e PRELOAD=true -v /path/to/yourScript:/hugegraph/scripts/example.groovy hugegraph/hugegraph` + Use `docker run -itd --name=graph -p 8080:8080 -e PRELOAD=true -v /path/to/script:/hugegraph-server/scripts/example.groovy hugegraph/hugegraph` to start hugegraph server. 2. Using docker compose @@ -50,7 +50,7 @@ If you want to customize the preloaded data, please mount the groovy scripts (no environment: - PRELOAD=true volumes: - - /path/to/yourscript:/hugegraph/scripts/example.groovy + - /path/to/script:/hugegraph-server/scripts/example.groovy ports: - 8080:8080 ``` diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh index efd6a4f8e..60cd4bc16 100644 --- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh +++ b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh @@ -39,7 +39,7 @@ else echo "Hugegraph Initialization already done. Skipping re-init..." fi -# start hugegraph +# start hugegraph-server # remove "-g zgc" now, which is only available on ARM-Mac with java > 13 ./bin/start-hugegraph.sh -j "$JAVA_OPTS" diff --git a/hugegraph-server/Dockerfile b/hugegraph-store/Dockerfile similarity index 69% copy from hugegraph-server/Dockerfile copy to hugegraph-store/Dockerfile index 8eef58c5f..2fa9e3fc0 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-store/Dockerfile @@ -15,7 +15,7 @@ # limitations under the License. # -# Dockerfile for HugeGraph Server +# Dockerfile for HugeGraph Store # 1st stage: build source code FROM maven:3.9.0-eclipse-temurin-11 AS build @@ -23,21 +23,22 @@ COPY . /pkg WORKDIR /pkg ARG MAVEN_ARGS -RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm ./hugegraph-server/*.tar.gz +RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ + ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/dist/*.tar.gz && rm ./hugegraph-store/dist/*.tar.gz # 2nd stage: runtime env -# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 +# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 FROM openjdk:11-slim -COPY --from=build /pkg/hugegraph-server/apache-hugegraph-incubating-*/ /hugegraph-server/ +COPY --from=build /pkg/hugegraph-store/dist/hugegraph-store-*/ /hugegraph-store/ LABEL maintainer="HugeGraph Docker Maintainers <[email protected]>" # TODO: use g1gc or zgc as default ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ - HUGEGRAPH_HOME="hugegraph" + HUGEGRAPH_HOME="hugegraph-store" -#COPY . /hugegraph/hugegraph-server -WORKDIR /hugegraph-server/ +#COPY . /hugegraph/hugegraph-store +WORKDIR /hugegraph-store/ # 1. Install environment and init HugeGraph Sever RUN set -x \ @@ -52,17 +53,14 @@ RUN set -x \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && service cron start \ - && pwd && cd /hugegraph-server/ \ - && sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g" ./conf/rest-server.properties + && pwd && cd /hugegraph-store/ # 2. Init docker script -COPY hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy ./scripts -COPY hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy ./scripts -COPY hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh . -RUN chmod 755 ./docker-entrypoint.sh +COPY hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh -EXPOSE 8080 -VOLUME /hugegraph-server +EXPOSE 8520 +VOLUME /hugegraph-store ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["./docker-entrypoint.sh"] diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh similarity index 50% copy from hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh copy to hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh index efd6a4f8e..5aa77621d 100644 --- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh +++ b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh @@ -16,31 +16,7 @@ # limitations under the License. # -# create a folder to save the docker-related file -DOCKER_FOLDER='./docker' -mkdir -p $DOCKER_FOLDER - -INIT_FLAG_FILE="init_complete" - -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" - ./bin/init-store.sh - else - echo "init hugegraph with auth mode" - ./bin/enable-auth.sh - echo "$PASSWORD" | ./bin/init-store.sh - fi - # create a flag file to avoid re-init when restarting - touch ${DOCKER_FOLDER}/${INIT_FLAG_FILE} -else - echo "Hugegraph Initialization already done. Skipping re-init..." -fi - -# start hugegraph -# remove "-g zgc" now, which is only available on ARM-Mac with java > 13 -./bin/start-hugegraph.sh -j "$JAVA_OPTS" +# start hugegraph store +./bin/start-hugegraph-store.sh -j "$JAVA_OPTS" tail -f /dev/null
