Create customized docker from base (janusgraph1.0.0-rc2) with ConfigurationManagementGraph & initize with own schema groovy #3672
Unanswered
yingjie668
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I would like to create a customized docker from base janusgraph1.0.0-rc2 , from which I can
Currently the docker file I have, and can somebody help me to fill the necessary ConfigurationManagementGraph settings ? Thanks
`FROM janusgraph/janusgraph:1.0.0-rc2
USER root
#RUN apt-get update -y && apt-get -y upgrade && apt-get remove curl -y
RUN rm /opt/janusgraph/lib/hadoop-client-api-3.3.1.jar
USER janusgraph
COPY init.groovy /docker-entrypoint-initdb.d/`
And it works for a simple init.groovy that uses default JanusgraphFactory:
g = traversal().withRemote('conf/remote-graph.properties') // add the traversals to initialize the Graph with your data g.addV('demigod').property('name', 'hercules').iterate()
Final schema that I want to replace the sample init.groovy:
`//Create a sessioned connection to the Gremlin Server
:remote connect tinkerpop.server conf/remote.yaml session
:remote console
//define graph name
graph_name = "graph1"
map = new HashMap();
map.put("storage.backend", "cql");
map.put("storage.hostname", "127.0.0.1")
map.put("index.search.backend", "elasticsearch")
map.put("index.search.hostname", "127.0.0.1")
map.put("graph.graphname", graph_name)
map.put('query.batch', true)
ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map))
graph = ConfiguredGraphFactory.open(graph_name)
//Creat graph schema
//Close all transactions
graph.getOpenTransactions().forEach { tx -> tx.rollback() }
mgmt = graph.openManagement()
mgmt.getOpenInstances().forEach {
if (it.reverse().take(1) != ")") {
mgmt.forceCloseInstance(it)
}
}
pk_id = mgmt.makePropertyKey('id').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.LIST).make()
pk_name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.LIST).make()
mgmt.buildIndex('vby_name_m', Vertex.class).addKey(pk_name).buildMixedIndex('search')
mgmt.commit()
ConfiguredGraphFactory.close(graph_name)`
Beta Was this translation helpful? Give feedback.
All reactions