DicomModalitiesInDatabase Problem

I want to run orthanc on k8s and I set DicomModalitiesInDatabase to true .

After I add a modality and restart the pod, the data will disapear. I want to know the reason.

bef6c6e4ce129d2e854b318a2bf6bcd.png

Hi Hao,

You will need to set a static DatabaseServerIdentifier as the modalities are stored in the database using this identifier.
https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json

// Arbitrary identifier of this Orthanc server when storing its[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l844)
  // global properties if a custom index plugin is used. This[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l845)
  // identifier is only useful in the case of multiple[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l846)
  // readers/writers, in order to avoid collisions between multiple[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l847)
  // Orthanc servers. If unset, this identifier is taken as a SHA-1[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l848)
  // hash derived from the MAC addresses of the network interfaces,[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l849)
  // and from the AET and TCP ports used by Orthanc. Manually setting[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l850)
  // this option is needed in Docker/Kubernetes environments. (new in[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l851)
  // Orthanc 1.9.2)[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l852)
  /**[](https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Resources/Configuration.json#l853)
     "DatabaseServerIdentifier" : "Orthanc1",

Hope that helps.

James

bef6c6e4ce129d2e854b318a2bf6bcd.png

Thanks, it works

在2023年1月5日星期四 UTC+8 14:50:25ja...@binary.com.au 写道:

Hi,When I run multiple Orthanc instances on k8s, adding a Modality (RESTapi) will not be found. When I restart all instances, I can query it. The document explained the reason(https://book.orthanc-server.com/faq/scalability.html#concurrent-accesses-to-the-db-in-orthanc-1-9-2),but I am confused why I can query all modalities after restarting all the orthanc servers

在2023年1月5日星期四 UTC+8 16:06:28 写道:

Hello,

If you have multiple instances of Orthanc, you must add the remote the modality to each of those individual instances, as “DicomModalitiesInDatabase” stores the modalities as a global property of one particular instance of Orthanc. This is explicitly explained at the end of the link you provided:

“The /modalities or the /peers are also private to each instance of Orthanc in the cluster, as soon as the respective options DicomModalitiesInDatabase and OrthancPeersInDatabase are set to true. If you need to use such primitives in your application, you have three possibilities: (1) Introduce a distinguished Orthanc server that is responsible to take care of all the jobs (including modalities and peers), (2) create an Orthanc plugin (e.g. using Python) that queries all the Orthanc in the cluster and that aggregates all of their answers, or (3) do the same using a higher-level framework (such as Node.js).”
https://book.orthanc-server.com/faq/scalability.html#concurrent-accesses-to-the-db-in-orthanc-1-9-2

Regards,
Sébastien-