Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for SQL Stream Builder deployment #48

Merged
merged 2 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions roles/config/cluster/base/templates/configs/databases-7.1.0.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ SCHEMAREGISTRY:
database_name: {{ databases.SCHEMAREGISTRY.name }}
database_user: {{ databases.SCHEMAREGISTRY.user }}
database_password: {{ databases.SCHEMAREGISTRY.password }}
SQL_STREAM_BUILDER:
SERVICEWIDE:
database_host: {{ databases.SQL_STREAM_BUILDER.host }}
database_port: {{ databases.SQL_STREAM_BUILDER.port }}
database_type: {{ databases.SQL_STREAM_BUILDER.type | cloudera.cluster.format_database_type }}
database_schema: {{ databases.SQL_STREAM_BUILDER.name }}
database_user: {{ databases.SQL_STREAM_BUILDER.user }}
database_password: {{ databases.SQL_STREAM_BUILDER.password }}
MATERIALIZED_VIEW_ENGINE:
ssb.mve.datasource.url: jdbc:{{ databases.SQL_STREAM_BUILDER_MVE.type | cloudera.cluster.format_database_type }}://{{ databases.SQL_STREAM_BUILDER_MVE.host }}:{{ databases.SQL_STREAM_BUILDER_MVE.port }}/{{ databases.SQL_STREAM_BUILDER_MVE.name }}
ssb.mve.datasource.username: {{ databases.SQL_STREAM_BUILDER_MVE.user }}
ssb.mve.datasource.password: {{ databases.SQL_STREAM_BUILDER_MVE.password }}
STREAMS_MESSAGING_MANAGER:
SERVICEWIDE:
smm_database_host: {{ databases.STREAMS_MESSAGING_MANAGER.host }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ HUE:
FLINK:
SERVICEWIDE:
hdfs_service: hdfs
hive_service: hive
yarn_service: yarn
zookeeper_service: zoookeeper
zookeeper_service: zookeeper
{% if 'HIVE' in cluster.services %}
hive_service: hive
{% endif %}
{% if 'ATLAS' in cluster.services and not (cdh_cdp_upgrade|default(false)|bool) %}
atlas_service: atlas
{% endif %}
Expand Down Expand Up @@ -174,6 +176,17 @@ SPARK3_ON_YARN:
hive_service: hive
{% endif %}

SQL_STREAM_BUILDER:
SERVICEWIDE:
flink_service: flink
kafka_service: kafka
{% if 'HIVE' in cluster.services %}
hive_service: hive
{% endif %}
{% if 'KNOX' in cluster.services %}
knox_service: knox
{% endif %}

TEZ:
SERVICEWIDE:
yarn_service: yarn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
CORE_SETTINGS:
SERVICEWIDE:
hadoop_secure_web_ui: true
FLINK:
SERVICEWIDE:
kerberos.auth.enabled: true
HBASE:
SERVICEWIDE:
hbase_restserver_security_authentication: kerberos
Expand Down
24 changes: 23 additions & 1 deletion roles/config/cluster/base/templates/configs/tls-7.3.1.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
---
OZONE:
OZONE_PROMETHEUS:
ozone.prometheus.ca.file: {{ tls_chain_path }}
ozone.prometheus.ca.file: {{ tls_chain_path }}
SQL_STREAM_BUILDER:
STREAMING_SQL_ENGINE:
ssl_client_truststore_location: {{ tls_truststore_path }}
ssl_client_truststore_password: {{ tls_truststore_password }}
ssl_enabled: true
ssl_server_keystore_keypassword: {{ tls_keystore_password }}
ssl_server_keystore_location: {{ tls_keystore_path_generic }}
ssl_server_keystore_password: {{ tls_keystore_password }}
MATERIALIZED_VIEW_ENGINE:
ssl_client_truststore_location: {{ tls_truststore_path }}
ssl_client_truststore_password: {{ tls_truststore_password }}
ssl_enabled: true
ssl_server_keystore_keypassword: {{ tls_keystore_password }}
ssl_server_keystore_location: {{ tls_keystore_path_generic }}
ssl_server_keystore_password: {{ tls_keystore_password }}
STREAMING_SQL_CONSOLE:
ssl_client_truststore_location: {{ tls_chain_path }}
ssl_enabled: true
ssl_server_ca_certificate_location: {{ tls_chain_path }}
ssl_server_certificate_location: {{ tls_cert_path_generic }}
ssl_server_privatekey_location: {{ tls_key_path_generic }}
ssl_server_privatekey_password: {{ tls_key_password }}
1 change: 1 addition & 0 deletions roles/config/cluster/common/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ cluster_services_ordered:
- CRUISE_CONTROL
- DAS
- FLINK
- SQL_STREAM_BUILDER
- SPARK
- SPARK2_ON_YARN
- SPARK3_ON_YARN
Expand Down
4 changes: 2 additions & 2 deletions roles/deployment/databases/tasks/mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
encoding: "{{ service | cloudera.cluster.get_database_encoding_mysql }}"
collation: "{{ service | cloudera.cluster.get_database_collation_mysql }}"
become: yes
loop: "{{ databases | intersect(services) }}"
loop: "{{ databases }}"
loop_control:
loop_var: service
delegate_to: "{{ databases[service].host }}"
Expand All @@ -36,7 +36,7 @@
priv: "{{ databases[service].name }}.*:ALL"
no_log: yes
become: yes
loop: "{{ databases | intersect(services) }}"
loop: "{{ databases }}"
loop_control:
loop_var: service
delegate_to: "{{ databases[service].host }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/deployment/databases/tasks/postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
password: "{{ databases[item].password }}"
become: yes
become_user: postgres
with_items: "{{ databases | intersect(services) }}"
with_items: "{{ databases }}"
delegate_to: "{{ databases[item].host }}"
connection: ssh
when: databases[item].host in groups.db_server
Expand All @@ -32,7 +32,7 @@
encoding: UTF-8
become: yes
become_user: postgres
with_items: "{{ databases | intersect(services) }}"
with_items: "{{ databases }}"
delegate_to: "{{ databases[item].host }}"
connection: ssh
when: databases[item].host in groups.db_server
14 changes: 14 additions & 0 deletions roles/deployment/definition/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ database_defaults:
name: schemaregistry
user: schemaregistry
password: "{{ database_default_password }}"
SQL_STREAM_BUILDER:
host: "{{ database_host }}"
port: "{{ database_type | cloudera.cluster.default_database_port }}"
type: "{{ database_type }}"
name: ssb_admin
user: ssb_admin
password: "{{ database_default_password }}"
SQL_STREAM_BUILDER_MVE:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is any magic required to make this DB get provisioned? I had a feeling that this is a list of services rather than a list of databases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a list of databases. There was no additional magic required. Just added the db here and it got created correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised because here: https://github.com/cloudera-labs/cloudera.cluster/blob/main/roles/deployment/databases/tasks/mariadb.yml#L17 it's iterating through the databases using the list of services as a key. I'm struggling tos ee how SQL_STREAM_BUILDER_MVE would ever get created.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm... that's a good point, @tmgstevens . Let me review/retest this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmgstevens I've reviewed this and I believe there's no need for the MariaDB and PostgreSQL db creation role to filter the list of databases by the service names ({{ databases | intersect(services) }}). Removing that subtraction appears to be harmless to me and makes it more flexible, since you can specify multiple databases per service if needed, which is the case of SSB.

I've made the change and re-tested it and the database is now being created successfully and I haven't seen any collateral effects so far.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the side effect of this be that all database get created now, regardless of whether they are being used, due to the way that the config merge happens>=?

host: "{{ database_host }}"
port: "{{ database_type | cloudera.cluster.default_database_port }}"
type: "{{ database_type }}"
name: ssb_mve
user: ssb_mve
password: "{{ database_default_password }}"
STREAMS_MESSAGING_MANAGER:
host: "{{ database_host }}"
port: "{{ database_type | cloudera.cluster.default_database_port }}"
Expand Down
57 changes: 29 additions & 28 deletions roles/deployment/repometa/templates/all_services.j2
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
- KEYTRUSTEE_SERVER
- ZOOKEEPER
- INFRA_SOLR
- RANGER
- RANGER_KMS
- RANGER_KMS_KTS
- RANGER_RAZ
- KMS
- HDFS
- SENTRY
- LIVY
- HBASE
- SOLR
- SQOOP
- SQOOP_CLIENT
- ACCUMULO16
- ACCUMULO_C6
- HIVE
- TEZ
- HIVE_ON_TEZ
- KUDU
- IMPALA
- YARN
- ADLS_CONNECTOR
- ATLAS
- AWS_S3
- CDSW
- CORE_SETTINGS
- CRUISE_CONTROL
- DAS
- FLINK
- FLUME
- SPARK
- SPARK2_ON_YARN
- SPARK3_ON_YARN
- SPARK_ON_YARN
- HBASE
- HDFS
- HIVE
- HIVE_ON_TEZ
- HUE
- IMPALA
- INFRA_SOLR
- ISILON
- KAFKA
- KEYTRUSTEE
- KEYTRUSTEE_SERVER
- KMS
- KNOX
- KS_INDEXER
- KUDU
- LIVY
- LUNA_KMS
- MAPREDUCE
- NIFI
- NIFIREGISTRY
- NIFITOOLKITCA
- OOZIE
- OZONE
- PHOENIX
- QUEUEMANAGER
- RANGER
- RANGER_KMS
- RANGER_KMS_KTS
- RANGER_RAZ
- SCHEMAREGISTRY
- SENTRY
- SOLR
- SPARK
- SPARK2_ON_YARN
- SPARK3_ON_YARN
- SPARK_ON_YARN
- SQL_STREAM_BUILDER
tmgstevens marked this conversation as resolved.
Show resolved Hide resolved
- SQOOP
- SQOOP_CLIENT
- STREAMS_MESSAGING_MANAGER
- STREAMS_REPLICATION_MANAGER
- TEZ
- THALES_KMS
- WXM
- YARN
- ZEPPELIN
- ATLAS
- OOZIE
- HUE
- ZOOKEEPER
4 changes: 4 additions & 0 deletions roles/deployment/repometa/templates/role_mappings/flink.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
FLINK:
- FLINK_HISTORY_SERVER
- GATEWAY
SQL_STREAM_BUILDER:
- STREAMING_SQL_ENGINE
- MATERIALIZED_VIEW_ENGINE
- STREAMING_SQL_CONSOLE
7 changes: 7 additions & 0 deletions roles/prereqs/local_accounts_common/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ local_accounts:
comment: Flink
keystore_acl: True

- user: ssb
home: /var/lib/ssb
comment: SQL Stream Builder
keystore_acl: True
key_acl: True
key_password_acl: True

- user: flume
home: /var/lib/flume-ng
comment: Flume
Expand Down
18 changes: 18 additions & 0 deletions roles/prereqs/postgresql_connector/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---

postgresql_connector_url: https://jdbc.postgresql.org/download/postgresql-42.3.3.jar
postgresql_connector_checksum: md5:bef0b2e1c6edcd8647c24bed31e1a4ac
17 changes: 17 additions & 0 deletions roles/prereqs/postgresql_connector/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2021 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
dependencies:
- role: cloudera.cluster.deployment.definition
tmgstevens marked this conversation as resolved.
Show resolved Hide resolved
37 changes: 37 additions & 0 deletions roles/prereqs/postgresql_connector/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2021 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---

- name: Download PostgreSQL Connector
get_url:
url: "{{ postgresql_connector_url }}"
dest: "{{ local_temp_dir }}/postgresql-connector-java.jar"
checksum: "{{ postgresql_connector_checksum }}"
mode: 0644
become: no
run_once: true
delegate_to: localhost

- name: Create /usr/share/java directory
file:
path: /usr/share/java
state: directory
mode: 0755

- name: Copy PostgreSQL Connector jar file to correct location
copy:
src: "{{ local_temp_dir }}/postgresql-connector-java.jar"
dest: /usr/share/java/postgresql-connector-java.jar
mode: 0644