02-25-2016 02:28 PM
I want to know that how can we find the connection string to import the data from Mysql using sqoop on cluster.
Like on local cloudera VM, usually we use "jdbc:mysql://quickstart.cloudera:3306/<database-name>
where quicstart.cloudera is hostname.
If I type the shell command $ hostname it retrieve the quickstart.cloudera.
As everything is on one machine, so we use this hostname,
But on cluster suppose we have four worker nodes, one master node, we have given username and password for Mysql, How we can check the hostname for connection string. Will it be same like if i run the shell command $ hostname , and i have to use the that result of this command as hostname. and moreover on local VM i even don't need port no. so on cluster how can we check the port no. also??
I am very badly stuck over here.
so really need a favor.
02-28-2016 08:10 AM
03-02-2016 02:01 PM
Thanks for response. But my big confusion is that how can I came to know that MySQL is installed on which hostname. How can I get that hostname, if I don't know, on local machine or on pseduodistributed mode, actually there is one host , so I can get the hostname , easily by running the command $hostname
But on actual cluster it will not work. If I am right??
I have found the one solution , pleasae validate it if it will give me the correct hostname on which MySQL is installed.
1. login mysql as root
$ mysql -u root -p
2. mysql> use mysql;
3. mysql> select host, user from user;
| host | user |
| % | amon |
| % | cm |
| % | hive |
| % | hue |
| % | nav |
| % | navms |
| % | oozie |
| % | retail_db |
| % | retail_dba |
| % | rman |
| % | sentry |
| 127.0.0.1 | root |
| localhost | root |
| quickstart.cloudera | root |
14 rows in set (0.05 sec)
it will give me the hostname of root.
and it can be used in connection string to make connection.
09-11-2017 07:01 PM
@Manish22 all business will have some kind of mapping doc / excel to let you know where the mysql is ruining like which host and its credentials ,database , tables etc . if you just want to see the hostaname all you can do is fire $HOSTNAME in the terminal . that will return the hostname are go to /etc/hostname or /etc/syconfig/network . Hope this helps