User Tools

Site Tools


wiki:advanced:multi-node:x2goserver-pgsql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
wiki:advanced:multi-node:x2goserver-pgsql [2013/03/12 20:39]
sunweaver
wiki:advanced:multi-node:x2goserver-pgsql [2013/09/23 19:22]
sunweaver
Line 116: Line 116:
  
 After that step users of the posix group ''x2gousers'' can create X2Go sessions. Of course, any other group could be used here, as well. After that step users of the posix group ''x2gousers'' can create X2Go sessions. Of course, any other group could be used here, as well.
 +
 +===== Database Structure and Troubleshooting =====
 +
 +In hopefully rare cases it may become necessary to fix the X2Go session database via standard PostgreSQL tools (e.g. ''psql''). This should not happen and please please please report the issue [[wiki:bugs|as a bug against the x2goserver]] X2Go component. However, if you are in the unlucky situation of having to fix up the session DB, then the below lines may render useful to you.
 +
 +==== Connect to the database ====
 +
 +In case it becomes necessary to edit the X2Go session database on the PostgreSQL server by hand, connect to the DB with this command:
 +
 +<code>
 +$ psql --user x2godbuser --password -h localhost --dbname x2go_sessions
 +</code>
 +
 +As password use the password found in ''/etc/x2go/x2gosql/passwords/x2goadmin''.
 +
 +
 +After successful login, the ''psql'' PostgreSQL client shows these lines:
 +
 +<file>
 +ts-01:~ # psql --user x2godbuser --password -h localhost --dbname x2go_sessions
 +Password for user x2godbuser: <hidden>
 +Welcome to psql <version>, the PostgreSQL interactive terminal.
 +
 +Type:  \copyright for distribution terms
 +       \h for help with SQL commands
 +       \? for help with psql commands
 +       \g or terminate with semicolon to execute query
 +       \q to quit
 +
 +x2go_sessions=>
 +</file>
 +
 +==== Database structure ====
 +
 +The database has five tables:
 +
 +<file>
 +x2go_sessions=> \dt
 +             List of relations
 + Schema |     Name      | Type  |  Owner   
 +--------+---------------+-------+----------
 + public | messages      | table | postgres
 + public | mounts        | table | postgres
 + public | sessions      | table | postgres
 + public | used_ports    | table | postgres
 + public | user_messages | table | postgres
 +(5 rows)
 +</file>
 +
 +Three of them are important for session management: sessions, used_ports, mounts.
 +
 +Furthermore, the database defined four views:
 +
 +<file>
 +x2go_sessions=> \dv
 +            List of relations
 + Schema |     Name      | Type |  Owner   
 +--------+---------------+------+----------
 + public | mounts_view   | view | postgres
 + public | ports_view    | view | postgres
 + public | servers_view  | view | postgres
 + public | sessions_view | view | postgres
 +(4 rows)
 +
 +x2go_sessions=> 
 +</file>
 +
 +If you want to show the content of a table or view, evoke this SQL command:
 +
 +<file>
 +x2go_sessions=> select * from used_ports;
 +    server    |              session_id                 creator_id    | port  
 +--------------+---------------------------------------+-----------------+-------
 + ts-01 | mike-57-1379961697_stRTERMINAL_dp24 | x2gouser_mike | 30019
 + ts-01 | mike-57-1379961697_stRTERMINAL_dp24 | x2gouser_mike | 30018
 + ts-01 | mike-57-1379961697_stRTERMINAL_dp24 | x2gouser_mike | 30020
 +(3 rows)
 +</file>
 +
 +==== Troubleshooting ====
 +
 +If you want to remove these entries (because they are there but they by some reason should not be there), use this command set:
 +
 +<code>
 +x2go_sessions=> delete from used_ports where port=30020;
 +DELETE 1
 +</code>
 +
 +... or ...
 +
 +<code>
 +x2go_sessions=> delete from used_ports where session_id=mike-57-1379961697_stRTERMINAL_dp24;
 +DELETE 3
 +</code>
 +
 +For further input on manipulating PostgreSQL database via the ''psql'' client tool, see the PostgreSQL reference.
  
  
wiki/advanced/multi-node/x2goserver-pgsql.txt ยท Last modified: 2016/03/29 19:40 by stefanbaur