- Notifications
You must be signed in to change notification settings - Fork 567
feat: support Cassandra with docker-compose in server #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
9e5f1ee 3be461b 137d004 2fdd40f ffa1779 a01d0e4 d924508 5e4c8e6 94a6351 da46a0f File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with this | ||
| # work for additional information regarding copyright ownership. The ASF | ||
| # licenses this file to You under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| | ||
| | ||
| ./bin/wait-storage.sh | ||
| | ||
| ./bin/init-store.sh | ||
| | ||
| ./bin/start-hugegraph.sh -d false -j "$JAVA_OPTS" -g zgc |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # | ||
| # 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: | ||
| graph: | ||
| image: hugegraph/hugegraph | ||
| container_name: cas-graph | ||
| ports: | ||
| - 18080:8080 | ||
| environment: | ||
| hugegraph.backend: cassandra | ||
| hugegraph.serializer: cassandra | ||
| hugegraph.cassandra.host: cas-cassandra | ||
| hugegraph.cassandra.port: 9042 | ||
| networks: | ||
| - ca-network | ||
| depends_on: | ||
| - cassandra | ||
| healthcheck: | ||
| test: ["CMD", "bin/gremlin-console.sh", "--" ,"-e", "scripts/remote-connect.groovy"] | ||
| interval: 10s | ||
| timeout: 30s | ||
| retries: 3 | ||
| | ||
| cassandra: | ||
| image: cassandra:4 | ||
| container_name: cas-cassandra | ||
| ports: | ||
| - 7000:7000 | ||
| - 9042:9042 | ||
| security_opt: | ||
| - seccomp:unconfined | ||
| networks: | ||
| - ca-network | ||
| healthcheck: | ||
| test: ["CMD", "cqlsh", "--execute", "describe keyspaces;"] | ||
| interval: 10s | ||
| timeout: 30s | ||
| retries: 5 | ||
| | ||
| networks: | ||
| ca-network: | ||
| | ||
| volumes: | ||
| hugegraph-data: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
| | ||
| :remote connect tinkerpop.server conf/remote.yaml | ||
| :> hugegraph |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with this | ||
| * work for additional information regarding copyright ownership. The ASF | ||
| * licenses this file to You under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| | ||
| import org.apache.hugegraph.HugeFactory | ||
| import org.apache.hugegraph.dist.RegisterUtil | ||
| | ||
| // register all the backend to avoid changes if docker needs to support othre backend | ||
| RegisterUtil.registerPlugins() | ||
| RegisterUtil.registerRocksDB() | ||
| RegisterUtil.registerCassandra() | ||
| RegisterUtil.registerScyllaDB() | ||
| RegisterUtil.registerHBase() | ||
| RegisterUtil.registerMysql() | ||
| RegisterUtil.registerPalo() | ||
| RegisterUtil.registerPostgresql() | ||
| | ||
| graph = HugeFactory.open('./conf/graphs/hugegraph.properties') | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we rename this file to Contributor Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. And "detect" seems better than "try". I have applied the change. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with this | ||
| # work for additional information regarding copyright ownership. The ASF | ||
| # licenses this file to You under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| | ||
| | ||
| ./bin/wait-storage.sh | ||
| | ||
| ./bin/init-store.sh | ||
| | ||
| ./bin/start-hugegraph.sh -d false -j "$JAVA_OPTS" -g zgc | ||
| Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the params here? could we get the value of Contributor Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JAVA_OPTS is an env var which is set in dockerfile. And this shell is only used in dockerfile, hence I think this way is available. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with this | ||
| # work for additional information regarding copyright ownership. The ASF | ||
| # licenses this file to You under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| | ||
| function abs_path() { | ||
| SOURCE="${BASH_SOURCE[0]}" | ||
| while [[ -h "$SOURCE" ]]; do | ||
| DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)" | ||
| SOURCE="$(readlink "$SOURCE")" | ||
| [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" | ||
| done | ||
| cd -P "$(dirname "$SOURCE")" && pwd | ||
| } | ||
| | ||
| BIN=$(abs_path) | ||
| TOP="$(cd "$BIN"/../ && pwd)" | ||
| GRAPH_PROP="$TOP/conf/graphs/hugegraph.properties" | ||
| ||
| HUGE_STORAGE_TIMEOUT_S=120 | ||
| ||
| TRY_STORAGE="$TOP/scripts/try-storage.groovy" | ||
| | ||
| . "$BIN"/util.sh | ||
| | ||
| # apply config from env | ||
| while IFS=' ' read -r envvar_key envvar_val; do | ||
| if [[ "${envvar_key}" =~ hugegraph\. ]] && [[ ! -z ${envvar_val} ]]; then | ||
| envvar_key=${envvar_key#"hugegraph."} | ||
| if grep -q -E "^\s*${envvar_key}\s*=\.*" ${GRAPH_PROP}; then | ||
| sed -ri "s#^(\s*${envvar_key}\s*=).*#\\1${envvar_val}#" ${GRAPH_PROP} | ||
| else | ||
| echo "${envvar_key}=${envvar_val}" >> ${GRAPH_PROP} | ||
| fi | ||
| else | ||
| continue | ||
| fi | ||
| done < <(env | sort -r | awk -F= '{ st = index($0, "="); print $1 " " substr($0, st+1) }') | ||
| | ||
| # wait for storage | ||
| if ! [ -z "${HUGE_STORAGE_TIMEOUT_S:-}" ]; then | ||
| timeout "${HUGE_STORAGE_TIMEOUT_S}s" bash -c \ | ||
| "until bin/gremlin-console.sh -- -e $TRY_STORAGE > /dev/null 2>&1; do echo \"waiting for storage...\"; sleep 5; done" | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need
-e?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://tinkerpop.apache.org/docs/3.6.2-SNAPSHOT/reference/#execution-mode
-eis for the gremlin console to use the execution mode to execute scripts.