File size: 6,683 Bytes
2795186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# HBase Storage, Solr Index

## About HBase and Solr

[Apache HBase](https://hbase.apache.org/) is a scalable, distributed big data
store.

[Apache Solr](https://lucene.apache.org/solr/) is a scalable, distributed
search engine.

> Check the JanusGraph [version compatibility](https://docs.janusgraph.org/changelog/#version-compatibility)
to ensure you select versions of HBase and Solr compatible with this
JanusGraph release.

## JanusGraph configuration

* Be aware that Solr has two configuration options: SolrCloud or HTTP. With
either option, there is manual configuration required for the Solr cores (config
sets). Refer to the JanusGraph [Solr documentation](https://docs.janusgraph.org/index-backend/solr/)
for additional details.

    * [`jgex-hbase-solr-cloud.properties`](conf/jgex-hbase-solr-cloud.properties)
    contains the HBase and SolrCloud server locations.

    * [`jgex-hbase-solr-http.properties`](conf/jgex-hbase-solr-http.properties)
    contains the HBase and Solr Standalone (HTTP) server locations

* By providing different values for `storage.hbase.table` and `index.jgex.index-name`,
you can store multiple graphs on the same HBase and Solr servers. Refer to
the JanusGraph [configuration reference](https://docs.janusgraph.org/basics/configuration-reference/)
for additional properties.

### HBase configuration

The JanusGraph properties file assumes that HBase is installed on localhost
using its quickstart configuration. The quickstart configuration uses the
local filesystem for storing data and manages its own local Zookeeper. Please
refer to the HBase documentation for installation instructions.

### Solr configuration

The JanusGraph properties file assumes that Solr is installed on localhost
using its default configuration. Please refer to the Solr documentation for
installation instructions.

SolrCloud requires Zookeeper for sharing configset information. The JanusGraph
properties file assumes that SolrCloud is starting its own local Zookeeper,
rather than sharing a common Zookeeper with HBase.

## Dependencies

The required Maven dependencies for HBase:

```
        <dependency>
            <groupId>org.janusgraph</groupId>
            <artifactId>janusgraph-hbase</artifactId>
            <version>${janusgraph.version}</version>
            <scope>runtime</scope>
        </dependency>
```

The required Maven dependency for Solr:

```
        <dependency>
            <groupId>org.janusgraph</groupId>
            <artifactId>janusgraph-solr</artifactId>
            <version>${janusgraph.version}</version>
            <scope>runtime</scope>
        </dependency>
```

## HBase and SolrCloud

### Upload the configset to Zookeeper

Before running the example, a configset must be uploaded to Zookeeper.
Using a configset makes it possible to reuse the same configuration for new
cores. The configset is stored in Zookeeper under `/configs/jgex` where the
name `jgex` matches the properties file value for `index.jgex.solr.configset`.
Make sure the Zookeeper url matches the properties value for `index.jgex.solr.zookeeper-url`.

```
# Solr 5
$SOLR_HOME/server/scripts/cloud-scripts/zkcli.sh -z 127.0.0.1:9983 -cmd upconfig -d $JANUSGRAPH_HOME/conf/solr -n jgex

# Solr 6 or higher
$SOLR_HOME/bin/solr zk upconfig -z 127.0.0.1:9983 -d $JANUSGRAPH_HOME/conf/solr -n jgex
```

### Run the example

This command can be run from the `examples` or the project's directory.

```
mvn exec:java -pl :example-hbase
```

### Drop the graph

After running an example, you may want to drop the graph from storage. Make
sure to stop the application before dropping the graph. This command can be
run from the `examples` or the project's directory.

```
mvn exec:java -pl :example-hbase -Dcmd=drop
```

### Remove the configset from Zookeeper

After dropping the graph, the configset can be removed from Zookeeper.
The configset is stored in Zookeeper under `/configs/jgex` where the name
`jgex` matches the properties file value for `index.jgex.solr.configset`.
Make sure the Zookeeper url matches the properties value for `index.jgex.solr.zookeeper-url`.

```
# Solr 5
$SOLR_HOME/server/scripts/cloud-scripts/zkcli.sh -z 127.0.0.1:9983 -cmd clear /configs/jgex

# Solr 6
$SOLR_HOME/bin/solr zk rm -r /configs/jgex -z 127.0.0.1:9983
```


## HBase and Solr Standalone (HTTP)

### Create the Solr cores

Before running the example, there are additional manual steps needed to create
the Solr Cores. This example uses two cores: `vAge` and `eReasonPlace`. These
core names can be found in `JanusGraphApp#createMixedIndexes`.

```
$ $SOLR_HOME/bin/solr create_core -d $JANUSGRAPH_HOME/conf/solr -c vAge

Copying configuration to new core instance directory:
/usr/lib/solr-5.5.4/server/solr/vAge

Creating new core 'vAge' using command:
http://localhost:8983/solr/admin/cores?action=CREATE&name=vAge&instanceDir=vAge

{
  "responseHeader":{
    "status":0,
    "QTime":577},
  "core":"vAge"}

$ $SOLR_HOME/bin/solr create_core -d $JANUSGRAPH_HOME/conf/solr -c eReasonPlace

Copying configuration to new core instance directory:
/usr/lib/solr-5.5.4/server/solr/eReasonPlace

Creating new core 'eReasonPlace' using command:
http://localhost:8983/solr/admin/cores?action=CREATE&name=eReasonPlace&instanceDir=eReasonPlace

{
  "responseHeader":{
    "status":0,
    "QTime":116},
  "core":"eReasonPlace"}
```

### Run the example

This command can be run from the `examples` or the project's directory.

```
mvn exec:java -pl :example-hbase -Dexample.config="\${project.basedir}/conf/jgex-hbase-solr-http.properties"
```

### Drop the graph

After running an example, you may want to drop the graph from storage. Make
sure to stop the application before dropping the graph. This command can be
run from the `examples` or the project's directory.

```
mvn exec:java -pl :example-hbase -Dexample.config="\${project.basedir}/conf/jgex-hbase-solr-http.properties" -Dcmd=drop
```

### Drop the Solr cores

After dropping the graph, there are additional manual steps needed to delete
the Solr Cores. This example uses two cores: `vAge` and `eReasonPlace`. These
core names can be found in `JanusGraphApp#createMixedIndexes`.

```
$ cd $SOLR_HOME

$ bin/solr delete -c vAge

Deleting core 'vAge' using command:
http://localhost:8983/solr/admin/cores?action=UNLOAD&core=vAge&deleteIndex=true&deleteDataDir=true&deleteInstanceDir=true

{"responseHeader":{
    "status":0,
    "QTime":7}}

$ bin/solr delete -c eReasonPlace

Deleting core 'eReasonPlace' using command:
http://localhost:8983/solr/admin/cores?action=UNLOAD&core=eReasonPlace&deleteIndex=true&deleteDataDir=true&deleteInstanceDir=true

{"responseHeader":{
    "status":0,
    "QTime":9}}
```