Mercurial > hg > orthanc-book
annotate Sphinx/source/plugins/postgresql.rst @ 991:1316bc62b5d5
migration to UCLouvain servers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 21 Nov 2023 21:09:02 +0100 |
parents | 8b8df1be0cf9 |
children | 05b106383b2a |
rev | line source |
---|---|
24 | 1 .. _postgresql: |
2 | |
3 | |
4 PostgreSQL plugins | |
5 ================== | |
6 | |
27 | 7 .. contents:: |
8 | |
9 The Orthanc project provides two **official** plugins to replace the | |
10 default storage area (on the filesystem) and the default SQLite index | |
11 by a PostgreSQL database. | |
12 | |
13 For general information, check out the `official homepage of the | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
14 plugins <https://www.orthanc-server.com/static.php?page=postgresql>`__. |
27 | 15 |
643
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
16 For information about scalability, make sure to read the section about |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
17 :ref:`multiple writers in large-scale deployments <multiple-writers>`. |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
18 |
750 | 19 The source code of the PostgreSQL plugins can be found in the |
20 ``orthanc-databases`` `Mercurial repository | |
991
1316bc62b5d5
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
21 <https://orthanc.uclouvain.be/hg/orthanc-databases/>`__, next to the |
750 | 22 source code of the :ref:`ODBC <odbc>` and |
23 :ref:`MySQL/MariaDB <mysql>` plugins. | |
27 | 24 |
25 | |
26 Compilation | |
27 ----------- | |
28 | |
128 | 29 Static linking |
30 ^^^^^^^^^^^^^^ | |
31 | |
27 | 32 .. highlight:: text |
33 | |
154 | 34 The procedure to compile these plugins is similar to that for the |
27 | 35 :ref:`core of Orthanc <compiling>`. The following commands should work |
154 | 36 for most UNIX-like distribution (including GNU/Linux):: |
27 | 37 |
154 | 38 $ mkdir BuildPostgreSQL |
39 $ cd BuildPostgreSQL | |
40 $ cmake ../PostgreSQL -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release | |
27 | 41 $ make |
42 | |
43 The compilation will produce 2 shared libraries, each containing one plugin for Orthanc: | |
44 | |
45 * ``OrthancPostgreSQLIndex`` replaces the default SQLite index of Orthanc by PostgreSQL. | |
46 * ``OrthancPostgreSQLStorage`` makes Orthanc store the DICOM files it receives into PostgreSQL. | |
47 | |
128 | 48 |
49 Microsoft Windows and Apple OS X | |
50 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
51 | |
750 | 52 Pre-compiled binaries for Microsoft Windows 32bit `are also available |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
53 <https://www.orthanc-server.com/browse.php?path=/plugin-postgresql>`__. |
30 | 54 A package for `Apple's Mac OS X |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
55 <https://www.osimis.io/en/download.html>`__ |
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
56 is available courtesy of `Osimis <https://www.osimis.io/>`__. |
27 | 57 |
58 | |
263
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
59 .. _postgresql-ubuntu1604: |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
60 |
128 | 61 Dynamic linking on Ubuntu 16.04 |
62 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
63 | |
64 .. highlight:: text | |
65 | |
66 If static linking is not desired, here are build instructions for | |
67 Ubuntu 16.04 (provided build dependencies for the :ref:`core of | |
68 Orthanc <compiling>` have already been installed):: | |
69 | |
70 $ sudo apt-get install libpq-dev postgresql-server-dev-all | |
154 | 71 $ mkdir BuildPostgreSQL |
72 $ cd BuildPostgreSQL | |
73 $ cmake ../PostgreSQL -DCMAKE_BUILD_TYPE=Release \ | |
74 -DALLOW_DOWNLOADS=ON \ | |
75 -DUSE_SYSTEM_GOOGLE_TEST=OFF \ | |
76 -DUSE_SYSTEM_ORTHANC_SDK=OFF | |
128 | 77 $ make |
78 | |
263
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
79 |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
80 .. _postgresql-cmake: |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
81 |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
82 Dynamic linking on other GNU/Linux distributions |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
83 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
84 |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
85 .. highlight:: text |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
86 |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
87 The build instructions should always be very similar to those for |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
88 :ref:`Ubuntu 16.04 <postgresql-ubuntu1604>`. One difficulty that could |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
89 however arise is that it is possible that the CMake environment that |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
90 is shipped with the GNU/Linux distribution cannot locate a recent |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
91 version of the development headers for PostgreSQL. This leads to an |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
92 error while invoking CMake that looks like:: |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
93 |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
94 -- Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
95 |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
96 In such a situation, please add your version of PostgreSQL to the |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
97 macro ``PostgreSQL_ADDITIONAL_VERSIONS`` that is defined at the end of |
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
98 the `Resources/CMake/PostgreSQLConfiguration.cmake file |
991
1316bc62b5d5
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
99 <https://orthanc.uclouvain.be/hg/orthanc-databases/file/default/Resources/CMake/PostgreSQLConfiguration.cmake>`__ |
361 | 100 in the sources of the project. |
263
39609c9a2c41
note about includes for postgresql
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
101 |
128 | 102 |
27 | 103 Usage |
104 ----- | |
105 | |
106 .. highlight:: json | |
107 | |
31
93bbfaf0e62c
worklist instructions migrated to a specific page, indexing of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
30
diff
changeset
|
108 You of course first have to :ref:`install Orthanc <binaries>`, with a |
154 | 109 version above 0.9.5. You then have to **create a database** dedicated |
28 | 110 to Orthanc on some PostgreSQL server. Please refer to the `PostgreSQL |
111 documentation | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
112 <https://www.postgresql.org/docs/current/tutorial-createdb.html>`__. |
27 | 113 |
114 Once Orthanc is installed and the database is created, you must add a | |
115 section in the :ref:`configuration file <configuration>` that | |
116 specifies the address of the **PostgreSQL server together with your | |
117 credentials**. You also have to tell Orthanc in which path it can find | |
118 the plugins: This is done by properly modifying the ``Plugins`` | |
119 option. You could for instance adapt the following configuration | |
120 file:: | |
121 | |
122 { | |
123 "Name" : "MyOrthanc", | |
124 "PostgreSQL" : { | |
125 "EnableIndex" : true, | |
126 "EnableStorage" : true, | |
127 "Host" : "localhost", | |
128 "Port" : 5432, | |
129 "Database" : "orthanc", | |
130 "Username" : "orthanc", | |
181 | 131 "Password" : "orthanc", |
643
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
132 "EnableSsl" : false, // New in release 3.0 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
133 "MaximumConnectionRetries" : 10, // New in release 3.0 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
134 "ConnectionRetryInterval" : 5, // New in release 3.0 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
135 "IndexConnectionsCount" : 1 // New in release 4.0 |
27 | 136 }, |
137 "Plugins" : [ | |
154 | 138 "/home/user/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLIndex.so", |
139 "/home/user/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLStorage.so" | |
27 | 140 ] |
141 } | |
142 | |
154 | 143 **Important:** The ``EnableIndex`` and ``EnableStorage`` options must |
144 be explicitly set to ``true``, otherwise Orthanc will continue to use | |
145 its default SQLite back-end and the filesystem storage area. | |
27 | 146 |
181 | 147 **Remark 1:** When using the ``Storage`` PostgreSQL plugin, the DICOM |
154 | 148 files are stored as large objects in the database. This might |
149 actually consume more space than the DICOM file itself. We have | |
150 observed overhead up to 40%. However, it seems this overhead is | |
151 temporary and comes from Write-Ahead Logging. Check this `discussion | |
152 <https://groups.google.com/d/msg/orthanc-users/pPzHOpb--iw/QkKZ808gIgAJ>`__ | |
153 on the Orthanc Users group for more info). | |
118 | 154 |
181 | 155 **Remark 2:** A typical usage of the PostgreSQL plugin is to enable |
156 only the ``Index``, and to use the default filesystem storage for | |
157 DICOM files (on a NAS with proper disaster recovery strategies). This | |
158 setup provides best performance for large-scale databases. | |
159 | |
160 **Remark 3:** Setting the ``EnableSsl`` to ``true`` forces the use of | |
161 `SSL connections | |
162 <https://www.postgresql.org/docs/current/libpq-ssl.html>`__ between | |
163 Orthanc and the PostgreSQL server. It is a synonym for | |
164 ``sslmode=require`` in connections URI (see below). Setting | |
165 ``EnableSsl`` to ``false`` corresponds to ``sslmode=disable`` | |
166 (i.e. SSL is not used, even if it is both available in Orthanc and | |
167 PostgreSQL). To choose other values for the SSL mode (i.e. ``allow`` | |
168 and ``prefer``), please use connection URIs. | |
118 | 169 |
170 | |
94
b0a71b880ca0
fix link + remark about disk usage overhead
Alain Mazy <alain@mazy.be>
parents:
81
diff
changeset
|
171 |
27 | 172 .. highlight:: text |
173 | |
174 Orthanc must of course be **restarted** after the modification of its | |
175 configuration file. The log will contain an output similar to:: | |
176 | |
177 $ ./Orthanc Configuration.json | |
178 W0212 16:30:34.576972 11285 main.cpp:632] Orthanc version: 0.8.6 | |
179 W0212 16:30:34.577386 11285 OrthancInitialization.cpp:80] Using the configuration from: Configuration.json | |
180 [...] | |
154 | 181 W0212 16:30:34.598053 11285 main.cpp:379] Registering a plugin from: /home/jodogne/Subversion/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLIndex.so |
27 | 182 W0212 16:30:34.598470 11285 PluginsManager.cpp:258] Registering plugin 'postgresql-index' (version 1.0) |
183 W0212 16:30:34.598491 11285 PluginsManager.cpp:148] Using PostgreSQL index | |
154 | 184 W0212 16:30:34.608289 11285 main.cpp:379] Registering a plugin from: /home/jodogne/Subversion/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLStorage.so |
27 | 185 W0212 16:30:34.608916 11285 PluginsManager.cpp:258] Registering plugin 'postgresql-storage' (version 1.0) |
186 W0212 16:30:34.608947 11285 PluginsManager.cpp:148] Using PostgreSQL storage area | |
187 [...] | |
188 W0212 16:30:34.674648 11285 main.cpp:530] Orthanc has started | |
189 | |
190 | |
191 .. highlight:: json | |
192 | |
193 Instead of specifying explicit authentication parameters, you can also | |
194 use the `PostgreSQL connection URIs syntax | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
195 <https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING>`__. For |
27 | 196 instance:: |
197 | |
198 { | |
199 "Name" : "MyOrthanc", | |
200 "PostgreSQL" : { | |
201 "EnableIndex" : true, | |
202 "EnableStorage" : true, | |
181 | 203 "ConnectionUri" : "postgresql://username:password@localhost:5432/database?sslmode=prefer" |
27 | 204 }, |
205 "Plugins" : [ | |
154 | 206 "/home/user/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLIndex.so", |
207 "/home/user/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLStorage.so" | |
27 | 208 ] |
209 } | |
210 | |
211 | |
212 **Remark:** The Debian Med project maintains `another useful set of | |
213 instructions | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
214 <https://salsa.debian.org/med-team/orthanc-postgresql/-/blob/master/debian/README.Debian>`__. |
27 | 215 |
216 | |
217 Advanced options | |
218 ---------------- | |
219 | |
220 Several advanced options are available as well to fine-tune the | |
221 configuration of the PostgreSQL plugins. They are documented below. | |
222 | |
223 | |
643
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
224 .. _postgresql-multiple-writers: |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
225 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
226 Multiple writers or connections |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
227 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
228 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
229 Starting with Orthanc 1.9.2 and PostgreSQL 4.0, it is possible to use |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
230 :ref:`multiple writers or connections in large-scale deployments |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
231 <multiple-writers>`. Here is the list of configuration that control |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
232 this behavior: |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
233 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
234 * ``Lock`` must be set to ``false`` (cf. :ref:`below <postgresql-lock>`) |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
235 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
236 * ``MaximumConnectionRetries`` governs how many times Orthanc tries to |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
237 connect to the database, as well as how many times Orthanc replays |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
238 transactions to deal with collisions between multiple writers. |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
239 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
240 * ``IndexConnectionsCount`` controls the number of connections from |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
241 the index plugin to the PostgreSQL database. It is set to ``1`` by |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
242 default, which corresponds to the old behavior of Orthanc <= 1.9.1. |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
243 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
244 * ``ConnectionRetryInterval`` is only used when opening one database |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
245 connection to PostgreSQL. |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
246 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
247 * The PostgreSQL plugin supports the :ref:`revision mechanism |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
248 <revisions>` to protect metadata and attachments from concurrent |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
249 modifications. |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
250 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
251 |
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
252 |
270
f29d75bc5c25
more info about database locking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
263
diff
changeset
|
253 .. _postgresql-lock: |
f29d75bc5c25
more info about database locking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
263
diff
changeset
|
254 |
27 | 255 Locking |
256 ^^^^^^^ | |
257 | |
258 .. highlight:: json | |
259 | |
260 By default, the plugins lock the database (using `PostgreSQL advisory | |
261 locks | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
262 <https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS>`__) |
27 | 263 to prevent other instances of Orthanc from using the same PostgreSQL |
264 database. If you want several instances of Orthanc to share the same | |
643
411e82bb3a9f
documenting revisions and multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
265 database or if you need multiple connections to the PostgreSQL |
27 | 266 database, set the ``Lock`` option to ``false`` in the configuration |
267 file:: | |
268 | |
269 { | |
270 "Name" : "MyOrthanc", | |
271 "PostgreSQL" : { | |
272 "EnableIndex" : true, | |
273 "EnableStorage" : true, | |
274 "Lock" : false, | |
275 "ConnectionUri" : "postgresql://username:password@localhost:5432/database" | |
276 }, | |
277 "Plugins" : [ | |
154 | 278 "/home/user/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLIndex.so", |
279 "/home/user/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLStorage.so" | |
27 | 280 ] |
281 } | |
282 | |
283 Obviously, one must be very cautious when sharing the same database | |
284 between instances of Orthanc. In particular, all these instances | |
285 should share the same configuration. | |
286 | |
287 | |
288 Keep-alive | |
289 ^^^^^^^^^^ | |
290 | |
291 .. highlight:: text | |
292 | |
293 After some period of inactivity (users have reported 10 hours), you | |
294 might `experience an error | |
991
1316bc62b5d5
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
295 <https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=15>`__ such as:: |
27 | 296 |
297 E0220 03:20:51.562601 PluginsManager.cpp:163] Exception in database back-end: Error in PostgreSQL: server closed the connection unexpectedly. | |
298 This probably means the server terminated abnormally before or while processing the request. | |
299 E0220 06:51:03.924868 PluginsManager.cpp:163] Exception in database back-end: Error in PostgreSQL: no connection to the server | |
300 | |
301 This is due to a timeout in the PostgreSQL server. Please make sure to | |
302 `enable keep-alive | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
303 <https://dba.stackexchange.com/questions/97534/is-there-a-timeout-option-for-remote-access-to-postgresql-database>`__ |
27 | 304 in the configuration of your PostgreSQL server |
438 | 305 |
306 | |
307 Scalability | |
308 ^^^^^^^^^^^ | |
309 | |
310 When configuring your PostgreSQL plugin, ensure you've read the :ref:`scalability section | |
311 <scalability>` | |
531 | 312 |
313 | |
314 Troubleshooting | |
315 --------------- | |
316 | |
317 SCRAM authentication | |
318 ^^^^^^^^^^^^^^^^^^^^ | |
319 | |
560
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
320 .. note:: This section only applies to releases <= 3.2 of the |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
321 PostgreSQL plugins. Starting with release 3.3, the plugins |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
322 use a version of libpq that should support SCRAM |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
323 authentication. |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
324 |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
325 In the releases 3.2 of the PostgreSQL plugins, the precompiled |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
326 binaries use an old, but stable version of the PostgreSQL client |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
327 (libpq 9.6.1). This makes these binaries very portable, however they |
5c0dfc863884
note for postgresql 3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
531
diff
changeset
|
328 might not be compatible with more recent features of PostgreSQL. |
531 | 329 |
330 In particular, the precompiled binaries are not compatible with `SCRAM | |
331 authentication | |
332 <https://en.wikipedia.org/wiki/Salted_Challenge_Response_Authentication_Mechanism>`__ | |
333 that is available since PostgreSQL 10. If you get the error ``psql: | |
334 authentication method 10 not supported``, this indicates that the | |
335 PostgreSQL plugins cannot connect to a PostgreSQL server because SCRAM | |
336 is enabled. | |
337 | |
338 `Ian Smith | |
339 <https://groups.google.com/g/orthanc-users/c/4EH7HpcEnSA/m/a4x6oiucAgAJ>`__ | |
340 has reported the following method to disable SCRAM: | |
341 | |
342 1. Drop/delete the ``orthanc`` database and user in PostgreSQL. | |
343 2. Edit the files ``postgresql.conf`` and ``pg_hba.conf`` and change | |
344 ``scram-sha-256`` to ``md5`` in all cases. | |
345 3. Add the ``orthanc`` user and database in PostgreSQL again. | |
346 4. Restart Orthanc. |