SSH tunnelling: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 167: Line 167:
Replace the token in this example with the one given to you in Session 1. You can also type <code>http://localhost:8888</code> and there will be a prompt asking you for the token, which you can then copy and paste.
Replace the token in this example with the one given to you in Session 1. You can also type <code>http://localhost:8888</code> and there will be a prompt asking you for the token, which you can then copy and paste.


== Example for connecting to a database server on cedar from a desktop ==
== Example for connecting to a database server on cedar from your desktop ==
Commands to connect to PostgreSQL and MySQL respectively are:
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
ssh -2 -L 127.0.0.1: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
ssh -2 -L 127.0.0.1:PORT:cedar-mysql-vm.int.cedar.computecanada.ca:3306 someuser@cedar.computecanada.ca
</pre>
</pre>


By running one of these commands you will be connected to cedar (like any other ssh connection). The only difference between this connection and an ordinary ssh connection is that you can now use another terminal and connect to database server directly from your desktop. Here are commands for PostgreSQL and MySQL connection respectively:
These commands move 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 username on computecanada. By running one of these commands you will be connected to cedar (like any other ssh connection). The only 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. Here are commands for PostgreSQL and MySQL connection respectively:


<pre>  
<pre>  
Line 181: Line 181:
</pre>
</pre>


The connection requires a password for both MySQL and PostgreSQL. However, for PostgreSQL the password is your computecanada password and for MySQL the password is stored in your ".my.cnf" located in your home directory on cedar. The connections will remain open as long as your have your above ssh connection. In this example "PORT" is an arbitrary number and it should be opened in firewall of cedar head node. So, please before running this command send a request to support@computecanada.ca and we will assign a port number for you.
The connection requires a password for both MySQL and PostgreSQL. However, for PostgreSQL the password is your computecanada password and for MySQL the password is stored in your ".my.cnf" located in your home directory on cedar. The connections will remain open as long as your have the ssh connection. In this example "PORT" is an arbitrary number and it should be opened in firewall of cedar head node. So, please before running this command send a request to support@computecanada.ca and we will assign a port number for you.
cc_staff
163

edits

Navigation menu