@@ -39,93 +39,75 @@ The graph has a vertex per comic book character with an edge to each of the
39
39
comic books in which they appeared.
40
40
41
41
### Load a subset of the Marvel Universe Social Graph
42
- 1 . Install prerequisites and clone the repository in GitHub.
42
+ 1 . Install the prerequisites (Git, JDK 1.8, Maven, Docker) of this tutorial.
43
+ The command below uses a
44
+ [ convenience script for Amazon Linux] ( https://raw.githubusercontent.com/awslabs/dynamodb-janusgraph-storage-backend/master/src/test/resources/install-reqs.sh )
45
+ on EC2 instances to install Git, Open JDK 1.8, Maven, and Docker. It adds the ec2-user to the docker group so that you can
46
+ [ execute Docker commands without using sudo] ( http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html ) .
47
+ Log out and back in to effect changes on ec2-user.
43
48
44
49
```bash
45
- sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo \
46
- -O /etc/yum.repos.d/epel-apache-maven.repo
47
- sudo sed -i s/\$ releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
48
- sudo yum update -y && sudo yum upgrade -y
49
- sudo yum install -y apache-maven sqlite-devel git java-1.8.0-openjdk-devel
50
- sudo alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
51
- sudo alternatives --set javac /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/javac
52
- git clone https://github.com/awslabs/dynamodb-titan-storage-backend.git
53
- cd dynamodb-titan-storage-backend
54
- ```
55
- 2. Run the ` install` target to copy some dependencies to the target folder.
56
-
57
- ` ` ` bash
58
- mvn install
59
- ` ` `
60
- 3. Start a new DynamoDB Local in a different shell.
61
-
62
- ` ` ` bash
63
- mvn test -Pstart-dynamodb-local
50
+ curl https://raw.githubusercontent.com/awslabs/dynamodb-janusgraph-storage-backend/master/src/test/resources/install-reqs.sh | bash
51
+ exit
64
52
```
65
- 4. Clean up old Elasticsearch indexes.
53
+ 2 . Use Docker and Docker Compose to bake DynamoDB Local into a container and start Gremlin Server with the DynamoDB Storage Backend for
54
+ JanusGraph installed.
66
55
67
56
```bash
68
- rm -rf elasticsearch
57
+ docker build -t awslabs/dynamodblocal ./src/test/resources/dynamodb-local-docker \
58
+ && src/test/resources/install-gremlin-server.sh \
59
+ && cp server/dynamodb-janusgraph-storage-backend-*.zip src/test/resources/dynamodb-janusgraph-docker \
60
+ && mvn docker:build -Pdynamodb-janusgraph-docker \
61
+ && docker-compose -f src/test/resources/docker-compose.yml up -d \
62
+ && docker exec -i -t dynamodb-janusgraph /var/jg/bin/gremlin.sh
69
63
```
70
- 5. Install JanusGraph Server with the DynamoDB Storage Backend for JanusGraph, which
71
- includes Gremlin Server.
72
-
73
- ` ` ` bash
74
- src/test/resources/install-gremlin-server.sh
75
- ` ` `
76
- 6. Change directories to the Gremlin Server home.
77
-
78
- ` ` ` bash
79
- cd server/dynamodb-janusgraph010-storage-backend-1.0.0
80
- ` ` `
81
- 7. Start Gremlin Server with the DynamoDB Local configuration.
82
-
83
- ` ` ` bash
84
- bin/gremlin-server.sh ${PWD} /conf/gremlin-server/gremlin-server-local.yaml
85
- ` ` `
86
- 8. Start a Gremlin shell with ` bin/gremlin.sh` and connect to the Gremlin Server
87
- endpoint. Always execute commands on the server
64
+ 3 . After the Gremlin shell starts, set it up to execute commands remotely.
88
65
89
66
``` groovy
90
67
:remote connect tinkerpop.server conf/remote.yaml session
91
68
:remote console
92
69
```
93
- 9 . Load the first 100 lines of the Marvel graph using the Gremlin shell.
70
+ 4 . Load the first 100 lines of the Marvel graph using the Gremlin shell.
94
71
95
72
```groovy
96
73
com.amazon.janusgraph.example.MarvelGraphFactory.load(graph, 100, false)
97
74
```
98
- 10 . Print the characters and the comic-books they appeared in where the
75
+ 5 . Print the characters and the comic-books they appeared in where the
99
76
characters had a weapon that was a shield or claws.
100
77
101
78
```groovy
102
79
g.V().has('weapon', within('shield','claws')).as('weapon', 'character', 'book').select('weapon', 'character','book').by('weapon').by('character').by(__.out('appeared').values('comic-book'))
103
80
```
104
- 11 . Print the characters and the comic-books they appeared in where the
81
+ 6 . Print the characters and the comic-books they appeared in where the
105
82
characters had a weapon that was not a shield or claws.
106
83
107
84
```groovy
108
85
g.V().has('weapon').has('weapon', without('shield','claws')).as('weapon', 'character', 'book').select('weapon', 'character','book').by('weapon').by('character').by(__.out('appeared').values('comic-book'))
109
86
```
110
- 12 . Print a sorted list of the characters that appear in comic-book AVF 4.
87
+ 7 . Print a sorted list of the characters that appear in comic-book AVF 4.
111
88
112
89
```groovy
113
90
g.V().has('comic-book', 'AVF 4').in('appeared').values('character').order()
114
91
```
115
- 13 . Print a sorted list of the characters that appear in comic-book AVF 4 that
92
+ 8 . Print a sorted list of the characters that appear in comic-book AVF 4 that
116
93
have a weapon that is not a shield or claws.
117
94
118
95
```groovy
119
96
g.V().has('comic-book', 'AVF 4').in('appeared').has('weapon', without('shield','claws')).values('character').order()
120
97
```
121
- 14 . Exit remote mode and Control-C to quit.
98
+ 9 . Exit remote mode and Control-C to quit.
122
99
123
100
```groovy
124
101
:remote console
125
102
```
103
+ 10. Clean up the composed Docker containers.
104
+
105
+ ```bash
106
+ docker-compose -f src/test/resources/docker-compose.yml stop
107
+ ```
126
108
127
109
### Load the Graph of the Gods
128
- 1. Repeat steps 1 through 8 of the Marvel graph section.
110
+ 1. Repeat steps 1 through 3 of the Marvel graph section.
129
111
2. Load the Graph of the Gods.
130
112
131
113
```groovy
@@ -218,10 +200,9 @@ CloudFormation template that you just downloaded.
218
200
6. On the Options page, click Next.
219
201
7. On the Review page, select "I acknowledge that this template might cause AWS
220
202
CloudFormation to create IAM resources." Then, click Create.
221
- 8. Create an SSH tunnel from your localhost port 8182 to the Gremlin Server port (8182)
222
- on the EC2 host after the stack deployment is complete. The SSH tunnel command
223
- is one of the outputs of the CloudFormation script so you can just copy-paste it.
224
- 9. Repeat steps 5, 6, and 8 of the Marvel graph section above.
203
+ 8. Start the Gremlin console on the host through SSH. You can just copy paste the `GremlinShell` output of the
204
+ CloudFormation template and run it on your command line.
205
+ 9. Repeat step 3 of the Marvel graph section above.
225
206
226
207
## Data Model
227
208
The Amazon DynamoDB Storage Backend for JanusGraph has a flexible data model that
@@ -412,8 +393,8 @@ credential configuration.
412
393
sudo yum install -y apache-maven sqlite-devel git java-1.8.0-openjdk-devel
413
394
sudo alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
414
395
sudo alternatives --set javac /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/javac
415
- git clone https://github.com/awslabs/dynamodb-titan -storage-backend.git
416
- cd dynamodb-titan -storage-backend && mvn install
396
+ git clone https://github.com/awslabs/dynamodb-janusgraph -storage-backend.git
397
+ cd dynamodb-janusgraph -storage-backend && mvn install
417
398
```
418
399
2. Open a screen so that you can log out of the EC2 instance while running tests with `screen`.
419
400
3. Run the single-item data model tests.
0 commit comments