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 Postgres server on cedar from a desktop ==
== Example for connecting to a database server on cedar from a desktop ==
The command is
The command 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
ssh -2 -L 127.0.0.1:PORT:cedar-mysql-vm.int.cedar.computecanada.ca:3306
</pre>
</pre>


By running this command you will be connected to cedar (like any other ssh connection). Now, you can use another xterm  and connect to database server directly from your desktop. Here is the command:
By running one of these commands you will be connected to cedar (like any other ssh connection). The only difference between this connection and other ssh connection is that you can now use another xterm  and connect to database server directly from your desktop. Here is the command for PostgreSQL and MySQL respectively:


<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> -W
mysql -h 127.0.0.1 -P PORT -p
</pre>
</pre>


The connection requires a password which is your computecanada password. The postgres connection will remain open as long as your have your ssh connection. In above example "PORT" is a arbitrary port 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 a file called .my.cnf located in your home directory of cedar. The connections will remain open as long as your have your above ssh connection. In this example "PORT" is a arbitrary port 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