SSH tunnelling: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Marked this version for translation)
No edit summary
Line 190: Line 190:


<!--T:55-->
<!--T:55-->
In the following "PORT" is an arbitrary port number which should be opened in the firewall of Cedar's head node.
An SSH tunnel can be created from your desktop to database server, PostgreSQL or MySQL using the following command respectively:
Before trying this, please contact [[Technical support]] and we will assign a port number to you.
This is so that more than one user can use the database server at the same time.


<!--T:47-->
<!--T:47-->
Commands to connect to PostgreSQL and MySQL respectively are:
<pre>  
<pre>  
ssh -2 -L 127.0.0.1:PORT:cedar-pgsql-vm.int.cedar.computecanada.ca:5432 someuser@cedar.computecanada.ca
ssh -L PORT:cedar-pgsql-vm.int.cedar.computecanada.ca:5432 someuser@cedar.computecanada.ca
ssh -2 -L 127.0.0.1:PORT:cedar-mysql-vm.int.cedar.computecanada.ca:3306 someuser@cedar.computecanada.ca
ssh -L PORT:cedar-mysql-vm.int.cedar.computecanada.ca:3306 someuser@cedar.computecanada.ca
</pre>
</pre>


<!--T:48-->
<!--T:48-->
These commands connect your localhost:PORT to cedar.computecanada.ca:PORT and bind it with cedar-pgsql-vm.int.cedar.computecanada.ca:5432. "someuser" in this example is your Compute Canada username. The difference between this connection and an ordinary SSH connection is that you can now use another terminal to connect to the database server directly from your desktop. On your desktop run one of these commands, for PostgreSQL or MySQL as appropriate:
These commands connect your localhost:PORT to PostgreSQL or MySQL database server respectively. The port number you choose (PORT) should not be bigger than 32768 (2^15). "someuser" in this example is your Compute Canada username. The difference between this connection and an ordinary SSH connection is that you can now use another terminal to connect to the database server directly from your desktop. On your desktop run one of these commands, for PostgreSQL or MySQL as appropriate:


<!--T:49-->
<!--T:49-->
<pre>  
<pre>  
psql -h 127.0.0.1 -P PORT -U <your username> -W
psql -h 127.0.0.1 -P PORT -U <your username> -d <your database>
mysql -h 127.0.0.1 -P PORT -u <your username> -p
mysql -h 127.0.0.1 -P PORT -u <your username> -p  
</pre>
</pre>


<!--T:50-->
<!--T:50-->
Both MySQL and PostgreSQL will require a password.  
MySQL requires a password. The password is stored in your ".my.cnf" located in your home directory on Cedar.  
* For PostgreSQL the password is your Compute Canada password.
* For MySQL the password is stored in your ".my.cnf" located in your home directory on Cedar.  
The database connection will remain open as long as the SSH connection remains open.
The database connection will remain open as long as the SSH connection remains open.


</translate>
</translate>
cc_staff
163

edits

Navigation menu