Skip to content
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

Add support for Tablestore from Alicloud as the new storage backend #4721

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/configs/janusgraph-cfg.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ HBase storage options
| storage.hbase.short-cf-names | Whether to shorten the names of JanusGraph's column families to one-character mnemonics to conserve storage space | Boolean | true | FIXED |
| storage.hbase.skip-schema-check | Assume that JanusGraph's HBase table and column families already exist. When this is true, JanusGraph will not check for the existence of its table/CFs, nor will it attempt to create them under any circumstances. This is useful when running JanusGraph without HBase admin privileges. | Boolean | false | MASKABLE |
| storage.hbase.snapshot-name | The name of an existing HBase snapshot to be used by HBaseSnapshotInputFormat | String | janusgraph-snapshot | LOCAL |
| storage.hbase.snapshot-restore-dir | The temporary directory to be used by HBaseSnapshotInputFormat to restore a snapshot. This directory should be on the same File System as the HBase root dir. | String | /tmp | LOCAL |
| storage.hbase.snapshot-restore-dir | The temporary directory to be used by HBaseSnapshotInputFormat to restore a snapshot. This directory should be on the same File System as the HBase root dir. | String | /var/folders/1t/1106nwhx4x95p3l9vw7kml4c0000gp/T/ | LOCAL |
| storage.hbase.table | The name of the table JanusGraph will use. When storage.hbase.skip-schema-check is false, JanusGraph will automatically create this table if it does not already exist. If this configuration option is not provided but graph.graphname is, the table will be set to that value. | String | janusgraph | LOCAL |

### storage.lock
Expand Down
42 changes: 42 additions & 0 deletions janusgraph-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,48 @@
<artifactId>janusgraph-bigtable</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-tablestore</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>2.5.10</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.jruby.jcodings</groupId>
<artifactId>jcodings</artifactId>
</exclusion>
<exclusion>
<groupId>org.jruby.jcodings</groupId>
<artifactId>jcodings</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-hadoop</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void loadStandard(Class<?> caller) {
*/
List<String> classnames = Collections.unmodifiableList(Arrays.asList(
"org.janusgraph.diskstorage.hbase.HBaseStoreManager",
"org.janusgraph.diskstorage.tablestore.TableStoreStoreManager",
"org.janusgraph.diskstorage.cql.CQLConfigOptions",
"org.janusgraph.diskstorage.es.ElasticSearchIndex",
"org.janusgraph.diskstorage.solr.SolrIndex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public class Backend implements LockerProvider, AutoCloseable {
put(StandardStoreManager.BDB_JE, STORAGE_DIRECTORY);
put(StandardStoreManager.CQL, STORAGE_HOSTS);
put(StandardStoreManager.HBASE, STORAGE_HOSTS);
put(StandardStoreManager.TABLESTORE,STORAGE_HOSTS);
//put(StandardStorageBackend.IN_MEMORY, null);
put(StandardStoreManager.SCYLLA, STORAGE_HOSTS);
}});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public enum StandardStoreManager {
BDB_JE("org.janusgraph.diskstorage.berkeleyje.BerkeleyJEStoreManager", "berkeleyje"),
CQL("org.janusgraph.diskstorage.cql.CQLStoreManager", "cql"),
HBASE("org.janusgraph.diskstorage.hbase.HBaseStoreManager", "hbase"),
TABLESTORE("org.janusgraph.diskstorage.tablestore.TableStoreStoreManager", "tablestore"),
IN_MEMORY("org.janusgraph.diskstorage.inmemory.InMemoryStoreManager", "inmemory"),
SCYLLA("org.janusgraph.diskstorage.cql.ScyllaStoreManager", "scylla");

Expand Down
2 changes: 1 addition & 1 deletion janusgraph-dist/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FROM debian:buster-slim as builder

ARG TARGETARCH
ARG JANUS_VERSION=1.0.0-SNAPSHOT
ARG BUILD_PATH=janusgraph-java-11-1.0.0-SNAPSHOT
ARG BUILD_PATH=janusgraph-full-1.1.0-SNAPSHOT
ARG YQ_VERSION=3.4.1

ENV JANUS_VERSION=${JANUS_VERSION} \
Expand Down
46 changes: 0 additions & 46 deletions janusgraph-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -252,52 +252,6 @@
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>generate-janusgraph-config-table</id>
<phase>generate-resources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.janusgraph.util.system.ConfigurationPrinter</mainClass>
<arguments>
<argument>org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.ROOT_NS</argument>
<argument>${doc.dir}/configs/janusgraph-cfg.md</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>run-cfilter</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<!-- Classpath -->
<argument>-classpath</argument>
<classpath/>
<!-- Main Classname -->
<mainClass>org.janusgraph.util.system.ConfigurationFileFilter</mainClass>
<!-- Input directory (processed recursively) -->
<argument>${assembly.cfilter.in.dir}</argument>
<!-- Output directory prefix -->
<argument>${assembly.cfilter.out.dir}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>generate-janusgraph-gremlin-imports</id>
<phase>none</phase>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
59 changes: 59 additions & 0 deletions janusgraph-tablestore/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2021 JanusGraph Authors
#
# Licensed 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.

FROM debian:bookworm-20240211 as builder

ARG HBASE_VERSION=2.5.0
ARG HBASE_DIST="https://archive.apache.org/dist/hbase"

RUN apt-get update && \

Check notice on line 20 in janusgraph-tablestore/docker/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

janusgraph-tablestore/docker/Dockerfile#L20

Avoid additional packages by specifying `--no-install-recommends`

Check warning on line 20 in janusgraph-tablestore/docker/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

janusgraph-tablestore/docker/Dockerfile#L20

Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
DEBIAN_FRONTEND=noninteractive apt-get install -y curl

RUN curl -SL ${HBASE_DIST}/${HBASE_VERSION}/hbase-${HBASE_VERSION}-bin.tar.gz | tar -x -z && mv hbase-${HBASE_VERSION} /opt/hbase
WORKDIR /opt/hbase
RUN rm -rf ./docs ./LEGAL ./*.txt ./*/*.cmd

COPY ./hbase-site.xml /opt/hbase/conf/hbase-site.xml
COPY ./hbase-policy.xml /opt/hbase/conf/hbase-policy.xml

FROM openjdk:8-jre-buster

ARG HBASE_UID=1000
ARG HBASE_GID=1000

ENV LOGS_DIR=/data/logs

COPY --from=builder /opt/hbase/ /opt/hbase/

RUN ln -sf /opt/hbase/bin/* /usr/bin/
RUN mkdir -p $LOGS_DIR /data/hbase /data/wal /data/run /opt/hbase/logs
RUN apt-get update && \

Check notice on line 41 in janusgraph-tablestore/docker/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

janusgraph-tablestore/docker/Dockerfile#L41

Delete the apt-get lists after installing something
DEBIAN_FRONTEND=noninteractive apt-get install -y socat
WORKDIR /opt/hbase
COPY ./entrypoint.sh /entrypoint.sh

EXPOSE 2181
EXPOSE 16000
EXPOSE 16010
EXPOSE 16020
EXPOSE 16030

ENTRYPOINT ["/entrypoint.sh"]

RUN groupadd -g ${HBASE_GID} hbase && \
useradd -s /bin/bash hbase -u ${HBASE_UID} -g ${HBASE_GID} && \
chmod +x /entrypoint.sh && \
chown -R ${HBASE_UID}:${HBASE_GID} /data && \
chown -R ${HBASE_UID}:${HBASE_GID} /opt/hbase/logs
USER hbase
20 changes: 20 additions & 0 deletions janusgraph-tablestore/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
#
# Copyright 2022 JanusGraph Authors
#
# Licensed 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.

# re export zookeeper
socat tcp-listen:2182,fork,reuseaddr tcp-connect:localhost:2181 &

/usr/bin/hbase master start
53 changes: 53 additions & 0 deletions janusgraph-tablestore/docker/hbase-policy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
* 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.
*/
-->

<configuration>
<property>
<name>security.client.protocol.acl</name>
<value>*</value>
<description>ACL for HRegionInterface protocol implementations (ie.
clients talking to HRegionServers)
The ACL is a comma-separated list of user and group names. The user and
group list is separated by a blank. For e.g. "alice,bob users,wheel".
A special value of "*" means all users are allowed.</description>
</property>

<property>
<name>security.admin.protocol.acl</name>
<value>*</value>
<description>ACL for HMasterInterface protocol implementation (ie.
clients talking to HMaster for admin operations).
The ACL is a comma-separated list of user and group names. The user and
group list is separated by a blank. For e.g. "alice,bob users,wheel".
A special value of "*" means all users are allowed.</description>
</property>

<property>
<name>security.masterregion.protocol.acl</name>
<value>*</value>
<description>ACL for HMasterRegionInterface protocol implementations
(for HRegionServers communicating with HMaster)
The ACL is a comma-separated list of user and group names. The user and
group list is separated by a blank. For e.g. "alice,bob users,wheel".
A special value of "*" means all users are allowed.</description>
</property>
</configuration>
45 changes: 45 additions & 0 deletions janusgraph-tablestore/docker/hbase-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>

<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>file:////data/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>false</value>
</property>
<property>
<name>hbase.wal.dir</name>
<value>file:////data/wal</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>

<property>
<name>hbase.master.info.bindAddress</name>
<value>0.0.0.0</value>
</property>

<property>
<name>hbase.regionserver.info.bindAddress</name>
<value>0.0.0.0</value>
</property>

<property>
<name>hbase.master.ipc.address</name>
<value>0.0.0.0</value>
</property>

<property>
<name>hbase.regionserver.ipc.address</name>
<value>0.0.0.0</value>
</property>

</configuration>
Loading