https://dev.classmethod.jp/articles/serverless-is-now-available-for-amazon-neptune-a-graph-database/
https://docs.aws.amazon.com/ja_jp/neptune/latest/userguide/neptune-serverless.html
-- 1. コマンド等のインストール
-- 1.1 aws cli version 2 インストール
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
aws --version
-- 2. Neptune Serverlessクラスタの作成
aws neptune describe-db-engine-versions --engine neptune
aws neptune create-db-cluster \
--db-cluster-identifier cluster01 \
--engine neptune \
--engine-version 1.2.0.1 \
--serverless-v2-scaling-configuration MinCapacity=2.5,MaxCapacity=2.5 \
--backup-retention 1
aws neptune create-db-instance \
--db-instance-identifier cluster01-instance01 \
--db-cluster-identifier cluster01 \
--db-instance-class db.serverless \
--engine neptune \
--no-auto-minor-version-upgrade
aws neptune create-db-instance \
--db-instance-identifier cluster01-instance02 \
--db-cluster-identifier cluster01 \
--db-instance-class db.serverless \
--engine neptune \
--no-auto-minor-version-upgrade
aws neptune describe-db-clusters
aws neptune describe-db-instances
-- 3. Neptune Serverlessクラスタ停止/起動
aws neptune stop-db-cluster --db-cluster-identifier cluster01
aws neptune start-db-cluster --db-cluster-identifier cluster01
-- 4. Neptune Serverlessインスタンス再起動
aws neptune reboot-db-instance --db-instance-identifier cluster01-instance01
-- 5. 手動フェイルオーバ実行
aws neptune failover-db-cluster \
--db-cluster-identifier cluster01 \
--target-db-instance-identifier cluster01-instance02
-- 6. 接続確認
sudo amazon-linux-extras install -y java-openjdk11
sudo yum install -y jq
sudo /usr/sbin/alternatives --config java
wget https://archive.apache.org/dist/tinkerpop/3.5.2/apache-tinkerpop-gremlin-console-3.5.2-bin.zip
unzip apache-tinkerpop-gremlin-console-3.5.2-bin.zip
cd apache-tinkerpop-gremlin-console-3.5.2
hosts: [cluster01.cluster-xxxxxxxxxxxx.ap-northeast-1.neptune.amazonaws.com]
port: 8182
connectionPool: { enableSsl: true }
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
config: { serializeResultToString: true }}
cat conf/neptune-remote.yaml
bin/gremlin.sh
:remote connect tinkerpop.server conf/neptune-remote.yaml
:remote console
g.addV('person').property(id, '1').iterate()
g.addV('person').property(id, '2').iterate()
g.V()
g.V().drop()
g.V()
:exit
-- 7. クリーンアップ
aws neptune delete-db-instance \
--db-instance-identifier cluster01-instance02 \
--skip-final-snapshot
aws neptune delete-db-instance \
--db-instance-identifier cluster01-instance01 \
--skip-final-snapshot
aws neptune delete-db-cluster \
--db-cluster-identifier cluster01 \
--skip-final-snapshot