├── .gitignore
├── LICENSE
├── README.md
├── alerts.json
├── configuration
├── gremlin-server.xml
├── hadoop-gryo.xml
├── hadoop-hbase-read.xml
├── janusgraph-env.xml
├── janusgraph-hbase-solr.xml
└── janusgraph-log4j.xml
├── kerberos.json
├── metainfo.xml
├── package
├── .hash
├── alerts
│ └── alert_check_janusgraph_server.py
├── files
│ ├── gremlin-server-script.sh
│ ├── janusgraphSmoke.groovy
│ └── tinkergraph-empty.properties
├── scripts
│ ├── janusgraph.py
│ ├── janusgraph_client.py
│ ├── janusgraph_server.py
│ ├── janusgraph_service.py
│ ├── params.py
│ ├── params_server.py
│ └── service_check.py
└── templates
│ ├── janusgraph_solr_client_jaas.conf.j2
│ └── janusgraph_solr_jaas.conf.j2
├── quicklinks
└── quicklinks.json
└── screenshots
├── add_service.png
├── add_service_orig.png
├── add_service_wizard.png
├── add_service_wizard_JG.png
├── add_service_wizard_select_JG.png
├── assign_masters.png
├── customize_services.png
├── customize_services_jg-env.png
├── janusgraph_installed.png
└── review.png
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 |
49 | # Translations
50 | *.mo
51 | *.pot
52 |
53 | # Django stuff:
54 | *.log
55 | local_settings.py
56 |
57 | # Flask stuff:
58 | instance/
59 | .webassets-cache
60 |
61 | # Scrapy stuff:
62 | .scrapy
63 |
64 | # Sphinx documentation
65 | docs/_build/
66 |
67 | # PyBuilder
68 | target/
69 |
70 | # Jupyter Notebook
71 | .ipynb_checkpoints
72 |
73 | # pyenv
74 | .python-version
75 |
76 | # celery beat schedule file
77 | celerybeat-schedule
78 |
79 | # SageMath parsed files
80 | *.sage.py
81 |
82 | # dotenv
83 | .env
84 |
85 | # virtualenv
86 | .venv
87 | venv/
88 | ENV/
89 |
90 | # Spyder project settings
91 | .spyderproject
92 | .spyproject
93 |
94 | # Rope project settings
95 | .ropeproject
96 |
97 | # mkdocs documentation
98 | /site
99 |
100 | # mypy
101 | .mypy_cache/
102 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2018 IBM
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # janusgraph-ambari-service
2 | JanusGraph is a scalable graph database optimized for storing and querying graphs containing hundreds of billions of vertices and edges distributed across a multi-machine cluster. JanusGraph is a transactional database that can support thousands of concurrent users executing complex graph traversals in real time.
3 |
4 | Instructions on how to add JanusGraph to Apache Ambari or Hortonworks Data Platform(HDP) as a service can be found below.
5 |
6 |
7 | - To download the service and link it to Ambari run the following commands
8 | ```
9 | VERSION=`hdp-select versions | head -n1 | cut -d'.' -f1,2`
10 | git clone https://github.com/chupman/janusgraph-ambari-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/JANUSGRAPH
11 | ```
12 |
13 | ```
14 | sudo service ambari-server restart
15 | ```
16 | ## Service Installation
17 | - Once the ambari-server service has restarted login into the webui and click on the Actions dropdown on the lower lefthand side and select '+Add Service'.
18 | Click on the checkbox next to Janusgraph and then press next.
19 | Currently JanusGraph needs to be located on the same host as Solr. If solr is not yet installed you'll need to install it through the [mpack](https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.4/bk_solr-search-installation/content/ch_hdp-search-install-ambari.html).
20 |
21 | - Click add service from the actiosn dropdown:
22 | 
23 | - The add service wizard will show all available services:
24 | 
25 | - Scroll down and check the box nex to JanusGraph and click next. If solr is not already installed it will be automatically added as a dependancy:
26 | 
27 | - The assign masters screen shows you where all of your existing services are installed. You'll need to scroll down to find JanusGraph:
28 | 
29 | - Select the host you want to install Janusgraph on from the dropdown. It's reccomended to install it on the same host as solr for performance:
30 | 
31 | - There is currently no JanusGraph client so the Assign Slaves and Clients screen will be bypassed. Next you'll be able to customize your installation. No user supplied values are required:
32 | 
33 | - You can customize environment details like target directories and your gremlin server configuration:
34 | 
35 | - Click Deploy on the Installation review screen:
36 | 
37 | - Once the JanusGraph installation has been successfully complete the sevices view should look like this:
38 | 
39 |
--------------------------------------------------------------------------------
/alerts.json:
--------------------------------------------------------------------------------
1 | {
2 | "JANUSGRAPH": {
3 | "JANUSGRAPH_SERVER": [
4 | {
5 | "name": "janusgraph",
6 | "label": "janusgraph server",
7 | "description": "This host-level alert is triggered if the JanusGraph Server Instance is unreachable.",
8 | "interval": 1,
9 | "scope": "ANY",
10 | "source": {
11 | "type": "SCRIPT",
12 | "path": "JANUSGRAPH/package/alerts/alert_check_janusgraph_server.py",
13 | "parameters": [
14 | {
15 | "name": "janusgraph.run.dir",
16 | "display_name": "Run Directory",
17 | "value": "{{janusgraph-env/janusgraph_pid_dir}}",
18 | "type": "STRING",
19 | "description": "The directory where the JanusGraph server process places its PID files."
20 | },
21 | {
22 | "name": "janusgraph.install.dir",
23 | "display_name": "Janusgraph Install Directory",
24 | "value": "{{janusgraph-env/janusgraph_install_dir}}",
25 | "type": "STRING",
26 | "description": "The directory where the JanusGraph dist is located."
27 | },
28 | {
29 | "name": "janusgraph.user",
30 | "display_name": "Janusgraph User",
31 | "value": "janusgraph",
32 | "value": "{{janusgraph-env/janusgraph_user}}",
33 | "type": "STRING",
34 | "description": "User who starts the JanusGraph Server process"
35 | }
36 | ]
37 | }
38 | }
39 | ]
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/configuration/gremlin-server.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 | content
26 | Configuration for JanusGraph Server
27 |
28 | host: {{janusgraph_host}}
29 | port: {{janusgraph_server_port}}
30 | scriptEvaluationTimeout: 300000
31 | serializedResponseTimeout: 300000
32 |
33 | channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
34 | graphs: {
35 | graph: conf/janusgraph-hbase-solr.properties,
36 | graphSpark: conf/hadoop-graph/hadoop-gryo.properties}
37 | plugins:
38 | - janusgraph.imports
39 | scriptEngines: {
40 | gremlin-groovy: {
41 | imports: [java.lang.Math],
42 | staticImports: [java.lang.Math.PI],
43 | scripts: [scripts/empty-sample.groovy]}
44 | }
45 | serializers:
46 | - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
47 | - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
48 | - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
49 | - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
50 | - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
51 | - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
52 | processors:
53 | - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
54 | - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
55 | metrics: {
56 | consoleReporter: {enabled: true, interval: 180000},
57 | csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
58 | jmxReporter: {enabled: true},
59 | slf4jReporter: {enabled: true, interval: 180000},
60 | gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
61 | graphiteReporter: {enabled: false, interval: 180000}}
62 | maxInitialLineLength: 4096
63 | maxHeaderSize: 8192
64 | maxChunkSize: 8192
65 | maxContentLength: 65536
66 | maxAccumulationBufferComponents: 1024
67 | resultIterationBatchSize: 64
68 | writeBufferHighWaterMark: 32768
69 | writeBufferHighWaterMark: 65536
70 | ssl: {
71 | enabled: {{janusgraph_server_ssl}}{{janusgraph_server_ssl_key_file}}{{janusgraph_server_ssl_key_password}}{{janusgraph_server_ssl_key_cert_file}}
72 | }
73 | {{janusgraph_server_simple_authenticator}}
74 |
75 |
76 | false
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/configuration/hadoop-gryo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 |
26 | content
27 | Configuration of hadoop-gryo.properties
28 |
29 | # Licensed to the Apache Software Foundation (ASF) under one
30 | # or more contributor license agreements. See the NOTICE file
31 | # distributed with this work for additional information
32 | # regarding copyright ownership. The ASF licenses this file
33 | # to you under the Apache License, Version 2.0 (the
34 | # "License"); you may not use this file except in compliance
35 | # with the License. You may obtain a copy of the License at
36 | #
37 | # http://www.apache.org/licenses/LICENSE-2.0
38 | #
39 | # Unless required by applicable law or agreed to in writing,
40 | # software distributed under the License is distributed on an
41 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
42 | # KIND, either express or implied. See the License for the
43 | # specific language governing permissions and limitations
44 | # under the License.
45 | gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
46 | gremlin.hadoop.graphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat
47 | gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat
48 | gremlin.hadoop.jarsInDistributedCache=true
49 |
50 | gremlin.hadoop.inputLocation=data/tinkerpop-modern.kryo
51 | gremlin.hadoop.outputLocation=output
52 |
53 | #####################################
54 | # GiraphGraphComputer Configuration #
55 | #####################################
56 | giraph.minWorkers=2
57 | giraph.maxWorkers=2
58 | giraph.useOutOfCoreGraph=true
59 | giraph.useOutOfCoreMessages=true
60 | mapred.map.child.java.opts=-Xmx1024m
61 | mapred.reduce.child.java.opts=-Xmx1024m
62 | giraph.numInputThreads=4
63 | giraph.numComputeThreads=4
64 | # giraph.maxPartitionsInMemory=1
65 | # giraph.userPartitionCount=2
66 |
67 | ####################################
68 | # SparkGraphComputer Configuration #
69 | ####################################
70 | spark.master=yarn
71 | spark.submit.deployMode=client
72 | spark.yarn.jars={{default_fs}}/user/spark/share/lib/spark/*.jar
73 |
74 | # the Spark YARN ApplicationManager needs this to resolve classpath it sends to the executors
75 | spark.yarn.appMasterEnv.JAVA_HOME={{java64_home}}
76 | spark.yarn.appMasterEnv.HADOOP_CONF_DIR={{hadoop_config_dir}}
77 | spark.yarn.appMasterEnv.SPARK_CONF_DIR={{spark_config_dir}}
78 | spark.yarn.am.extraJavaOptions=-Diop.version={{full_stack_version}} -Djava.library.path={{hadoop_lib_native_dir}}
79 |
80 | # the Spark Executors (on the work nodes) needs this to resolve classpath to run Spark tasks
81 | spark.executorEnv.JAVA_HOME={{java64_home}}
82 | spark.executorEnv.HADOOP_CONF_DIR={{hadoop_config_dir}}
83 | spark.executorEnv.SPARK_CONF_DIR={{spark_config_dir}}
84 | spark.executor.memory=2g
85 | spark.executor.extraClassPath={{hbase_config_dir}}
86 | spark.serializer=org.apache.spark.serializer.KryoSerializer
87 |
88 |
89 | false
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/configuration/hadoop-hbase-read.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 |
26 | content
27 | Configuration of hadoop-hbase-read.properties
28 |
29 | # Licensed to the Apache Software Foundation (ASF) under one
30 | # or more contributor license agreements. See the NOTICE file
31 | # distributed with this work for additional information
32 | # regarding copyright ownership. The ASF licenses this file
33 | # to you under the Apache License, Version 2.0 (the
34 | # "License"); you may not use this file except in compliance
35 | # with the License. You may obtain a copy of the License at
36 | #
37 | # http://www.apache.org/licenses/LICENSE-2.0
38 | #
39 | # Unless required by applicable law or agreed to in writing,
40 | # software distributed under the License is distributed on an
41 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
42 | # KIND, either express or implied. See the License for the
43 | # specific language governing permissions and limitations
44 | # under the License.
45 | gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
46 | gremlin.hadoop.graphInputFormat=com.thinkaurelius.titan.hadoop.formats.hbase.HBaseInputFormat
47 | gremlin.hadoop.graphOutputFormat=org.apache.hadoop.mapreduce.lib.output.NullOutputFormat
48 | gremlin.hadoop.jarsInDistributedCache=true
49 | gremlin.hadoop.deriveMemory=false
50 | gremlin.hadoop.memoryOutputFormat=org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat
51 |
52 | gremlin.hadoop.inputLocation=none
53 | gremlin.hadoop.outputLocation=output
54 |
55 | titanmr.ioformat.conf.storage.backend=hbase
56 | titanmr.ioformat.conf.storage.hbase.table=titan_solr
57 | titanmr.ioformat.conf.storage.hostname={{storage_host}}
58 | zookeeper.znode.parent={{hbase_zookeeper_parent}}
59 |
60 | #####################################
61 | # GiraphGraphComputer Configuration #
62 | #####################################
63 | giraph.minWorkers=2
64 | giraph.maxWorkers=2
65 | giraph.useOutOfCoreGraph=true
66 | giraph.useOutOfCoreMessages=true
67 | mapred.map.child.java.opts=-Xmx1024m
68 | mapred.reduce.child.java.opts=-Xmx1024m
69 | giraph.numInputThreads=4
70 | giraph.numComputeThreads=4
71 | # giraph.maxPartitionsInMemory=1
72 | # giraph.userPartitionCount=2
73 |
74 | ####################################
75 | # SparkGraphComputer Configuration #
76 | ####################################
77 | spark.master=yarn
78 | spark.submit.deployMode=client
79 | spark.yarn.jars={{default_fs}}/user/spark/share/lib/spark/*.jar
80 |
81 | # the Spark YARN ApplicationManager needs this to resolve classpath it sends to the executors
82 | spark.yarn.appMasterEnv.JAVA_HOME={{java64_home}}
83 | spark.yarn.appMasterEnv.HADOOP_CONF_DIR={{hadoop_config_dir}}
84 | spark.yarn.appMasterEnv.SPARK_CONF_DIR={{spark_config_dir}}
85 | spark.yarn.am.extraJavaOptions=-Diop.version={{full_stack_version}} -Djava.library.path={{hadoop_lib_native_dir}}
86 |
87 | # the Spark Executors (on the work nodes) needs this to resolve classpath to run Spark tasks
88 | spark.executorEnv.JAVA_HOME={{java64_home}}
89 | spark.executorEnv.HADOOP_CONF_DIR={{hadoop_config_dir}}
90 | spark.executorEnv.SPARK_CONF_DIR={{spark_config_dir}}
91 | spark.executor.memory=2g
92 | spark.executor.extraClassPath={{hbase_config_dir}}
93 |
94 | spark.serializer=org.apache.spark.serializer.KryoSerializer
95 |
96 |
97 | false
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/configuration/janusgraph-env.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 |
26 | janusgraph_user
27 | JanusGraph User
28 | User to run JanusGraph as
29 | USER
30 | janusgraph
31 |
32 |
33 |
34 |
35 | janusgraph_group
36 | JanusGraph Group
37 | Group for JanusGraph permissions
38 | GROUP
39 | janusgraph
40 |
41 |
42 |
43 |
44 | janusgraph_pid_dir
45 | /var/run/janusgraph
46 |
47 |
48 |
49 |
50 | janusgraph_log_dir
51 | /var/log/janusgraph
52 |
53 |
54 |
55 |
56 | janusgraph_server_port
57 | 8182
58 | Sets the port JanusGraph Server binds to, default is 8182
59 |
60 |
61 |
62 |
63 | janusgraph_hdfs_home_dir
64 | /apps/janusgraph/data
65 | A root location in HDFS for JanusGraph to write collection data to. Rather than specifying an HDFS location for the data directory or update log directory, use this to specify one root location and have everything automatically created within this HDFS
66 |
67 |
68 |
69 | SimpleAuthenticator
70 | false
71 |
72 | boolean
73 |
74 | Set whether to enable SimpleAuthenticator(PLAIN SASL), the credentials database is located at /usr/iop/current/janusgraph-client/data/credentials.kryo. Note: this option will not take effect if Knox is installed.
75 |
76 |
77 |
78 | ssl.enabled
79 | false
80 |
81 | boolean
82 |
83 | Set whether to enable ssl
84 |
85 |
86 |
87 | ssl.keyCertChainFile
88 |
89 |
90 | true
91 |
92 | The X.509 certificate chain file in PEM format. If this value is not present and ssl.enabled is true a self-signed certificate will be used (not suitable for production).
93 |
94 |
95 |
96 | ssl.keyFile
97 |
98 |
99 | true
100 |
101 | The PKCS#8 private key file in PEM format. If this value is not present and ssl.enabled is true a self-signed certificate will be used (not suitable for production).
102 |
103 |
104 |
105 | ssl.keyPassword
106 |
107 | PASSWORD
108 |
109 | password
110 | true
111 |
112 | The password of the keyFile if it's not password-protected.
113 |
114 |
115 |
116 | content
117 | janusgraph-env template
118 | This is the template for janusgraph-env.sh file
119 |
120 |
121 | # Set JAVA HOME
122 | export JAVA_HOME={{java64_home}}
123 |
124 | # Add hadoop configuration directory into classpath
125 | export HADOOP_CONF_DIR={{hadoop_config_dir}}
126 |
127 |
128 | # Setup the environment for SparkGraphComputer
129 | # Add yarn and spark lib and config into classpath for SparkGraphComputer.
130 | export YARN_HOME={{yarn_home_dir}}
131 | export YARN_CONF_DIR=$HADOOP_CONF_DIR
132 | export SPARK_HOME={{spark_home_dir}}
133 | export SPARK_CONF_DIR={{spark_config_dir}}
134 | export JANUSGRAPH_HOME={{janusgraph_home_dir}}
135 | export CLASSPATH=$CLASSPATH:$HADOOP_CONF_DIR:$SPARK_CONF_DIR:$JANUSGRAPH_HOME/conf
136 |
137 | #add hbase configuration directory into classpath
138 | if ([ -d "{{hbase_config_dir}}" ]); then
139 | export HBASE_CONF_DIR={{hbase_config_dir}}
140 | export CLASSPATH=$CLASSPATH:$HBASE_CONF_DIR
141 | fi
142 |
143 | if ([[ ! -d "{{janusgraph_ext_spark_plugin_dir}}" ]] && [[ -d "$SPARK_HOME/jars" ]]); then
144 | for jar in $SPARK_HOME/jars/*.jar; do
145 | if ([[ $jar != */guava*.jar ]] && [[ $jar != */slf4j-log4j12*.jar ]] && [[ $jar != */spark-core*.jar ]]) ;then
146 | CLASSPATH=$CLASSPATH:$jar
147 | fi
148 | done
149 | fi
150 |
151 | export CLASSPATH
152 |
153 | # Add iop.version and native lib in java opt for hadoop config.
154 | export IOP_JAVA_OPTIONS="$JAVA_OPTIONS -D{{platform_name}}.version={{full_stack_version}} -Djava.library.path={{hadoop_lib_native_dir}}"
155 |
156 | {% if security_enabled -%}
157 | export JVMFLAGS="-Djava.security.auth.login.config={{janusgraph_solr_client_jaas_file}}"
158 | export IOP_JAVA_OPTIONS="$IOP_JAVA_OPTIONS $JVMFLAGS"
159 | {% endif %}
160 |
161 | source "$HADOOP_CONF_DIR"/hadoop-env.sh
162 | export HADOOP_GREMLIN_LIBS=$JANUSGRAPH_HOME/lib
163 | export JANUSGRAPH_LOGDIR={{janusgraph_log_dir}}
164 |
165 |
166 |
167 | janusgraph_download_url
168 | https://github.com/JanusGraph/janusgraph/releases/download/v0.2.0/janusgraph-0.2.0-hadoop2.zip
169 | JanusGraph download url. Currently defaults to version 0.2.0.
170 |
171 |
172 | janusgraph_install_dir
173 | /opt/janusgraph
174 | JanusGraph download location.
175 |
176 |
177 |
--------------------------------------------------------------------------------
/configuration/janusgraph-hbase-solr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 |
26 | content
27 | Describe the configurations for Solr
28 |
29 | # JanusGraph configuration sample: HBase and Solr
30 | # ATTENTION: If you would like to use this property, do manually execute titan-solr-connection.sh before build index.
31 |
32 | # This file connects to HBase using a Zookeeper quorum
33 | # (storage.hostname) consisting solely of localhost. It also
34 | # connects to Solr running on localhost using Solr's HTTP API.
35 | # Zookeeper, the HBase services, and Solr must already be
36 | # running and available before starting JanusGraph with this file.
37 | gremlin.graph=org.janusgraph.core.JanusGraphFactory
38 | storage.backend=hbase
39 | storage.hostname={{storage_host}}
40 | storage.hbase.table=janusgraph_solr
41 | storage.hbase.ext.zookeeper.znode.parent={{hbase_zookeeper_parent}}
42 |
43 | cache.db-cache = true
44 | cache.db-cache-clean-wait = 20
45 | cache.db-cache-time = 180000
46 | cache.db-cache-size = 0.5
47 |
48 | # The indexing backend used to extend and optimize Titan's query
49 | # functionality. This setting is optional. Titan can use multiple
50 | # heterogeneous index backends. Hence, this option can appear more than
51 | # once, so long as the user-defined name between "index" and "backend" is
52 | # unique among appearances.Similar to the storage backend, this should be
53 | # set to one of Titan's built-in shorthand names for its standard index
54 | # backends (shorthands: lucene, elasticsearch, es, solr) or to the full
55 | # package and classname of a custom/third-party IndexProvider
56 | # implementation.
57 |
58 | index.search.backend=solr
59 | # index.search.solr.mode=http
60 | index.search.solr.http-urls={{solr_server_urls}}
61 | index.search.solr.mode=cloud
62 | index.search.solr.zookeeper-url={{zookeeper_solr_for_janusgraph_hostname}}
63 | index.search.solr.configset=janusgraph
64 | {{janusgraph_solr_client_jaas_config}}
65 |
66 |
67 | false
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/configuration/janusgraph-log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 |
26 | content
27 | Custom log4j-console.properties
28 |
29 |
30 | # Used by gremlin.sh
31 |
32 | log4j.appender.A2=org.apache.log4j.ConsoleAppender
33 | log4j.appender.A2.Threshold=TRACE
34 | log4j.appender.A2.layout=org.apache.log4j.PatternLayout
35 | log4j.appender.A2.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c %x - %m%n
36 | log4j.rootLogger=${gremlin.log4j.level}, A2
37 |
38 | #log4j.logger.com.thinkaurelius.titan.graphdb.database.idassigner.placement=DEBUG
39 | #log4j.logger.com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager=DEBUG
40 |
41 | # Disable spurious Hadoop config deprecation warnings under 2.2.0.
42 | #
43 | # See https://issues.apache.org/jira/browse/HADOOP-10178
44 | #
45 | # This can and should be deleted when we upgrade our Hadoop 2.2.0
46 | # dependency to 2.3.0 or 3.0.0.
47 | log4j.logger.org.apache.hadoop.conf.Configuration.deprecation=OFF
48 |
49 | # Configure MR at its own loglevel. We usually want MR at INFO,
50 | # even if the rest of the loggers are at WARN or ERROR or FATAL,
51 | # because job progress information is at INFO.
52 | log4j.logger.org.apache.hadoop.mapred=${gremlin.mr.log4j.level}
53 | log4j.logger.org.apache.hadoop.mapreduce=${gremlin.mr.log4j.level}
54 |
55 | # This generates 3 INFO lines per jar on the classpath -- usually more
56 | # noise than desirable in the REPL. Switching it to the default
57 | # log4j level means it will be at WARN by default, which is ideal.
58 | log4j.logger.org.apache.hadoop.mapred.LocalDistributedCacheManager=${gremlin.log4j.level}
59 |
60 |
61 | false
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/kerberos.json:
--------------------------------------------------------------------------------
1 | {
2 | "services": [
3 | {
4 | "name": "JANUSGRAPH",
5 | "components": [
6 | {
7 | "name": "JANUSGRAPH_SERVER",
8 | "identities": [
9 | {
10 | "name": "janusgraph_principal",
11 | "principal": {
12 | "value": "${janusgraph-env/janusgraph_user}/_HOST@${realm}",
13 | "type" : "service",
14 | "configuration": "janusgraph-env/janusgraph_principal_name",
15 | "local_username": "${janusgraph-env/janusgraph_user}"
16 |
17 | },
18 | "keytab": {
19 | "file": "${keytab_dir}/janusgraph.service.keytab",
20 | "owner": {
21 | "name": "${janusgraph-env/janusgraph_user}",
22 | "access": "r"
23 | },
24 | "group": {
25 | "name": "${cluster-env/user_group}",
26 | "access": ""
27 | },
28 | "configuration": "janusgraph-env/janusgraph_keytab_path"
29 | }
30 | }
31 | ]
32 | },
33 | {
34 | "name": "JANUSGRAPH_CLIENT",
35 | "identities": [
36 | {
37 | "name": "/HDFS/NAMENODE/hdfs"
38 | }
39 | ]
40 | }
41 | ],
42 | "configurations": [
43 | {
44 | "core-site": {
45 | "hadoop.proxyuser.janusgraph.groups": "${hadoop-env/proxyuser_group}",
46 | "hadoop.proxyuser.janusgraph.hosts": "*"
47 | }
48 | }
49 | ]
50 | }
51 | ]
52 | }
53 |
--------------------------------------------------------------------------------
/metainfo.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 | 2.0
20 |
21 |
22 | JANUSGRAPH
23 | JanusGraph
24 | JanusGraph is a scalable graph database optimized for storing and querying graphs containing hundreds of
25 | billions of vertices and edges distributed across a multi-machine cluster.
26 | 0.2.0
27 |
28 |
29 | JANUSGRAPH_SERVER
30 | JanusGraph Server
31 | MASTER
32 | 1
33 |
34 |
35 | PYTHON
36 | 600
37 |
38 |
39 |
40 | yaml
41 | gremlin-server.yaml
42 | gremlin-server
43 |
44 |
45 |
46 |
85 |
86 |
87 |
88 | any
89 |
90 |
91 | janusgraph
92 |
93 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | PYTHON
103 | 300
104 |
105 |
106 |
107 | HDFS
108 | HBASE
109 | SOLR
110 | SPARK2
111 |
112 |
113 |
114 | gremlin-server
115 | janusgraph-env
116 | janusgraph-hbase-solr
117 | janusgraph-log4j
118 | hadoop-gryo
119 | hadoop-hbase-read
120 | knox-env
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/package/.hash:
--------------------------------------------------------------------------------
1 | d81018524ae27b8405189e216f3ccc0689d10bd9
--------------------------------------------------------------------------------
/package/alerts/alert_check_janusgraph_server.py:
--------------------------------------------------------------------------------
1 | """
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | """
18 |
19 | from resource_management.core.resources import Execute
20 | from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
21 | from resource_management.libraries.functions import format
22 |
23 | RESULT_CODE_OK = 'OK'
24 | RESULT_CODE_CRITICAL = 'CRITICAL'
25 | RESULT_CODE_UNKNOWN = 'UNKNOWN'
26 | STACK_ROOT = 'janusgraph.install.dir'
27 | JANUSGRAPH_RUN_DIR = 'janusgraph.run.dir'
28 | JANUSGRAPH_USER = 'janusgraph.user'
29 | @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
30 | def execute(configurations={}, parameters={}, host_name=None):
31 | """
32 | Returns a tuple containing the result code and a pre-formatted result label
33 |
34 | Keyword arguments:
35 | configurations (dictionary): a mapping of configuration key to value
36 | parameters (dictionary): a mapping of script parameter key to value
37 | host_name (string): the name of this host where the alert is running
38 | """
39 | janusgraph_bin_dir = configurations[STACK_ROOT] + format("/bin")
40 | gremlin_server_script_path = janusgraph_bin_dir + format("/gremlin-server-script.sh")
41 | janusgraph_pid_file = parameters[JANUSGRAPH_RUN_DIR] + format("/janusgraph.pid")
42 | janusgraph_user = parameters[JANUSGRAPH_USER]
43 | (code, msg) = get_check_result(gremlin_server_script_path, janusgraph_pid_file, janusgraph_user)
44 | return (code, msg)
45 |
46 | @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
47 | def get_tokens():
48 | """
49 | Returns a tuple of tokens in the format {{site/property}} that will be used
50 | to build the dictionary passed into execute
51 | """
52 | return (STACK_ROOT, JANUSGRAPH_RUN_DIR)
53 |
54 | def get_check_result(gremlin_server_script_path, janusgraph_pid_file, janusgraph_user):
55 | cmd = format("{gremlin_server_script_path} status {janusgraph_pid_file}")
56 | try:
57 | result = Execute(cmd,
58 | user=janusgraph_user
59 | )
60 | return (RESULT_CODE_OK, ["janusgraph server is up and running"])
61 | except Exception, ex:
62 | return (RESULT_CODE_CRITICAL, [ex])
63 |
64 |
--------------------------------------------------------------------------------
/package/files/gremlin-server-script.sh:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one or more
2 | # contributor license agreements. See the NOTICE file distributed with
3 | # this work for additional information regarding copyright ownership.
4 | # The ASF licenses this file to You under the Apache License, Version 2.0
5 | # (the "License"); you may not use this file except in compliance with
6 | # the License. You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | # Init script for Gremlin Server so it automatically starts/stops with the machine.
17 | #
18 | # To install:
19 | # 1) Add a symlink to this file in /etc/init.d/ under the name you'd like to see the service
20 | # For example, to name the service "gremlin-server": ln -s /usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/bin/gremlin-server-service.sh /etc/init.d/gremlin-server
21 | # 2a) If you're running RH: chkconfig --add gremlin-server
22 | # 2b) If you're running Ubuntu: update-rc.d gremlin-server defaults
23 | #
24 | # You have to SET the Gremlin Server installation directory here:
25 | PID_FILE=$2
26 | GREMLIN_SERVER_LOG_FILE=$3
27 | GREMLIN_SERVER_ERR_FILE=$4
28 | GREMLIN_SERVER_BIN_DIR=$5
29 | GREMLIN_SERVER_CONF_DIR=$6
30 |
31 |
32 | usage() {
33 | echo "Usage: `basename $0`: start|stop|status"
34 | exit 1
35 | }
36 |
37 | status() {
38 | echo "get program status"
39 | local pid
40 | if [[ -f "$PID_FILE" && -s "$PID_FILE" ]]; then
41 | #statements
42 | pid=$(cat $PID_FILE)
43 | if kill -0 $pid > /dev/null 2>&1; then
44 | # pid exists
45 | echo "program is running"
46 | return 0
47 | fi
48 | else
49 | echo "program is not running"
50 | fi
51 | return 1
52 | }
53 |
54 | start() {
55 | if ! status ; then
56 | echo "start program"
57 | /usr/bin/nohup ${GREMLIN_SERVER_BIN_DIR}/gremlin-server.sh ${GREMLIN_SERVER_CONF_DIR}/gremlin-server.yaml 1>$GREMLIN_SERVER_LOG_FILE 2>${GREMLIN_SERVER_ERR_FILE} &
58 | echo $! > $PID_FILE
59 | sleep 50
60 | fi
61 | }
62 |
63 | stop() {
64 | local pid
65 | if status ; then
66 | echo "stop program"
67 | pid=`cat $PID_FILE`
68 | kill -9 $pid
69 | rm -f $PID_FILE
70 | fi
71 | }
72 |
73 | case "$1" in
74 | start)
75 | start
76 | ;;
77 | stop)
78 | stop
79 | ;;
80 | status)
81 | status
82 | ;;
83 | *)
84 | usage
85 | ;;
86 | esac
87 |
--------------------------------------------------------------------------------
/package/files/janusgraphSmoke.groovy:
--------------------------------------------------------------------------------
1 | /*Licensed to the Apache Software Foundation (ASF) under one or more
2 | contributor license agreements. See the NOTICE file distributed with
3 | this work for additional information regarding copyright ownership.
4 | The ASF licenses this file to You under the Apache License, Version 2.0
5 | (the "License"); you may not use this file except in compliance with
6 | the License. You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License */
15 |
16 | import org.janusgraph.core.JanusGraphFactory
17 |
18 |
19 | graph = JanusGraphFactory.open("/opt/janusgraph/conf/janusgraph-hbase-solr.properties")
20 | g = graph.traversal()
21 | l = g.V().values('name').toList()
22 |
--------------------------------------------------------------------------------
/package/files/tinkergraph-empty.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 | gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
18 | gremlin.tinkergraph.vertexIdManager=LONG
19 |
--------------------------------------------------------------------------------
/package/scripts/janusgraph.py:
--------------------------------------------------------------------------------
1 | """
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | Ambari Agent
19 |
20 | """
21 | import os
22 | from resource_management import *
23 | from resource_management.core.source import InlineTemplate, StaticFile
24 | from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
25 |
26 |
27 | @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
28 | def janusgraph(type = None, upgrade_type=None):
29 | import params
30 | import params_server
31 | if type == 'server':
32 | Directory(params.janusgraph_server_conf_dir,
33 | create_parents=True,
34 | owner=params.janusgraph_user,
35 | group=params.user_group,
36 | mode=0775
37 | )
38 | File(format("{params.janusgraph_server_conf_dir}/gremlin-server.yaml"),
39 | mode=0644,
40 | group=params.user_group,
41 | owner=params.janusgraph_user,
42 | content=InlineTemplate(params.gremlin_server_configs)
43 | )
44 | credentials_file = format("{params.janusgraph_data_dir}/credentials.kryo")
45 | if not os.path.isfile(credentials_file):
46 | File(credentials_file,
47 | mode=0644,
48 | group=params.user_group,
49 | owner=params.janusgraph_user,
50 | content=""
51 | )
52 | credentials_property_file = format("{params.janusgraph_conf_dir}/tinkergraph-empty.properties")
53 | if not os.path.isfile(credentials_property_file):
54 | File(credentials_property_file,
55 | mode=0644,
56 | group=params.user_group,
57 | owner=params.janusgraph_user,
58 | content=StaticFile("tinkergraph-empty.properties")
59 | )
60 | Directory(params.janusgraph_log_dir,
61 | create_parents=True,
62 | owner=params.janusgraph_user,
63 | group=params.user_group,
64 | mode=0775
65 | )
66 | Directory(params_server.janusgraph_pid_dir,
67 | create_parents=True,
68 | owner=params.janusgraph_user,
69 | group=params.user_group,
70 | mode=0775
71 | )
72 | File(format("{params.janusgraph_bin_dir}/gremlin-server-script.sh"),
73 | mode=0755,
74 | owner=params.janusgraph_user,
75 | group=params.user_group,
76 | content = StaticFile("gremlin-server-script.sh")
77 | )
78 |
79 | Directory(params.janusgraph_conf_dir,
80 | create_parents = True,
81 | owner=params.janusgraph_user,
82 | group=params.user_group
83 | )
84 |
85 | File(format("{params.janusgraph_conf_dir}/janusgraph-env.sh"),
86 | mode=0644,
87 | group=params.user_group,
88 | owner=params.janusgraph_user,
89 | content=InlineTemplate(params.janusgraph_env_props)
90 | )
91 | jaas_client_file = format('{janusgraph_solr_client_jaas_file}')
92 |
93 | if not os.path.isfile(jaas_client_file) and params.security_enabled:
94 | File(jaas_client_file,
95 | owner = params.janusgraph_user,
96 | group = params.user_group,
97 | mode = 0644,
98 | content = Template('janusgraph_solr_client_jaas.conf.j2')
99 | )
100 |
101 | # SparkGraphComputer
102 | Directory(params.janusgraph_conf_hadoop_graph_dir,
103 | create_parents = True,
104 | owner=params.janusgraph_user,
105 | group=params.user_group
106 | )
107 |
108 | File(format("{params.janusgraph_conf_hadoop_graph_dir}/hadoop-gryo.properties"),
109 | mode=0644,
110 | group=params.user_group,
111 | owner=params.janusgraph_user,
112 | content=InlineTemplate(params.janusgraph_hadoop_gryo_props)
113 | )
114 |
115 | File(format("{params.janusgraph_conf_hadoop_graph_dir}/hadoop-hbase-read.properties"),
116 | mode=0644,
117 | group=params.user_group,
118 | owner=params.janusgraph_user,
119 | content=InlineTemplate(params.hadoop_hbase_read_props)
120 | )
121 |
122 | # janusgraph-hbase-solr_properties is always set to a default even if it's not in the payload
123 | File(format("{params.janusgraph_conf_dir}/janusgraph-hbase-solr.properties"),
124 | mode=0644,
125 | group=params.user_group,
126 | owner=params.janusgraph_user,
127 | content=InlineTemplate(params.janusgraph_hbase_solr_props)
128 | )
129 |
130 | if (params.log4j_console_props != None):
131 | File(format("{params.janusgraph_conf_dir}/log4j-console.properties"),
132 | mode=0644,
133 | group=params.user_group,
134 | owner=params.janusgraph_user,
135 | content=InlineTemplate(params.log4j_console_props)
136 | )
137 | elif (os.path.exists(format("{params.janusgraph_conf_dir}/log4j-console.properties"))):
138 | File(format("{params.janusgraph_conf_dir}/log4j-console.properties"),
139 | mode=0644,
140 | group=params.user_group,
141 | owner=params.janusgraph_user
142 | )
143 | # Change janusgraph ext directory for multiple user access
144 | Directory(params.janusgraph_ext_dir,
145 | create_parents = True,
146 | owner=params.janusgraph_user,
147 | group=params.user_group,
148 | mode=0775
149 | )
150 |
--------------------------------------------------------------------------------
/package/scripts/janusgraph_client.py:
--------------------------------------------------------------------------------
1 | """
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | Ambari Agent
19 |
20 | """
21 |
22 | import sys
23 | import os
24 | from resource_management import *
25 | from resource_management.libraries.functions import conf_select
26 | from resource_management.libraries.functions import stack_select
27 | from resource_management.libraries.functions import StackFeature
28 | from resource_management.libraries.functions.stack_features import check_stack_feature
29 | import janusgraph
30 |
31 | from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
32 |
33 | class JanusGraphClient(Script):
34 | def get_component_name(self):
35 | return "janusgraph-client"
36 |
37 | def configure(self, env):
38 | import params
39 | env.set_params(params)
40 | janusgraph.janusgraph()
41 |
42 | def status(self, env):
43 | raise ClientComponentHasNoStatus()
44 |
45 | @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
46 | class JanusGraphClientLinux(JanusGraphClient):
47 |
48 | def pre_rolling_restart(self, env):
49 | import params
50 | env.set_params(params)
51 |
52 | if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
53 | conf_select.select(params.stack_name, "janusgraph", params.version)
54 | stack_select.select("janusgraph-client", params.version)
55 |
56 | def install(self, env):
57 | self.install_packages(env)
58 | self.configure(env)
59 |
60 | if __name__ == "__main__":
61 | JanusGraphClient().execute()
62 |
--------------------------------------------------------------------------------
/package/scripts/janusgraph_server.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """
3 | Licensed to the Apache Software Foundation (ASF) under one
4 | or more contributor license agreements. See the NOTICE file
5 | distributed with this work for additional information
6 | regarding copyright ownership. The ASF licenses this file
7 | to you under the Apache License, Version 2.0 (the
8 | "License"); you may not use this file except in compliance
9 | with the License. You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | """
20 |
21 | import sys
22 | import os
23 | from resource_management import *
24 | from resource_management.libraries.functions import conf_select
25 | from resource_management.libraries.functions import stack_select
26 | from resource_management.libraries.functions import StackFeature
27 | from resource_management.libraries.functions.stack_features import check_stack_feature
28 | from resource_management.libraries.functions.check_process_status import check_process_status
29 | from janusgraph_service import janusgraph_service
30 | import janusgraph
31 |
32 | class JanusGraphServer(Script):
33 | def install(self, env):
34 | import params
35 | env.set_params(params)
36 |
37 | Directory([params.janusgraph_log_dir, params.janusgraph_install_dir],
38 | owner=params.janusgraph_user,
39 | group=params.janusgraph_group
40 | )
41 |
42 | File(params.janusgraph_log_file,
43 | mode=0644,
44 | owner=params.janusgraph_user,
45 | group=params.janusgraph_group,
46 | content=''
47 | )
48 | # Download Janusgraph zip, if no cached package exists on Ambari server node
49 | if not os.path.exists(params.janusgraph_zip):
50 | Execute('wget ' + params.janusgraph_download_url + ' -O ' + params.janusgraph_zip + ' -a ' + params.janusgraph_log_file, user=params.janusgraph_user)
51 | Execute('unzip ' + params.janusgraph_zip + ' -d ' + params.janusgraph_install_dir + ' >> ' + params.janusgraph_log_file, user=params.janusgraph_user)
52 | Execute('mv ' + params.janusgraph_install_dir + '/janusgraph-*/* ' + params.janusgraph_install_dir, user=params.janusgraph_user)
53 | Execute('rmdir ' + params.janusgraph_install_dir + '/janusgraph-*')
54 |
55 | #update the configs specified by user
56 | self.configure(env, True)
57 |
58 |
59 | def get_component_name(self):
60 | return "janusgraph-server"
61 |
62 | def configure(self, env, upgrade_type=None):
63 | import params
64 | env.set_params(params)
65 | janusgraph.janusgraph(type='server', upgrade_type=upgrade_type)
66 |
67 | # Upgrade function not currently supported
68 | # def pre_upgrade_restart(self, env, upgrade_type=None):
69 | # Logger.info("Executing Stack Upgrade pre-restart")
70 | # import params
71 | # env.set_params(params)
72 | # if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
73 | # stack_select.select("janusgraph-server", params.version)
74 | # conf_select.select(params.stack_name, "janusgraph", params.version)
75 |
76 | def start(self, env, upgrade_type=None):
77 | import params
78 | env.set_params(params)
79 | self.configure(env)
80 | janusgraph_service(action = 'start')
81 |
82 | def stop(self, env, upgrade_type=None):
83 | import params
84 | env.set_params(params)
85 | janusgraph_service(action = 'stop')
86 |
87 | def status(self, env, upgrade_type=None):
88 | import params_server
89 | check_process_status(params_server.janusgraph_pid_file)
90 |
91 | if __name__ == "__main__":
92 | JanusGraphServer().execute()
93 |
--------------------------------------------------------------------------------
/package/scripts/janusgraph_service.py:
--------------------------------------------------------------------------------
1 | """
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | Ambari Agent
19 |
20 | """
21 | import os
22 | from resource_management import *
23 | from resource_management.libraries.functions.validate import call_and_match_output
24 | from resource_management.libraries.functions import solr_cloud_util
25 | from resource_management.libraries.resources.xml_config import XmlConfig
26 |
27 | def janusgraph_service(action='start'):
28 | import params
29 | import params_server
30 | cmd = format("{janusgraph_bin_dir}/gremlin-server-script.sh")
31 | cmd_params = params_server.janusgraph_pid_file + " " + params.janusgraph_log_file +" " + params.janusgraph_err_file + " " + params.janusgraph_bin_dir + " " + params.janusgraph_server_conf_dir
32 | if action == 'start':
33 | if params.security_enabled:
34 | kinit_cmd = format("{kinit_path_local} -kt {janusgraph_keytab_path} {janusgraph_jaas_princ};")
35 | Execute(kinit_cmd,
36 | user=params.janusgraph_user
37 | )
38 | XmlConfig("hbase-site.xml",
39 | not_if = params.hbase_master_installed,
40 | conf_dir=params.janusgraph_conf_dir,
41 | configurations=params.config['configurations']['hbase-site'],
42 | configuration_attributes=params.config['configuration_attributes']['hbase-site'],
43 | group=params.user_group,
44 | owner=params.janusgraph_user,
45 | mode=0644
46 | )
47 |
48 | #Add for SparkGraphComputer, prepare dir /user/janusgraph/data on HDFS, and upload spark jars to /user/spark/share/lib/spark for spark.yarn.jars of Spark on YARN.
49 | #create hdfs dir /user/janusgraph/data
50 | janusgraph_create_data_dir_command = format("hadoop fs -mkdir -p {janusgraph_hdfs_data_dir}; hadoop fs -chown -R janusgraph:hdfs /user/janusgraph")
51 | janusgraph_data_exist_command = format("hadoop fs -test -e {janusgraph_hdfs_data_dir}>/dev/null 2>&1")
52 | Execute(janusgraph_create_data_dir_command,
53 | not_if = janusgraph_data_exist_command,
54 | logoutput=True,user=params.hdfs_user)
55 |
56 | #create spark plugin dir for spark jars
57 | janusgraph_create_spark_plugin_dir_command = format("mkdir -p {janusgraph_ext_spark_plugin_dir}")
58 | janusgraph_ext_spark_plugin_dir_exist_command = format("ls {janusgraph_ext_spark_plugin_dir}>/dev/null 2>&1")
59 | Execute(janusgraph_create_spark_plugin_dir_command,
60 | not_if = janusgraph_ext_spark_plugin_dir_exist_command,
61 | logoutput=True,user=params.janusgraph_user)
62 |
63 | #get spark arhive from hdfs
64 | janusgraph_get_spark_tar_command = format("hadoop fs -get {janusgraph_spark2_archive_dir}/{janusgraph_spark2_archive_file} {janusgraph_ext_spark_plugin_dir}")
65 | janusgraph_sparktargz_exist_command= format("ls {janusgraph_ext_spark_plugin_dir}/{janusgraph_spark2_archive_file}>/dev/null 2>&1")
66 | Execute(janusgraph_get_spark_tar_command,
67 | not_if = janusgraph_sparktargz_exist_command,
68 | logoutput=True,user=params.janusgraph_user)
69 |
70 | #extract spark targz
71 | janusgraph_x_spark_targz_command = format("tar -xzvf {janusgraph_ext_spark_plugin_dir}/{janusgraph_spark2_archive_file} -C {janusgraph_ext_spark_plugin_dir}/>/dev/null 2>&1")
72 | janusgraph_sparkjars_exist_command= format("ls {janusgraph_ext_spark_plugin_dir}/*.jar>/dev/null 2>&1")
73 | Execute(janusgraph_x_spark_targz_command,
74 | not_if = janusgraph_sparkjars_exist_command,
75 | logoutput=True,user=params.janusgraph_user)
76 |
77 | #create hdfs dir /user/spark/share/lib/spark
78 | janusgraph_create_spark_dir_command = format("hadoop fs -mkdir -p {janusgraph_hdfs_spark_lib_dir}")
79 | janusgraph_spark_exist_command = format("hadoop fs -test -e {janusgraph_hdfs_spark_lib_dir}>/dev/null 2>&1")
80 | Execute(janusgraph_create_spark_dir_command,
81 | not_if = janusgraph_spark_exist_command,
82 | logoutput=True,user=params.hdfs_user)
83 |
84 | #upload spark jars to hdfs /user/spark/share/lib/spark
85 | janusgraph_put_spark_jar_command = format("hadoop fs -put -f {janusgraph_ext_spark_plugin_dir}/* {janusgraph_hdfs_spark_lib_dir}; hadoop fs -rm -r {janusgraph_hdfs_spark_lib_dir}/guava*.jar; hadoop fs -put -f {janusgraph_home_dir}/lib/guava*.jar {janusgraph_hdfs_spark_lib_dir}")
86 | janusgraph_sparkjar_exist_command = format("hadoop fs -test -e {janusgraph_hdfs_spark_lib_dir}/*.jar>/dev/null 2>&1")
87 | Execute(janusgraph_put_spark_jar_command,
88 | not_if = janusgraph_sparkjar_exist_command,
89 | logoutput=True,user=params.hdfs_user)
90 |
91 | #rm guava*.jar slf4j-log4j12*.jar spark-core*.jar for conflict
92 | janusgraph_rm_conflict_jars_command = format("rm -rf {janusgraph_ext_spark_plugin_dir}/guava*.jar; rm -rf {janusgraph_ext_spark_plugin_dir}/slf4j-log4j12*.jar; rm -rf {janusgraph_ext_spark_plugin_dir}/spark-core*.jar; ")
93 | janusgraph_guava_exist_command = format("ls {janusgraph_ext_spark_plugin_dir}/guava*.jar>/dev/null 2>&1")
94 | Execute(janusgraph_rm_conflict_jars_command,
95 | only_if = janusgraph_guava_exist_command,
96 | logoutput=True,user=params.janusgraph_user)
97 |
98 | #generate yarn-site.xml in JanusGraph conf if no yarn-client installed
99 | XmlConfig("yarn-site.xml",
100 | not_if = params.yarn_client_installed,
101 | conf_dir=params.janusgraph_conf_dir,
102 | configurations=params.config['configurations']['yarn-site'],
103 | configuration_attributes=params.config['configuration_attributes']['yarn-site'],
104 | group=params.user_group,
105 | owner=params.janusgraph_user,
106 | mode=0644
107 | )
108 |
109 | #create jaas file for solr when security enabled
110 | jaas_file = format('{janusgraph_solr_jaas_file}')
111 | if not os.path.isfile(jaas_file) and params.security_enabled:
112 | File(jaas_file,
113 | owner = params.janusgraph_user,
114 | group = params.user_group,
115 | mode = 0644,
116 | content = Template('janusgraph_solr_jaas.conf.j2')
117 | )
118 | #upload config to zookeeper
119 | solr_cloud_util.upload_configuration_to_zk(
120 | zookeeper_quorum = params.zookeeper_quorum,
121 | solr_znode = params.solr_znode,
122 | config_set = params.janusgraph_solr_configset,
123 | config_set_dir = params.janusgraph_solr_conf_dir,
124 | tmp_dir = params.tmp_dir,
125 | java64_home = params.java64_home,
126 | jaas_file=jaas_file,
127 | retry=30, interval=5)
128 |
129 | #create solr collection
130 | solr_cloud_util.create_collection(
131 | zookeeper_quorum = params.zookeeper_quorum,
132 | solr_znode = params.solr_znode,
133 | collection = params.janusgraph_solr_collection_name,
134 | config_set = params.janusgraph_solr_configset,
135 | java64_home = params.java64_home,
136 | shards = params.janusgraph_solr_shards,
137 | replication_factor = int(params.infra_solr_replication_factor),
138 | jaas_file = jaas_file)
139 |
140 | daemon_cmd = format(cmd+" start " + cmd_params)
141 | no_op_test = format("ls {params_server.janusgraph_pid_file} >/dev/null 2>&1 && ps `cat {params_server.janusgraph_pid_file}` >/dev/null 2>&1")
142 | Execute(daemon_cmd,
143 | not_if=no_op_test,
144 | user=params.janusgraph_user
145 | )
146 |
147 | elif action == 'stop':
148 | import params_server
149 | daemon_cmd = format("{janusgraph_bin_dir}/gremlin-server-script.sh stop " + params_server.janusgraph_pid_file)
150 | Execute(daemon_cmd, user=params.janusgraph_user)
151 |
--------------------------------------------------------------------------------
/package/scripts/params.py:
--------------------------------------------------------------------------------
1 | """
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | Ambari Agent
19 |
20 | """
21 |
22 | from resource_management.libraries.script.script import Script
23 | from resource_management.libraries.resources.hdfs_resource import HdfsResource
24 | from resource_management.libraries.functions import conf_select
25 | from resource_management.libraries.functions import stack_select
26 | from resource_management.libraries.functions.format import format
27 | from resource_management.libraries.functions.version import format_stack_version, get_major_version
28 | from resource_management.libraries.functions.default import default
29 | from resource_management.libraries.functions import get_kinit_path
30 | from resource_management.libraries.functions.get_stack_version import get_stack_version
31 |
32 | config = Script.get_config()
33 | tmp_dir = Script.get_tmp_dir()
34 | stack_root= Script.get_stack_root()
35 |
36 | stack_name = default("/hostLevelParams/stack_name", None)
37 |
38 | stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
39 | stack_version_formatted = format_stack_version(stack_version_unformatted)
40 | major_stack_version = get_major_version(stack_version_formatted)
41 | full_stack_version = get_stack_version('spark2-client')
42 |
43 | # New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade
44 | version = default("/commandParams/version", None)
45 |
46 | janusgraph_user = config['configurations']['janusgraph-env']['janusgraph_user']
47 | janusgraph_group = config['configurations']['janusgraph-env']['janusgraph_group']
48 | user_group = config['configurations']['cluster-env']['user_group']
49 | janusgraph_log_dir = config['configurations']['janusgraph-env']['janusgraph_log_dir']
50 | janusgraph_server_port = config['configurations']['janusgraph-env']['janusgraph_server_port']
51 | janusgraph_hdfs_home_dir = config['configurations']['jsnaugraph-env']['janusgraph_hdfs_home_dir']
52 | janusgraph_log_file = format("{janusgraph_log_dir}/janusgraph-{janusgraph_server_port}.log")
53 | janusgraph_err_file = format("{janusgraph_log_dir}/janusgraph-{janusgraph_server_port}.err")
54 |
55 | smokeuser = config['configurations']['cluster-env']['smokeuser']
56 | smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
57 |
58 | security_enabled = config['configurations']['cluster-env']['security_enabled']
59 | smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
60 | kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
61 |
62 |
63 | if security_enabled:
64 | _hostname_lowercase = config['hostname'].lower()
65 | janusgraph_jaas_princ = config['configurations']['janusgraph-env']['janusgraph_principal_name'].replace('_HOST',_hostname_lowercase)
66 | janusgraph_keytab_path = config['configurations']['janusgraph-env']['janusgraph_keytab_path']
67 |
68 | janusgraph_bin_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir']+ '/bin'
69 | janusgraph_data_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir']+ '/data'
70 | # JanusGraph configurations
71 | janusgraph_conf_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir']+ '/conf'
72 | janusgraph_hbase_solr_props = config['configurations']['janusgraph-hbase-solr']['content']
73 | janusgraph_env_props = config['configurations']['janusgraph-env']['content']
74 | log4j_console_props = config['configurations']['janusgraph-log4j']['content']
75 |
76 | # JanusGraph server configurations
77 | janusgraph_server_conf_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir'] + "/conf/gremlin-server"
78 | gremlin_server_configs = config['configurations']['gremlin-server']['content']
79 |
80 | janusgraph_server_sasl= str(config['configurations']['janusgraph-env']['SimpleAuthenticator']).lower()
81 | janusgraph_server_simple_authenticator = ""
82 | if janusgraph_server_sasl == "true" and 'knox-env' not in config['configurations']:
83 | janusgraph_server_simple_authenticator = """authentication: {
84 | className: org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator,
85 | config: {
86 | credentialsDb: conf/tinkergraph-empty.properties,
87 | credentialsDbLocation: data/credentials.kryo}}"""
88 |
89 | janusgraph_server_ssl= str(config['configurations']['janusgraph-env']['ssl.enabled']).lower()
90 | janusgraph_server_ssl_key_cert_file = default('/configurations/janusgraph-env/ssl.keyCertChainFile', None)
91 | if janusgraph_server_ssl_key_cert_file:
92 | janusgraph_server_ssl_key_cert_file = format(", keyCertChainFile: {janusgraph_server_ssl_key_cert_file}")
93 | janusgraph_server_ssl_key_file = default('/configurations/janusgraph-env/ssl.keyFile', None)
94 | if janusgraph_server_ssl_key_file:
95 | janusgraph_server_ssl_key_file = format(", keyFile: {janusgraph_server_ssl_key_file}")
96 | janusgraph_server_ssl_key_password = default('/configurations/janusgraph-env/ssl.keyPassword', None)
97 | if janusgraph_server_ssl_key_password:
98 | janusgraph_server_ssl_key_password = format(", keyPassword: {janusgraph_server_ssl_key_password}")
99 | janusgraph_server_ssl_trust_cert_chain_file=default('/configurations/janusgraph-env/ssl.trustCertChainFile', None)
100 | # not supporting 32 bit jdk.
101 | java64_home = config['hostLevelParams']['java_home']
102 | hadoop_config_dir = conf_select.get_hadoop_conf_dir()
103 | hbase_config_dir = format('{stack_root}/current/hbase-client/conf')
104 |
105 | # JanusGraph SparkGraphComputer configuration
106 | yarn_home_dir = format('{stack_root}/current/hadoop-yarn-client')
107 | spark_home_dir = format('{stack_root}/current/spark2-client')
108 | spark_config_dir = format('{stack_root}/current/spark2-client/conf')
109 | janusgraph_home_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir']
110 | janusgraph_conf_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir'] + '/conf'
111 | janusgraph_conf_hadoop_graph_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir'] + '/conf/hadoop-graph'
112 | janusgraph_data_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir']+ '/data'
113 | hadoop_lib_native_dir = format('{stack_root}/current/hadoop-client/lib/native')
114 | janusgraph_hadoop_gryo_props = config['configurations']['hadoop-gryo']['content']
115 | hadoop_hbase_read_props = config['configurations']['hadoop-hbase-read']['content']
116 | janusgraph_hdfs_data_dir = "/user/janusgraph/data"
117 | janusgraph_hdfs_spark_lib_dir = "/user/spark/share/lib/spark"
118 | janusgraph_ext_spark_plugin_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir'] + '/ext/spark-client/plugin'
119 | local_components = default("/localComponents", [])
120 | yarn_client_installed = ( 'YARN_CLIENT' in local_components)
121 | hbase_master_installed = ( 'HBASE_CLIENT' in local_components)
122 |
123 | # JanusGraph required 'storage.hostname' which is hbase cluster in IOP 4.2.
124 | # The host name should be zooKeeper quorum
125 | storage_hosts = config['clusterHostInfo']['zookeeper_hosts']
126 | zookeeper_port = config['configurations']['zoo.cfg']['clientPort']
127 | storage_host_list = []
128 | janusgraph_zookeeper_solr_host_list = []
129 | for hostname in storage_hosts:
130 | janusgraph_zookeeper_solr_hostname = hostname+format(':{zookeeper_port}/solr')
131 | janusgraph_zookeeper_solr_host_list.append(janusgraph_zookeeper_solr_hostname)
132 | storage_host_list.append(hostname)
133 | storage_host = ",".join(storage_host_list)
134 | zookeeper_solr_for_janusgraph_hostname = ",".join(janusgraph_zookeeper_solr_host_list)
135 | hbase_zookeeper_parent = config['configurations']['hbase-site']['zookeeper.znode.parent']
136 |
137 | if 'janusgraph_server_hosts' in config['clusterHostInfo'] and len(config['clusterHostInfo']['janusgraph_server_hosts']) > 0:
138 | janusgraph_host = config['clusterHostInfo']['janusgraph_server_hosts'][0]
139 |
140 | # jts jar should be copy to solr site
141 | janusgraph_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir']
142 | janusgraph_ext_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir'] + '/ext'
143 | janusgraph_solr_conf_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir'] + '/conf/solr'
144 | #janusgraph_solr_jar_file = format('{stack_root}/current/janusgraph-client/lib/jts-1.13.jar')
145 | # jaas file for solr when security is enabled
146 | janusgraph_solr_jaas_file = format('{janusgraph_solr_conf_dir}/janusgraph_solr_jaas.conf')
147 | janusgraph_solr_client_jaas_file = format('{janusgraph_solr_conf_dir}/janusgraph_solr_client_jaas.conf')
148 | janusgraph_solr_client_jaas_config = "index.search.solr.jaas-file=" + format('{janusgraph_solr_conf_dir}/janusgraph_solr_client_jaas.conf')
149 | if not security_enabled:
150 | janusgraph_solr_client_jaas_config=""
151 | # config for solr collection creation
152 | index = 0
153 | zookeeper_quorum = ""
154 | for host in config['clusterHostInfo']['zookeeper_hosts']:
155 | zookeeper_quorum += host + ":" + str(zookeeper_port)
156 | index += 1
157 | if index < len(config['clusterHostInfo']['zookeeper_hosts']):
158 | zookeeper_quorum += ","
159 | if "solr-config-env" in config['configurations']:
160 | solr_znode = default('/configurations/solr-config-env/solr_znode', '/solr')
161 | infra_solr_hosts = default("/clusterHostInfo/infra_solr_hosts", [])
162 | infra_solr_replication_factor = 2 if len(infra_solr_hosts) > 1 else 1
163 | janusgraph_solr_shards = 1
164 | janusgraph_solr_hdfs_dir = "/apps/janusgraph"
165 | janusgraph_solr_hdfs_conf_dir = "/apps/janusgraph/conf"
166 | janusgraph_solr_hdfs_jar = "/apps/janusgraph/jts-1.13.jar"
167 | janusgraph_tmp_dir = format('{tmp_dir}/janusgraph')
168 | janusgraph_solr_dir = format('{janusgraph_tmp_dir}/solr_installed')
169 | configuration_tags = config['configurationTags']
170 | hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
171 | janusgraph_hdfs_mode = 0775
172 | solr_conf_dir=format('{stack_root}/current/solr-server/conf')
173 | janusgraph_solr_configset = 'janusgraph'
174 | janusgraph_solr_collection_name = 'janusgraph'
175 | solr_conf_trg_file = format('{stack_root}/current/solr-server/server/solr/configsets/{janusgraph_solr_configset}/conf/solrconfig.xml')
176 | #for create_hdfs_directory
177 | security_enabled = config['configurations']['cluster-env']['security_enabled']
178 | hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
179 | kinit_path_local = get_kinit_path()
180 | hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
181 | hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
182 | hdfs_site = config['configurations']['hdfs-site']
183 | hdfs_principal_name = default('/configurations/hadoop-env/hdfs_principal_name', 'missing_principal').replace("_HOST", hostname)
184 | default_fs = config['configurations']['core-site']['fs.defaultFS']
185 |
186 | # Created by chupman@us.ibm.com
187 | janusgraph_download_url = config['configurations']['janusgraph-env']['janusgraph_download_url']
188 | janusgraph_zip = '/tmp/janusgraph.zip'
189 | janusgraph_install_dir = config['configurations']['janusgraph-env']['janusgraph_install_dir']
190 | solr_cloud_enabled = config['configurations']['solr_cloud_enable']
191 | solr_cloud_zk_directory = config['configurations']['solr_cloud_zk_directory']
192 | solr_port = config['configurations']['solr-config-env']['solr_config_port']
193 | solr_user= config['configurations']['solr-config-env']['solr_config_user']
194 | solr_ssl = config['configurations']['solr-ssl']['solr_ssl_enable']
195 | solr_server_hosts = config['clusterHostInfo']['solr_server_hosts']
196 | solr_server_list = []
197 | solr_server_list2 = []
198 | solr_http = 'https' if solr_ssl else 'http'
199 |
200 | for solr_host in solr_server_hosts:
201 | solr_server_list.append(format("{solr_http}://{solr_host}:{solr_port}/solr"))
202 | solr_server_urls = ",".join(solr_server_list)
203 |
204 | platform_name = format('{stack_root}').split('/')[2]
205 | janusgraph_spark2_archive_dir = format('/{platform_name}/apps/{full_stack_version}/spark2')
206 | janusgraph_spark2_archive_file = format('spark2-{platform_name}-yarn-archive.tar.gz')
207 |
208 | import functools
209 | #to create hdfs directory we need to call params.HdfsResource in code
210 | HdfsResource = functools.partial(
211 | HdfsResource,
212 | user = hdfs_user,
213 | security_enabled = security_enabled,
214 | keytab = hdfs_user_keytab,
215 | kinit_path_local = kinit_path_local,
216 | hadoop_bin_dir = hadoop_bin_dir,
217 | hadoop_conf_dir = hadoop_conf_dir,
218 | principal_name = hdfs_principal_name,
219 | hdfs_site = hdfs_site,
220 | default_fs = default_fs
221 | )
222 |
223 |
--------------------------------------------------------------------------------
/package/scripts/params_server.py:
--------------------------------------------------------------------------------
1 | """
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | Ambari Agent
19 |
20 | """
21 |
22 |
23 | from resource_management.libraries.script.script import Script
24 | from resource_management.libraries.resources.hdfs_resource import HdfsResource
25 | from resource_management.libraries.functions import conf_select
26 | from resource_management.libraries.functions import stack_select
27 | from resource_management.libraries.functions.format import format
28 | from resource_management.libraries.functions.version import format_stack_version
29 | from resource_management.libraries.functions.default import default
30 | from resource_management.libraries.functions import get_kinit_path
31 |
32 |
33 | # server configurations
34 | config = Script.get_config()
35 |
36 | janusgraph_pid_dir = config['configurations']['janusgraph-env']['janusgraph_pid_dir']
37 | janusgraph_pid_file = format("{janusgraph_pid_dir}/janusgraph.pid")
38 |
--------------------------------------------------------------------------------
/package/scripts/service_check.py:
--------------------------------------------------------------------------------
1 | """
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | Ambari Agent
19 |
20 | """
21 |
22 | import os
23 | from resource_management import *
24 | from resource_management.core.resources.system import Execute, File
25 | from resource_management.core.source import InlineTemplate, StaticFile
26 | from resource_management.libraries.functions.format import format
27 | from resource_management.libraries.functions.version import compare_versions
28 | from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
29 | from resource_management.libraries.script.script import Script
30 | from resource_management.libraries.functions.validate import call_and_match_output
31 | from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
32 |
33 | class JanusGraphServiceCheck(Script):
34 | pass
35 |
36 | @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
37 | class JanusGraphServiceCheckDefault(JanusGraphServiceCheck):
38 | def service_check(self, env):
39 | import params
40 | env.set_params(params)
41 |
42 | File( format("{tmp_dir}/janusgraphSmoke.groovy"),
43 | content = StaticFile("janusgraphSmoke.groovy"),
44 | mode = 0755
45 | )
46 |
47 |
48 | if params.security_enabled:
49 | kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal};")
50 | Execute(kinit_cmd,
51 | user=params.smokeuser
52 | )
53 |
54 | secure=""
55 | if params.janusgraph_server_ssl == "true" :
56 | secure="-k"
57 | if params.janusgraph_server_ssl_key_cert_file:
58 | secure="--cacert " + params.janusgraph_server_ssl_key_cert_file.split(":")[1]
59 | grepresult=""" | grep 99"""
60 | if len(params.janusgraph_server_simple_authenticator) > 0:
61 | grepresult = ""
62 | headers=""" -XPOST -Hcontent-type:application/json -d '{"gremlin":"100-1"}' """
63 | http="http://"
64 | if params.janusgraph_server_ssl == "true":
65 | http="https://"
66 | janusgraph_server_host = http + format("{janusgraph_host}")
67 | janusgraph_port=format("{janusgraph_server_port}")
68 | cmd = "curl " + secure + headers + janusgraph_server_host + ":" + janusgraph_port + grepresult
69 | gremlin_bin = params.janusgraph_bin_dir + "/gremlin.sh"
70 |
71 | Execute((cmd),
72 | tries = 40,
73 | try_sleep = 5,
74 | path = format('{janusgraph_bin_dir}:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'),
75 | user = params.smokeuser,
76 | logoutput = True
77 | )
78 |
79 | Execute(format("{gremlin_bin} {tmp_dir}/janusgraphSmoke.groovy"),
80 | tries = 3,
81 | try_sleep = 5,
82 | path = format('{janusgraph_bin_dir}:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'),
83 | user = params.smokeuser,
84 | logoutput = True
85 | )
86 |
87 | if __name__ == "__main__":
88 | # print "Track service check status"
89 | JanusGraphServiceCheck().execute()
90 |
--------------------------------------------------------------------------------
/package/templates/janusgraph_solr_client_jaas.conf.j2:
--------------------------------------------------------------------------------
1 | {#
2 | # Licensed to the Apache Software Foundation (ASF) under one
3 | # or more contributor license agreements. See the NOTICE file
4 | # distributed with this work for additional information
5 | # regarding copyright ownership. The ASF licenses this file
6 | # to you under the Apache License, Version 2.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #}
18 |
19 | Client {
20 | com.sun.security.auth.module.Krb5LoginModule required
21 | useKeyTab=false
22 | useTicketCache=true;
23 | };
--------------------------------------------------------------------------------
/package/templates/janusgraph_solr_jaas.conf.j2:
--------------------------------------------------------------------------------
1 | {#
2 | # Licensed to the Apache Software Foundation (ASF) under one
3 | # or more contributor license agreements. See the NOTICE file
4 | # distributed with this work for additional information
5 | # regarding copyright ownership. The ASF licenses this file
6 | # to you under the Apache License, Version 2.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #}
18 |
19 | Client {
20 | com.sun.security.auth.module.Krb5LoginModule required
21 | useKeyTab=true
22 | storeKey=true
23 | useTicketCache=false
24 | keyTab="{{janusgraph_keytab_path}}"
25 | principal="{{janusgraph_jaas_princ}}";
26 | };
--------------------------------------------------------------------------------
/quicklinks/quicklinks.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "default",
3 | "description": "default quick links configuration",
4 | "configuration": {
5 | "protocol": {
6 | "type": "https",
7 | "checks": [
8 | {
9 | "property": "janusgraph_ssl_enable",
10 | "desired": "true",
11 | "site": "janusgraph-ssl"
12 | }
13 | ]
14 | },
15 | "links": [
16 | {
17 | "name": "janusgraph_ui",
18 | "label": "JanusGraph UI",
19 | "component_name": "JANUSGRAPH_SERVER",
20 | "url": "%@://%@:%@/janusgraph",
21 | "requires_user_name": "false",
22 | "port": {
23 | "http_property": "janusgraph_config_port",
24 | "http_default_port": "8182",
25 | "https_property": "janusgraph_config_port",
26 | "https_default_port": "8182",
27 | "regex": "^(\\d+)$",
28 | "site": "janusgraph-config-env"
29 | }
30 | }
31 | ]
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/screenshots/add_service.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/add_service.png
--------------------------------------------------------------------------------
/screenshots/add_service_orig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/add_service_orig.png
--------------------------------------------------------------------------------
/screenshots/add_service_wizard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/add_service_wizard.png
--------------------------------------------------------------------------------
/screenshots/add_service_wizard_JG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/add_service_wizard_JG.png
--------------------------------------------------------------------------------
/screenshots/add_service_wizard_select_JG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/add_service_wizard_select_JG.png
--------------------------------------------------------------------------------
/screenshots/assign_masters.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/assign_masters.png
--------------------------------------------------------------------------------
/screenshots/customize_services.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/customize_services.png
--------------------------------------------------------------------------------
/screenshots/customize_services_jg-env.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/customize_services_jg-env.png
--------------------------------------------------------------------------------
/screenshots/janusgraph_installed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/janusgraph_installed.png
--------------------------------------------------------------------------------
/screenshots/review.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chupman/janusgraph-ambari-service/b9aee72e61bef224d41bf4a7e57935da58633923/screenshots/review.png
--------------------------------------------------------------------------------