2015年9月26日土曜日

GraphenDB Getting Started(GrapheneDB公式サイト記事翻訳してみた)

・元記事:http://www.graphenedb.com/docs/getting-started.html (2015/09/25時点)
・メモレベルの非公式翻訳です。

****

    GrapheneDB入門
GrapheneDBとは何ですか?
GrapheneDBは、世界有数のグラフ型データベースである Neo4j(http://neo4j.com/のホスティングサービスです。
当社のサービスでは、無償で利用可能なサンドボックスを含め、アプリケーションのライフサイクルにあわせてさまざまなプランを提供しています。

ダッシュボード
データベースインスタンスをダッシュボードで管理できます。
ダッシュボードでは、新しいインスタンス作成の他、以下のことができます。
  • Neo4jのzipファイルからデータベースのリストア(復元)、インポートする
  • Neo4jのzipファイルとしてデータベースの内容をエクスポートする
  • データベースの削除
  • Neo4jのブラウザインタフェース(クエリインターフェイス、データブラウザ)を開く  (訳注:ウェブインターフェースと著書では訳しているもののこと。恩プレミスの場合はStartボタンを押して起動するhttp://localhost:7474)
  • アプリケーションからNeo4jに接続するための設定を取得する(訳注:無料版でもPHP、Pythonなどさまざまな言語での接続設定が書かれている。パスワードべた書きだからそこは何とかしないといけないけどねw)
  • インスタンスプランとストレージの使用状況の閲覧(訳注:ノード、リレーションシップ、メモリ容量使用量が確認できる)
  • プラグインの管理(訳注:無償版はNG)
  • バックアップの管理、ダウンロード(訳注:無償版はNG)
  • インスタンスの設定
データのインポートとリストア(復元)
ダッシュボードからデータをインポートすることができます。「Admin」タブに移動し、「Restore database」ボタンをクリックします。ダイアログが表示され、お使いのコンピュータからか、インターネット上でアクセス可能なURL経由でファイルをアップロードすることができます。
アップロード用のファイルは、「graph.db」ファイルを圧縮したものを使います。
例 :
$ tar -cif graph.tar.bz2 neo4j/data/graph.db 
 (訳注:Windowsの場合、サービス起動用画面で指定するxxx.dbとかのフォルダをzip圧縮すればよさそうな感じですね。要確認。)

サポートされる形式 :zip、tar、cpio、gz、bz2、xz
ヒント :Neo4jを試してみたく、サンプルのデータを探している場合、 neo4j.orgウェブサイト(Neo4j公式サイト)(www.neo4j.org/develop/example_data) にデータセットがあります。復元ダイアログ部分にデータセットのダウンロードURLリンクをコピペすればよく、ファイルをダウンロードする必要はありません。

データのエクスポート
graph.dbとしてデータをzip形式でエクスポートできます。ダッシュボード内で、「Admin」タブに移動し、「restore」ボタンを押してください。ダウンロード用のリンクが表示されます。
ダッシュボードを利用して、ダウンロードしたファイルを使って新しいインスタンスとしてデータベースのクローンを作成することもできます。この処理を使うことで、Neo4jの新しいバージョンへとデータベースを移行することができます。(訳注:データベース新規作成時に、Neo4jのVersionを選択することができる。既存のデータベースをエクスポートしておき、新しいVersionのNeo4jのデータベース作ってリストアorインポートすればNeo4jをVersionUPしたことになるってわけですね。)

Neo4jのブラウザインタフェース
ダッシュボードのデータベースビューでは、新しいウィンドウ/タブでNeo4jのブラウザインタフェースを開くリンクがあります。
ブラウザインタフェース:
  • データの閲覧、データ操作ができる
  • インタラクティブでクエリ(サイファークエリ)を実行できる

アプリケーションからの接続
GrapheneDB は、Neo4jのvanillaコミュニティ版を実行します。(訳注:vanilla:https://github.com/jakewins/neo4j-pdo/tree/master/vanilla のこと??)オープンソースのライブラリ全体に関する利点を享受できることを意味します。
GrapheneDBで動作検証されたドライバについては、 FAQページ(http://www.graphenedb.com/docs/faq.html#supported-drivers)にリストがあります。
Neo4jが公式にサポートしているドライバについてはNeo4jのドライバリスト(Developer: Language Guides - Neo4j Graph Database に記載があり、それらは当社でもサポートしています。
ダッシュボード内では、いくつかの人気があるNeo4jドライバだけではなく、一般的な設定についても記載しています。
好きな言語、フレームワークを用いて、アプリケーション開発、移行することができます。

Neo4jのプラグインや拡張機能のサポート
GrapheneDBは、既製のサポート プラグイン(http://neo4j.com/docs/stable/server-plugins.html)、 サーバー拡張機能(http://neo4j.com/docs/stable/server-unmanaged-extensions.html)と同様に、カスタム品もサポートしています。

*独自のプラグインや拡張機能のアップロード:
  • あなたはzip、tar、cpio、gz、bz2、xz形式のファイルをアップロードすることができます。
  • ファイルサイズの制限は100Mです。
*ファイルのアップロード:
  • ファイルには、最上位のディレクトリで複数の.jar ファイル を含めることができます
  • .jarまたはneo4j-server.properties * という名前のファイルのみが抽出され、残りは無視されます
  • neo4j-server.properties ファイルが見つかった場合、Neo4jのプロセスの neo4j-server.properties に追加されます
  • neo4j-server.properties には 、プラグインの パスに置き換えられる、$ PLUGIN_ROOT を含めることができます
  • アーカイブ内のファイルを参照するために使用できます
GrapheneDBでGremlinを使う方法
*Neo4jの1.9.xでGremlinを使う
GremlinはNeo4jのバージョン1.9.x.ではサポート対象外です。(訳注:is supported out of the boxって、サポート対象外っていう意味でよい??)
*Neo4jの2.xxでGremlinを使う
Gremlinは2.0以降Neo4jに同梱されていませんが、サーバのプラグインとしてインストールすることができます。
Gremlinを使いたい場合、プラグインと拡張機能のサポートを必要とします。(Developer以上のプランか、Heroku上でsandstone以上のプランでないと使えません。)
プラグインは、ローカルマシンからファイルをアップロードするか、アクセス可能なURLを指定することでインストールできます。
Gremlinのプラグインやリリース情報は、リポジトリのページ(https://github.com/thinkaurelius/neo4j-gremlin-plugin/releases)で確認できます。

Neo4jインスタンスの設定
Standard、Performanceプランでは、以下の設定を変更することができます。
自動インデックス設定
Neo4jは2つの自動インデックスを提供しています。一つはノード用、もう一つはリレーションシップ用です。デフォルトでは両方とも無効になっています。
両方のインデックスとも、プロパティが保存されたときに、特定のプロパティキーやインデックスデータレコードを監視する設定にできます。
自動インデックス設定の詳細については、公式ドキュメント(2.1(http://neo4j.com/docs/2.1.2/auto-indexing.html 等)を参照してください。
注意:Neo4j のVersion2.0でスキーマインデックスが新しくなり、自動インデックスは今ではレガシーなものと考えられています。

実行ガードの設定
とても複雑なクエリ(深さ探索が無制限)や、グラフ全体を探索する場合(MATCH(N)RETURN n)、インスタンスが応答を帰さなくなる場合があります。
これは偶然(間違ったクエリを入力)か、設計(このようなコードを作りこんでしまう)によって発生します。
長時間実行されるクエリによるダウンタイムを避けるため、全てのインスタンスはデフォルトで実行ガードを備えています。実行ガードは、制限の設定に応じてすべてのクエリを終了させます。
デフォルトの制限の設定は、購入プランによります。データベースには、実行ガードしきい値に関して以下に記載したデフォルト値と最大値が設定されています。
  • Hobbyデータベース、sandboxプラン:20秒
  • Standardデータベース:1分
  • Performanceデータベース、従来の個別計画:15分
実行ガードを設定するためのヒント:
StandardやPerformanceプランでは、実行ガードの制限値のデフォルト値を変更することができます。以下の点を考慮します。
  • アプリのタイムアウト設定と一致するように実行ガードの制限値を減らします。例:アプリの時間は5秒後でタイムアウトさせ、同様に実行ガードの閾値も5秒に設定する。
  • 長時間かかるクエリを意図的に実行しない場合、パフォーマンスの観点上、低い閾値を設定します。どのようなクエリが実行されるか分からないため、実行時間は15分まで設定できます。
メモリの構成設定
インスタンスメモリが設定され、別のコンポーネントによって使われます。
  • ファイルバッファーキャッシュまたはローレベルキャッシュと呼ばれているメモリマップキャッシュ
  • Neo4jを動かすのに使われ、ハイレベルかオブジェクトキャッシュとしても使われるJVMヒープ
Standard、Performanceプランのデータベースでは、以下の設定を調整できます。
  • ノード、リレーションシップ、プロパティ、文字列、配列に格納する個々のメモリマップ設定
  • 最大のヒープサイズ
設定の詳細については、Neo4jの公式ドキュメント(2.1 (http://neo4j.com/docs/2.1.2/configuration-caches.html 等)を参照してください。

注意: メモリ構成に失敗すると、パフォーマンスに影響を与えたり、応答を帰さなくなったりすることがあります。変更前に、何を設定しようとしているのか確認してください。
質問がありますか?
何か問題がある場合、FAQセクション(http://www.graphenedb.com/docs/faq.html を見るか、support@graphenedb.comから問い合わせてください。喜んでサポートさせていただきます。


*********以下、翻訳時点での原文コピー。最新情報については原本(http://www.graphenedb.com/docs/getting-started.html)を参照してください。***********




Getting Started

What is GrapheneDB?

GrapheneDB is a hosting service for Neo4j, the world's leading graph database.
Our service offers a variety of plans to go with your application's lifecycle, including free sandbox instances to get you started.

The dashboard

Within the dashboard you can manage your DB instances.
Besides creating new instances, for each instance you can:
  • restore/import a database from a Neo4j zip file
  • export the database content to Neo4j zip file
  • delete the database
  • open the Neo4j browser interface (query interface, data browser)
  • obtain the connection settings to setup your app
  • see your instance plan and storage usage
  • manage plugins
  • manage and download backups
  • configure the instance

Importing/restoring data

You can import data right from your dashboard. Navigate to your database admin tab and click on the button “Restore database”. A dialog will be displayed and you will be able to upload a file from your computer or provide a URL to a publicly accessible file on the internet.
To prepare the file, put the contents of the graph.db in a compressed file. Example:
$ tar -cjf graph.tar.bz2 neo4j/data/graph.db
          
Supported formats: zip, tar, cpio, gz, bz2 and xz
Hint: If you want to try out Neo4j and you are looking for example data there are some datasets on the neo4j.org website. You don't need to download the files, you can copy the download link URL and paste it in the restore dialog.

Exporting data

You can export your data to a zip file containing the graph.db directory. Within your dashboard, navigate to the admin tab and hit the restore button. The interface will guide you through the process and a download link will appear.
You can use the export feature also to clone your database into a new instance on our dashboard by using the restore feature on the new database and loading the downloaded export file. Using this process you can also upgrade your Neo4j version, by optionally specifying a higher version for the new database.

Neo4j browser interface

In the dashboard database view you will a find a link that will open the Neo4j browser interface in a new window/tab.
The browser interface:
  • enables browsing and manipulating data
  • can be used to build/run queries interactively

Connecting your application

GrapheneDB runs vanilla Neo4j Community Edition. This means you can benefit from a whole range of open source libraries.
For a list of drivers that verified by us to work well with GrapheneDB please refer to the related section in the FAQ.
Neo4j has a long list of official drivers on their website and they all should be compatible with our service too: Neo4j drivers.
Within the dashboard you will find configuration snippets for some of the most popular Neo4j drivers, as well as the generic connection settings.
You can go ahead and start developing or migrating your app in your favorite language or framework.

Support for Neo4j Plugins and extensions

GrapheneDB supports custom as well as off-the-shelf plugins and server extensions.

Uploading your own plugins and extensions

  • You can upload them in a zip, tar, cpio, gz, bz2 or xz file
  • File size is limited to 100M
Uploaded files:
  • A file can contain multiple .jar files in the top-level directory
  • Only files named *.jar or neo4j-server.properties are extracted, the rest is ignored.
  • If a neo4j-server.properties file is found, its content is added to the neo4j-server.properties of the Neo4j process
  • neo4j-server.properties can contain $PLUGIN_ROOT, which will be replaced with the path of the plug-in
  • This can be used to reference files in the archive

Using Gremlin on GrapheneDB

Gremlin on Neo4j 1.9.x

Gremlin is supported out of the box on versions 1.9.x.

Gremlin on Neo4j 2.x.x

Gremlin is no longer shipped with Neo4j since 2.0 but it can be installed as a server plugin.
In order to use Gremlin your plan will need support for plugins/extensions (Developer and higher, Sandstone and higher on Heroku).
The plugin itself can be installed by uploading the file from your local machine or by providing a publicly accessible URL for the file download.
The Gremlin plugin and its releases can be found at the repository's page.

Configuring Your Neo4j Instance

Standard and Performance plans allow you to change following settings:

Auto-index configuration

Neo4j provides two single auto-indexes: one for nodes and one for relationships. They are disabled by default.
Both indexes can be configured to “watch” certain property keys and index data records with such properties when they are saved.
For more information on auto-index configuration please read the official documentation (2.1, 2.0, 1.9).
Attention: Neo4j features schema indexes since version 2.0, and auto-indexes are now considered legacy.

Configuring the execution guard

Running any query that is very complex (unlimited depth traversals) or that traverses the entire graph (“MATCH (n) RETURN n”) can turn your instance unresponsive.
This happens sometimes accidentally (you type in wrong query) or by design (you include such a query in your code).
To prevent any potential downtime by long-running queries, all our instances come with the execution guard enabled by default. The execution guard will terminate all queries according to the limit setting in your configuration.
The default limit settings vary according to the plan you purchase. Databases have the following default and maximum values for the execution guard threshold:
  • Hobby databases and legacy sandbox plan: 20 seconds
  • Standard databases: 1 minute
  • Performance databases and legacy dedicated plans: 15 minutes
Tips for configuring the execution guard:
As part of the Standard and Performance plans, you may change the default execution guard limits. Consider the following:
  • Reduce the execution guard limit to match your app’s timeout setting. Example: if your app times out after 5 seconds, set the execution guard threshold to 5 seconds as well.
  • On the Performance tier, use a low threshold if you’re not running any long-running queries on purpose. We can’t know in advance what kind of queries you’re running, so we allow up to 15 minutes of execution time.

Configuring the memory settings

Your instance memory is assigned and used by different components:
  • A memory map cache, also known as file buffer cache or low-level cache.
  • The JVM heap, used to execute Neo4j, which also implements a high-level or object cache.
On all Standard and Performance databases, the following settings can be adjusted:
  • Individual memory map settings for node, relationship, property, string and array stores.
  • Max. heap size.
For a detailed description and instructions on how to do this, please refer to the official Neo4j documentation (2.1, 2.0, 1.9).
Attention: A bad memory configuration can have a dramatic impact on performance and even turn it unresponsive. Please make sure you know what you’re doing before you change these settings.

Questions?

If you are having any issues please visit our FAQ section or contact us via support@graphenedb.com.
We'll be glad to help.

0 件のコメント:

コメントを投稿