You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* update PyMongo version to use
* update lsof command
So far, this command will only return the port of the most recently websocat process.
If you have another localhost process for other purposes (i.e python3 -m http.server --bind localhost),
this command won't return the python process.
Copy file name to clipboardExpand all lines: docs/cloud/rahti/tutorials/connect-database-hpc.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# Accessing databases on Rahti from CSC supercomputers
2
2
3
+
!!! infos
4
+
This tutorial can also be applied if you are running websocat locally or in a cPouta instance for other purposes.
5
+
3
6
Many HPC workflows require a database. Running these on the login node poses several issues and running on Pouta brings administration overhead. Rahti is a good candidate, but one obstacle is that Rahti does not support non-HTTP traffic from external sources.
4
7
5
8
A workaround for this problem is to establish a TCP tunnel over an HTTP-compatible WebSocket connection. This can be achieved using a command-line client for connecting to and serving WebSockets called [WebSocat](https://github.com/vi/websocat). Here, a WebSocat instance running on Puhti/Mahti translates a database request coming from a workflow to an HTTP-compatible WebSocket protocol. Once the traffic enters Rahti we use another WebSocat instance running inside Rahti to translate back the WebSocket connection to a TCP connection over the original port the database is configured to receive traffic. A drawing of the process is shown below.
@@ -37,8 +40,7 @@ Configuring MongoDB and WebSocat on Rahti can be done either through the web int
37
40
- An [OpenShift template](https://github.com/CSCfi/websocat-template/blob/main/websocat-template.yaml) is needed to configure WebSocat on Rahti. Download or copy this YAML file to your clipboard. Note that this is an unsupported beta template
38
41
- On the Rahti web interface front page, select Import YAML/JSON and add the WebSocat template to the same project as the MongoDB (upload by dragging & dropping, selecting it, or pasting from the clipboard). Do not edit the template!
39
42
- Select Create, process the template and input the above hostname and target port in the requested database service name and database port fields
40
-
- Select the created project, navigate to `Applications > Services` and select the WebSocat service. Remember the
41
-
- Route hostname (of the form `websocat-<project name>.rahtiapp.fi`)
43
+
- Select the created project, navigate to `Applications > Services` and select the WebSocat service. Remember the route hostname (of the form `websocat-<project_name>.rahtiapp.fi`)
42
44
43
45
### Option 2: Using the `oc` command line tool
44
46
@@ -78,7 +80,7 @@ MongoDB and WebSocat have now been set up on Rahti and you should have the follo
78
80
-[Download `websocat` from GitHub](https://github.com/vi/websocat/releases) and add it to your `PATH`. For example:
echo"Got target port $(cat /tmp/$USER/${SLURM_JOB_ID}_rahtidb_port)"
93
95
```
94
96
@@ -97,6 +99,9 @@ echo "Got target port $(cat /tmp/$USER/${SLURM_JOB_ID}_rahtidb_port)"
97
99
98
100
- Now `websocat` is running in the interactive session/batch job and you may connect to your MongoDB database on Rahti using the obtained target port. You can verify the connection with e.g. Python. Note that the username and password below refer to the created database service, not your CSC credentials
99
101
102
+
!!! info
103
+
PyMongo version 3.13.0 must be installed otherwise the driver is too new for the MongoDB server. (More information: https://pymongo.readthedocs.io/en/stable/common-issues.html#server-reports-wire-version-x-pymongo-requires-y)
0 commit comments