Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit a80ce6f

Browse files
committed
Object Storage Compat & README detail
1 parent 10d58b4 commit a80ce6f

File tree

2 files changed

+62
-5
lines changed

2 files changed

+62
-5
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ You can customize the default root password for MySQL by editing the source scri
7979

8080
Note that you will also need to change "meta_db_port" in deploy_on_oci.py if you choose to run Postgres.
8181

82+
## Object Storage Integration
83+
As of the 2.1.0 release, included with this template is a means to deploy clusters with configuration to allow use of OCI Object Storage using S3 Compatability. In order to implement, an S3 Access and Secret key must be set up in the OCI Tenancy first. This process is detailed [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcredentials.htm#Working2). Once that is in place, modify the deploy_on_oci.py script, and set the following values:
84+
85+
s3_compat_enable = 'False'
86+
s3a_secret_key = 'None'
87+
s3a_access_key = 'None'
88+
s3a_endpoint = 'None'
89+
90+
The first should be set to 'True', then replace 'None" with each of the required values. This configuration will then be pushed as part of the cluster deployment.
91+
8292
## Deployment Syntax
8393
Deployment of the module is straight forward using the following Terraform commands
8494

scripts/deploy_on_oci.py

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,29 @@
130130
# Specify Log directory on cluster hosts - this is a separate block volume by default in Terraform
131131
LOG_DIR = '/var/log/cloudera'
132132

133+
# S3 Compatibility for OCI Object Storage - Set this to 'True' to enable
134+
s3_compat_enable = 'False'
135+
136+
# Set the following parameters for S3 Compatibility Access to OCI Object Storage
137+
s3a_secret_key = 'None'
138+
s3a_access_key = 'None'
139+
# The s3a endpoint is in the following format:
140+
# https://<tenancy_name>.compat.objectstorage.<home_region>.oraclecloud.com
141+
s3a_endpoint = 'None'
142+
133143
#
134144
# End Custom Global Parameters
135145
#
136146

147+
# Do not modify this
148+
149+
s3a_endpoint_config = '<property><name>fs.s3a.endpoint</name><value>' + s3a_endpoint + '</value></property>'
150+
s3a_secret_key_config = '<property><name>fs.s3a.secret.key</name><value>' + s3a_secret_key +'</value></property>'
151+
s3a_access_key_config = '<property><name>fs.s3a.access.key</name><value>' + s3a_access_key +'</value></property>'
152+
s3a_path_config = '<property><name>fs.s3a.path.style.access</name><value>true</value></property>'
153+
s3a_paging_config = '<property><name>fs.s3a.paging.maximum</name><value>1000</value></property>'
154+
s3a_config = s3a_endpoint_config + s3a_access_key_config + s3a_secret_key_config + s3a_path_config + s3a_paging_config
155+
137156
#
138157
# Some additional variables are needed - you should not modify these
139158
#
@@ -259,7 +278,7 @@ def build_api_endpoints(user_name, password):
259278
cluster_services_api, auth_roles_api, roles_config_api, all_hosts_api, \
260279
roles_api, mgmt_service_api, services_api, \
261280
mgmt_role_commands_api, mgmt_role_config_groups_api, \
262-
mgmt_roles_api
281+
mgmt_roles_api, external_accounts_api
263282
clusters_api = cm_client.ClustersResourceApi(api_client)
264283
users_api = cm_client.UsersResourceApi(api_client)
265284
cloudera_manager_api = cm_client.ClouderaManagerResourceApi(api_client)
@@ -275,6 +294,7 @@ def build_api_endpoints(user_name, password):
275294
mgmt_role_commands_api = cm_client.MgmtRoleCommandsResourceApi(api_client)
276295
mgmt_role_config_groups_api = cm_client.MgmtRoleConfigGroupsResourceApi(api_client)
277296
mgmt_roles_api = cm_client.MgmtRolesResourceApi(api_client)
297+
external_accounts_api = cm_client.ExternalAccountsResourceApi(api_client)
278298

279299

280300
def wait_for_active_cluster_commands(active_command):
@@ -1294,8 +1314,8 @@ def push_rcg_config(config):
12941314
rcg_roletype = 'DATANODE' # type: str
12951315
dfs_replication = [cm_client.ApiConfig(name='dfs_replication',
12961316
value=get_parameter_value(worker_shape, 'dfs_replication'))]
1297-
dfs_block_local = [cm_client.ApiConfig(name='dfs_block_local_path_acess_user',
1298-
value='impala,hbase,mapred,spark')]
1317+
1318+
core_site_safety_valve = [cm_client.ApiConfig(name='core_site_safety_valve', value=s3a_config)]
12991319
dfs_data_dir = [cm_client.ApiConfig(name='dfs_data_dir_list', value=dfs_data_dir_list)]
13001320
datanode_java_heapsize = [cm_client.ApiConfig(name='datanode_java_heapsize', value='351272960')]
13011321
dfs_datanode_data_dir_perm = [cm_client.ApiConfig(name='dfs_datanode_data_dir_perm', value='700')]
@@ -1314,6 +1334,8 @@ def push_rcg_config(config):
13141334
for config in dn_config_list:
13151335
push_rcg_config(config)
13161336
update_service_config(service_name=service, api_config_items=dfs_replication)
1337+
if s3_compat_enable == 'True':
1338+
update_service_config(service_name=service, api_config_items=core_site_safety_valve)
13171339
n = 0
13181340
if debug == 'True':
13191341
print('->DEBUG - Number of Workers: ' + str(len(worker_host_ids)))
@@ -2458,6 +2480,32 @@ def hdfs_enable_nn_ha(snn_host_id):
24582480
print('Exception calling ServicesResourceApi -> hdfs_enable_ha_command {}'.format(e))
24592481

24602482

2483+
def create_object_account():
2484+
"""
2485+
This will use ExternalAccountsResourceApi to setup S3 compatability account info
2486+
:return:
2487+
"""
2488+
body = cm_client.ApiExternalAccount()
2489+
2490+
try:
2491+
api_response = external_accounts_api.create_account(body=body)
2492+
if debug == 'True':
2493+
pprint(api_response)
2494+
except ApiException as e:
2495+
print('Exception calling ExternalAccountsResourceApi -> create_account {}'.format(e))
2496+
2497+
2498+
def read_account():
2499+
display_name = 'OCI'
2500+
view = 'summary'
2501+
2502+
try:
2503+
api_response = external_accounts_api.read_account_by_display_name(display_name, view=view)
2504+
pprint(api_response)
2505+
except ApiException as e:
2506+
print('%s' % e)
2507+
2508+
24612509
#
24622510
# END SECONDARY FUNCTIONS
24632511
#
@@ -2787,8 +2835,7 @@ def enable_kerberos():
27872835
pprint(cluster_host_list)
27882836
print('->Full Deployment Follows')
27892837
get_deployment_full()
2790-
end_trial()
2791-
update_license()
2838+
27922839
else:
27932840
print('Cluster Check returned null: %s' % cluster_exists)
27942841
else:

0 commit comments

Comments
 (0)