SQL connection string how to find node and host

How to find jdbc connection string when mysql is on gateway node so how to figure out host name and node , what command we can use to find out in exam

Here is the connection string for jdbc connection.

–connect jdbc:mysql://{{cluster_data.manager_node_hostname}}:3306/retail_db

You have to replace {{cluster_data.manager_node_hostname}} with hostname. You can get this info by typing command hostname -f.

If you give command hostname -f in Cloudera VM you will get quickstart.cloudera.

So for cloudera VM, connection string is --connect “jdbc:mysql://quickstart.cloudera:3306/retail_db”

2 Likes

Thank you Rahul for replying ,and solve this.

can you please confirm if the port “3306” is always constant in case of mysql ?