次のフローを実行しようとしています。
ユーザーが AWS Gateway (REST) にアクセスし、
AWS Lambda をトリガーし、
Tinkerpop/Gremlin を使用して接続する
を使用する EC2 上の TitanDB
バックエンドとしてのクラウド (EC2 ではなく) の AWS DynamoDB。
現在、クラウドの DynamoDB にデータを保存する、完全に機能する TitanDB インスタンスを EC2 上に作成することができました。また、Tinkerpop/Gremlin を介して AWS Lambda から EC2 に接続できますが、この方法でのみ接続できます。
Cluster.build()
.addContactPoint("10.x.x.x") // ip of EC2
.create()
.connect()
.submit("here I type my query as string and it will work");
これは機能しますが、単純な Gremlin 言語の代わりに「Criteria API」(GremlinPipeline) を使用することを強く好みます。つまり、ORM か何かが必要です。Tinkerpopにはそれが含まれていることを私は知っています。私が必要としているのは、Graph クラスのオブジェクトであることに気付きました。これは私が試したことです:
Graph graph = TitanFactory
.build()
.set("storage.hostname", "10.x.x.x")
.set("storage.backend", "com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager")
.set("storage.dynamodb.client.credentials.class-name", "com.amazonaws.auth.DefaultAWSCredentialsProviderChain")
.set("storage.dynamodb.client.credentials.constructor-args", "")
.set("storage.dynamodb.client.endpoint", "https://dynamodb.ap-southeast-2.amazonaws.com")
.open();
ただし、「実装クラスが見つかりませんでした: com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager」がスローされます。もちろん、IntelliJ IDEA も見つからないため、コンピューターは正しいです。
私の依存関係:
//
// aws
compile 'com.amazonaws:aws-lambda-java-core:+'
compile 'com.amazonaws:aws-lambda-java-events:+'
compile 'com.amazonaws:aws-lambda-java-log4j:+'
compile 'com.amazonaws:aws-java-sdk-dynamodb:1.10.5.1'
compile 'com.amazonaws:aws-java-sdk-ec2:+'
//
// database
// titan 1.0.0 is compatible with gremlin 3.0.2-incubating, but not yet with 3.2.0
compile 'com.thinkaurelius.titan:titan-core:1.0.0'
compile 'org.apache.tinkerpop:gremlin-core:3.0.2-incubating'
compile 'org.apache.tinkerpop:gremlin-driver:3.0.2-incubating'
私の目標は何ですか:完全に動作するGraphオブジェクトを持っています
私の問題は何ですか: DynamoDBStoreManager クラスがなく、追加する必要がある依存関係がわかりません。
私の追加の質問は、Cluster クラスを介した接続には IP のみが必要で動作するのに、TitanFactory には EC2 の gremlin-server で使用したようなプロパティが必要なのはなぜですか? 2 番目のサーバーを作成したくありません。クライアントとしてサーバーに接続し、Graph オブジェクトを取得したいだけです。
編集:リゾルバーを追加した後、ビルドされ、出力で複数取得されます:
13689 [TitanID(0)(4)[0]] 警告 com.thinkaurelius.titan.diskstorage.idmanagement.ConsistentKeyIDAuthority - ID ブロックの取得中に一時ストレージ例外 - PT2.4S で再試行: com.thinkaurelius.titan.diskstorage.TemporaryBackendException: ID ブロック [1, 51) のクレームを PT0.342S に書いた => 遅すぎる、しきい値: PT0.3S
実行は open() メソッドでハングするため、クエリを実行できません。