So we hve configured Orthanc with a Postgres backend. To support a large-scale data store, we mapped a network directory as the data directory of Postgres. Then we configured Orthanc to have Postgres as its backend data store, instead of its default SQLite backend, using the Postgres plugin. There is also an option for a MySQL/MariaDB backend, which we found not stable with MySQL in a network directory.
However, since we have the configured Postgres in a network directory, we have to make sure everything is running fine. Unfortunately, when we reboot, often the network directory does not mount on its own. Therefore, despite our configuration to start Postgres and Orthanc at the boot time, they both fail.
Data directory unaccessible → Postgres fails to start. Postgres failed to start → Orthanc fails to start.
We have to configure the below services in Centos, following the same order.
1) Postgresql
$ sudo systemctl start postgresql
$ sudo systemctl enable postgresql
$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-09-17 14:46:41 EDT; 11min ago
Main PID: 2655 (postgres)
CGroup: /system.slice/postgresql.service
├─2655 /usr/bin/postgres -D /opt/pacs/postgres -p 5432
├─2657 postgres: logger process
├─2701 postgres: checkpointer process
├─2702 postgres: writer process
├─2703 postgres: wal writer process
├─2704 postgres: autovacuum launcher process
├─2705 postgres: stats collector process
├─2754 postgres: postgres orthanc ::1(48534) idle
└─2755 postgres: postgres orthanc ::1(48536) idle
Sep 17 14:45:59 HOST.NAME systemd[1]: Starting PostgreSQL database server...
Sep 17 14:45:59 HOST.NAME pg_ctl[2652]: pg_ctl: another server might be running; trying to start server anyway
Sep 17 14:46:41 HOST.NAME systemd[1]: Started PostgreSQL database server.
2) Orthanc
$ sudo systemctl start orthanc
$ sudo systemctl enable orthanc
$ sudo systemctl status orthanc
● orthanc.service - Orthanc DICOM server
Loaded: loaded (/usr/lib/systemd/system/orthanc.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-09-17 14:47:14 EDT; 8min ago
Docs: man:Orthanc(1)
http://www.orthanc-server.com/
Main PID: 2753 (Orthanc)
CGroup: /system.slice/orthanc.service
└─2753 /usr/sbin/Orthanc /etc/orthanc/orthanc.json
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.399045 ServerContext.cpp:167] Reloading the jobs from the last execution of Orthanc
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.399776 JobsEngine.cpp:281] The jobs engine has started with 2 threads
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.400023 ServerContext.cpp:293] Disk compression is disabled
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.400050 ServerIndex.cpp:1437] No limit on the number of stored patients
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.400490 ServerIndex.cpp:1454] No limit on the size of the storage area
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.400995 LuaContext.cpp:103] Lua says: Lua toolbox installed
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.403966 main.cpp:848] DICOM server listening with AET BMIPACS on port: 4242
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.404382 MongooseServer.cpp:1087] HTTP compression is enabled
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.405872 MongooseServer.cpp:1001] HTTP server listening on port: 8042 (HTTPS encryption is disabled, remote access is allowed)
Sep 17 14:47:15 HOST.NAME Orthanc[2753]: W0917 14:47:15.405915 main.cpp:667] Orthanc has started
First connect to the postgres client:
$ psql -U postgres
Password for user postgres:
psql (9.2.24)
Type "help" for help.
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+------------+------------+-----------------------
dcm4chee | dcm4chee | UTF8 | en_US.utf8 | en_US.utf8 |
mytest | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
orthanc | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
testtest | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
(7 rows)
Then go to another database to be able to drop the Orthanc database
orthanc=# \c mytest
You are now connected to database "mytest" as user "postgres".
mytest=# drop database orthanc;
ERROR: database "orthanc" is being accessed by other users
DETAIL: There are 2 other sessions using the database.
To clean the data from Orthanc entirely
The easy way is to drop the Orthanc database.
First connect to the postgres client:
$ psql -U postgres
Password for user postgres:
psql (9.2.24)
Type "help" for help.
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+------------+------------+-----------------------
dcm4chee | dcm4chee | UTF8 | en_US.utf8 | en_US.utf8 |
mytest | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
orthanc | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
testtest | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
(7 rows)
Then go to another database to be able to drop the Orthanc database
orthanc=# \c mytest
You are now connected to database "mytest" as user "postgres".
mytest=# drop database orthanc;
ERROR: database "orthanc" is being accessed by other users
DETAIL: There are 2 other sessions using the database.
Yes, first we need to stop Orthanc!
[root@researchpacs postgres]# systemctl stop orthanc
Now drop the database.
mytest=# drop database orthanc;
DROP DATABASE
mytest=#
Create the database again.
DROP DATABASE
mytest=#
Create the database again.
mytest=# create database orthanc;
CREATE DATABASE
Now you may start Orthanc again!
[root@researchpacs postgres]# systemctl start orthanc
You can also access your data via a browser, using the HTTP Port:
http://HOST.NAME:8042/app/explorer.html
No comments:
Post a Comment
You are welcome to provide your opinions in the comments. Spam comments and comments with random links will be deleted.