Created on 02-01-2019 07:04 AM - edited 09-16-2022 08:32 AM
Greetings,
We are using Cloudera Director, with databases stored on AWS RDS.
Director was using the IP address of the RDS database, as opposed to the hostname. I recently enabled Multi-AZ on the RDS database, and now it has multiple IP addresses.
How can I update the config for the external database in Director so that new clusters are created against the RDS database's hostname instead of the IP address?
I tried the unsupported database update mechanism via the director API at `PUT /api/v12/environments/{environment}/databaseServers/{externalDatabaseServer}` (filled in obviously) with a bunch of different json body contents. However, director just responds with a `UnsupportedExternalDatabaseServerUpdateException` regardless of the format I give. I've tried enabling debug logging to see if there is additional information in application.log, but I can't seem to find the good stuff.
I tried opening director's database, but the tables containing database config information are encrypted in-row (gibberish in the cells).
I'm hoping someone can send a sample API call that could take an existing external mysql database, and just pop in a new hostname. My alternative seems to be re-creating my entire manager + clusters from scratch with a new database template. This will bring a lot of sadness.
It's director 2.8.1.
Created 02-01-2019 12:21 PM
Quick update -- there's actually more to do.
THIS IS ALL UNSUPPORTED AND AT YOUR OWN RISK. BE WARNED!
Disable DB Encryption
systemctl stop cloudera-director-server
lp.encryption.twoWayCipher: transitional
lp.encryption.twoWayCipherConfig: desede;ZGVmYXVsdGRpcmVjdG9yZGVzZWRla2V5|passthrough;
systemctl start cloudera-director-server
mysql -h --ssl-ca=/etc/cloudera-director-server/rds-combined-ca-bundle.pem --ssl-verify-server-cert -u director -p
USE director;
SELECT TEMPLATE FROM EXTERNAL_DATABASE_SERVERS;
Here is an example response (truncated and redacted):
+-------...-----+ | TEMPLATE ... | | {"name":"my-manager-db","type":"MYSQL","host":"1.2.3.4","port":null,"adminUser":"my_username","adminPassword":"my_password","config":{"engineVersion":"5.6.37","allocatedStorage":"20","multiAZ":"false","vpcSecurityGroupIds":"sg-1234567a","dbSubnetGroupName":"my-rds-subnet-group","instanceClass":"db.m4.large","storageEncrypted":"true"},"tags":{}} | +-------...-----+
Update the database
Before we actually edit the hostname, we should have Director update the misc database properties.
systemctl stop cloudera-director-server
mysql -h --ssl-ca=/etc/cloudera-director-server/rds-combined-ca-bundle.pem --ssl-verify-server-cert -u director -p
USE director;
UPDATE SERVER_CONFIGS SET CONFIG_VALUE = 'true' WHERE CONFIG_KEY = 'refreshExternalDatabaseServersOnStart';
systemctl start cloudera-director-server
systemctl stop cloudera-director-server
USE director;
UPDATE SERVER_CONFIGS SET CONFIG_VALUE = 'false' WHERE CONFIG_KEY = 'refreshExternalDatabaseServersOnStart';
USE director;
SELECT TEMPLATE FROM EXTERNAL_DATABASE_SERVERS;
echo '{new long json string}' | jq .
USE director;
UPDATE EXTERNAL_DATABASE_SERVERS SET TEMPLATE = '{new long json string}' WHERE NAME = 'my-manager-db';
SELECT EXTERNAL_DATABASE_SERVER FROM EXTERNAL_DATABASE_SERVERS;
<echo '{new long strong}' | jq .
UPDATE EXTERNAL_DATABASE_SERVERS SET EXTERNAL_DATABASE_SERVER = '{new long strong}' WHERE NAME = 'my-manager-db';
If everything looks good -- stop cloudera server, re-enable encryption, and start cloudera server back up.
Created 02-01-2019 08:01 AM
Hello! Unfortunately, there's no way to do this in Director as you're suggesting. This API call is a placeholder, and doesn't support any actual updates.
Do you have the option of engaging support for this? That would be my recommended path forward.
It is possible to remove the encryption from Director's database (https://www.cloudera.com/documentation/director/2-8-x/topics/director_db_encryption.html), but any sort of DB editing is entirely unsupported.
Created 02-01-2019 09:27 AM
I know the above is unsupported, but may I ask -- are there any known-issues which make using the "refreshExternalDatabaseServersOnStart" config setting a Bad Thing? Seems to have saved my bacon.
Created on 02-01-2019 09:24 AM - edited 02-01-2019 12:22 PM
UPDATE -- See my new post below. This post is incomplete.
______
To anyone else that is stuck:
systemctl stop cloudera-director-server
mysql -h <rds_endpoint_of_director_db> --ssl-ca=/etc/cloudera-director-server/rds-combined-ca-bundle.pem --ssl-verify-server-cert -u director -p
use director; UPDATE SERVER_CONFIGS SET CONFIG_VALUE = 'true' WHERE CONFIG_KEY = 'refreshExternalDatabaseServersOnStart';
systemctl start cloudera-director-server; tail -f /var/log/cloudera-director-server/application.log
This seems to have worked.
Created 02-01-2019 12:21 PM
Quick update -- there's actually more to do.
THIS IS ALL UNSUPPORTED AND AT YOUR OWN RISK. BE WARNED!
Disable DB Encryption
systemctl stop cloudera-director-server
lp.encryption.twoWayCipher: transitional
lp.encryption.twoWayCipherConfig: desede;ZGVmYXVsdGRpcmVjdG9yZGVzZWRla2V5|passthrough;
systemctl start cloudera-director-server
mysql -h --ssl-ca=/etc/cloudera-director-server/rds-combined-ca-bundle.pem --ssl-verify-server-cert -u director -p
USE director;
SELECT TEMPLATE FROM EXTERNAL_DATABASE_SERVERS;
Here is an example response (truncated and redacted):
+-------...-----+ | TEMPLATE ... | | {"name":"my-manager-db","type":"MYSQL","host":"1.2.3.4","port":null,"adminUser":"my_username","adminPassword":"my_password","config":{"engineVersion":"5.6.37","allocatedStorage":"20","multiAZ":"false","vpcSecurityGroupIds":"sg-1234567a","dbSubnetGroupName":"my-rds-subnet-group","instanceClass":"db.m4.large","storageEncrypted":"true"},"tags":{}} | +-------...-----+
Update the database
Before we actually edit the hostname, we should have Director update the misc database properties.
systemctl stop cloudera-director-server
mysql -h --ssl-ca=/etc/cloudera-director-server/rds-combined-ca-bundle.pem --ssl-verify-server-cert -u director -p
USE director;
UPDATE SERVER_CONFIGS SET CONFIG_VALUE = 'true' WHERE CONFIG_KEY = 'refreshExternalDatabaseServersOnStart';
systemctl start cloudera-director-server
systemctl stop cloudera-director-server
USE director;
UPDATE SERVER_CONFIGS SET CONFIG_VALUE = 'false' WHERE CONFIG_KEY = 'refreshExternalDatabaseServersOnStart';
USE director;
SELECT TEMPLATE FROM EXTERNAL_DATABASE_SERVERS;
echo '{new long json string}' | jq .
USE director;
UPDATE EXTERNAL_DATABASE_SERVERS SET TEMPLATE = '{new long json string}' WHERE NAME = 'my-manager-db';
SELECT EXTERNAL_DATABASE_SERVER FROM EXTERNAL_DATABASE_SERVERS;
<echo '{new long strong}' | jq .
UPDATE EXTERNAL_DATABASE_SERVERS SET EXTERNAL_DATABASE_SERVER = '{new long strong}' WHERE NAME = 'my-manager-db';
If everything looks good -- stop cloudera server, re-enable encryption, and start cloudera server back up.
Created 02-01-2019 12:38 PM