-- 前提: Gremlin コンソールインストール済み
-- 1. クラスターパラメータグループの作成
aws neptune create-db-cluster-parameter-group \
--db-cluster-parameter-group-name cpg01 \
--db-parameter-group-family neptune1 \
--description "cpg01"
aws neptune describe-db-cluster-parameter-groups | grep DBClusterParameterGroupName
aws neptune describe-db-cluster-parameters \
--db-cluster-parameter-group-name cpg01
aws neptune modify-db-cluster-parameter-group \
--db-cluster-parameter-group-name cpg01 \
--parameters ParameterName=neptune_streams,ParameterValue=1,ApplyMethod=pending-reboot
-- 2. DBクラスター作成
aws neptune create-db-cluster \
--db-cluster-identifier cluster01 \
--engine neptune \
--engine-version 1.0.5.0 \
--port 8182 \
--no-storage-encrypted \
--no-deletion-protection \
--db-cluster-parameter-group-name cpg01
aws neptune create-db-instance \
--db-cluster-identifier cluster01 \
--engine neptune \
--db-instance-identifier instance01 \
--db-instance-class db.t3.medium \
--no-multi-az \
--no-auto-minor-version-upgrade
aws neptune describe-db-clusters --db-cluster-identifier cluster01
aws neptune describe-db-instances --db-instance-identifier instance01
-- 3. 動作確認
cd /home/ec2-user/apache-tinkerpop-gremlin-console-3.4.10
bin/gremlin.sh
:remote connect tinkerpop.server conf/neptune-remote.yaml
:remote console
g.addV('person').property(id, '1').property('name', 'martin').property('age', 29).iterate()
g.addV('person').property(id, '2').property('name', 'vadas').property('age', 27).iterate()
g.addV('software').property(id, '3').property('name', 'lop').property('lang', 'java')
g.V().has('name', 'martin').drop().iterate()
g.V().has('name', 'vadas').drop().iterate()
g.V().has('name', 'lop').drop()
g.V().valueMap()
:exit
curl -s "https://cluster01.cluster-xxxxxxxxxxxx.ap-northeast-1.neptune.amazonaws.com:8182/gremlin/stream?limit=1&commitNum=1&opNum=1&iteratorType=AT_SEQUENCE_NUMBER" |jq
curl -s "https://cluster01.cluster-xxxxxxxxxxxx.ap-northeast-1.neptune.amazonaws.com:8182/gremlin/stream?limit=1&commitNum=1&opNum=1&iteratorType=AFTER_SEQUENCE_NUMBER" |jq
curl -s "https://cluster01.cluster-xxxxxxxxxxxx.ap-northeast-1.neptune.amazonaws.com:8182/gremlin/stream?limit=1&iteratorType=TRIM_HORIZON" |jq
curl -s "https://cluster01.cluster-xxxxxxxxxxxx.ap-northeast-1.neptune.amazonaws.com:8182/gremlin/stream?limit=10&commitNum=1&opNum=1&iteratorType=AT_SEQUENCE_NUMBER" |jq
curl -s "https://cluster01.cluster-xxxxxxxxxxxx.ap-northeast-1.neptune.amazonaws.com:8182/gremlin/stream?limit=10&commitNum=1&opNum=1&iteratorType=AFTER_SEQUENCE_NUMBER" |jq
curl -s "https://cluster01.cluster-xxxxxxxxxxxx.ap-northeast-1.neptune.amazonaws.com:8182/gremlin/stream?limit=10&iteratorType=TRIM_HORIZON" |jq
-- 4. クリーンアップ
-- インスタンスの削除
aws neptune delete-db-instance \
--db-instance-identifier instance01 \
--skip-final-snapshot
aws neptune describe-db-instances
-- クラスターの削除
aws neptune delete-db-cluster \
--db-cluster-identifier cluster01 \
--skip-final-snapshot
aws neptune describe-db-clusters
-- クラスタパラメータグループ削除
aws neptune delete-db-cluster-parameter-group \
--db-cluster-parameter-group-name cpg01
-- クラスタパラメータグループ一覧
aws neptune describe-db-cluster-parameter-groups | grep DBClusterParameterGroupName