Deploying multiple archive instances

Current dcm4chee version (v2.10.15) does not support to store received objects into separate storage locations conditioned by any criteria. As workaround multiple instances of the File System Management Service may be deployed, each attached to its own bundle of DICOM services: in particular to an additional DICOM Server, Query Retrieve SCP, Storage Commit Service and Storage SCP service.

Step by Step instruction

  1. Move configuration of JMX object names, JMS queue names and Scheduler Timer IDs from XMBean descriptors (conf/xmdesc/*-xmbean.xml) to JMX service descriptors (deploy/*-service.xml) - partly already done in dcm4chee-2.10.5: DCMEE-378, DCMEE-384, DCMEE-389.
  2. Create copies of JMX service descriptors and modify JMX object names, JMS queue names and Scheduler Timer IDs appropriate. E.g.:
    $ diff -c dcm4chee-fsmgt-service.xml  dcm4chee-fsmgt2-service.xml
    *** dcm4chee-fsmgt-service.xml  2007-05-12 18:55:36.000000000 +0200
    --- dcm4chee-fsmgt2-service.xml 2007-05-13 18:11:00.996310418 +0200
    ***************
    *** 3,15 ****
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.jboss.mq.server.jmx.Queue"
    !     name="dcm4chee.archive:service=Queue,name=PurgeStudy">
          <attribute name="ReceiversImpl">org.jboss.mq.server.ReceiversImplLinkedList</attribute>
          <depends optional-attribute-name="DestinationManager"
            >jboss.mq:service=DestinationManager</depends>
        </mbean>
        <mbean code="org.dcm4chex.archive.mbean.FileSystemMgtService"
    !     name="dcm4chee.archive:service=FileSystemMgt"
          xmbean-dd="xmdesc/dcm4chee-fsmgt-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
    --- 3,15 ----
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.jboss.mq.server.jmx.Queue"
    !     name="dcm4chee.archive:service=Queue,name=PurgeStudy2">
          <attribute name="ReceiversImpl">org.jboss.mq.server.ReceiversImplLinkedList</attribute>
          <depends optional-attribute-name="DestinationManager"
            >jboss.mq:service=DestinationManager</depends>
        </mbean>
        <mbean code="org.dcm4chex.archive.mbean.FileSystemMgtService"
    !     name="dcm4chee.archive:service=FileSystemMgt2"
          xmbean-dd="xmdesc/dcm4chee-fsmgt-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
    ***************
    *** 17,30 ****
            >dcm4chee.archive:service=Scheduler</depends>
          <depends optional-attribute-name="JMSServiceName"
            >dcm4chee.archive:service=JMS</depends>
    !     <depends>dcm4chee.archive:service=Queue,name=PurgeStudy</depends>
    !     <attribute name="PurgeStudyQueueName">PurgeStudy</attribute>
          <!-- To avoid NameNotBoundExceptions during server startup. MUST be
            removed, if the service is NOT deployed in the same jboss instance
            as the FileSystemMgt EJB!
            -->
          <depends>jboss.j2ee:jndiName=ejb/FileSystemMgt,service=EJB</depends>
    !     <attribute name="TimerIDCheckFilesToPurge">CheckFilesToPurge</attribute>
    !     <attribute name="TimerIDCheckFreeDiskSpace">CheckFreeDiskSpace</attribute>
        </mbean>
      </server>
    --- 17,30 ----
            >dcm4chee.archive:service=Scheduler</depends>
          <depends optional-attribute-name="JMSServiceName"
            >dcm4chee.archive:service=JMS</depends>
    !     <depends>dcm4chee.archive:service=Queue,name=PurgeStudy2</depends>
    !     <attribute name="PurgeStudyQueueName">PurgeStudy2</attribute>
          <!-- To avoid NameNotBoundExceptions during server startup. MUST be
            removed, if the service is NOT deployed in the same jboss instance
            as the FileSystemMgt EJB!
            -->
          <depends>jboss.j2ee:jndiName=ejb/FileSystemMgt,service=EJB</depends>
    !     <attribute name="TimerIDCheckFilesToPurge">CheckFilesToPurge2</attribute>
    !     <attribute name="TimerIDCheckFreeDiskSpace">CheckFreeDiskSpace2</attribute>
        </mbean>
      </server>
    
    $ diff -c dcm4chee-dcmsrv-service.xml dcm4chee-dcmsrv2-service.xml
    *** dcm4chee-dcmsrv-service.xml 2007-05-07 01:42:06.000000000 +0200
    --- dcm4chee-dcmsrv2-service.xml        2007-05-13 18:12:02.280477621 +0200
    ***************
    *** 3,13 ****
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.dcm4chex.archive.dcm.DcmServerService"
    !          name="dcm4chee.archive:service=DcmServer"
               xmbean-dd="xmdesc/dcm4chee-dcmsrv-xmbean.xml">
          <depends>jboss.j2ee:service=EJB,jndiName=ejb/Storage</depends>
          <depends>jboss.j2ee:service=EJB,jndiName=ejb/FileSystemMgt</depends>
    --- 3,13 ----
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.dcm4chex.archive.dcm.DcmServerService"
    !          name="dcm4chee.archive:service=DcmServer2"
               xmbean-dd="xmdesc/dcm4chee-dcmsrv-xmbean.xml">
          <depends>jboss.j2ee:service=EJB,jndiName=ejb/Storage</depends>
          <depends>jboss.j2ee:service=EJB,jndiName=ejb/FileSystemMgt</depends>
    
    $ diff -c dcm4chee-storescp-service.xml dcm4chee-storescp2-service.xml
    *** dcm4chee-storescp-service.xml       2007-05-12 19:02:16.000000000 +0200
    --- dcm4chee-storescp2-service.xml      2007-05-13 18:14:10.557134802 +0200
    ***************
    *** 3,18 ****
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.dcm4chex.archive.dcm.storescp.StoreScpService"
    !     name="dcm4chee.archive:service=StoreScp"
          xmbean-dd="xmdesc/dcm4chee-storescp-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
          <depends optional-attribute-name="AuditLoggerName"
            >dcm4chee.archive:service=AuditLogger</depends>
          <depends optional-attribute-name="DcmServerName"
    !       >dcm4chee.archive:service=DcmServer</depends>
          <depends optional-attribute-name="FileSystemMgtName"
    !       >dcm4chee.archive:service=FileSystemMgt</depends>
          <depends optional-attribute-name="MwlScuServiceName"
            >dcm4chee.archive:service=MWLScu</depends>
          <depends optional-attribute-name="SchedulerServiceName"
    --- 3,18 ----
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.dcm4chex.archive.dcm.storescp.StoreScpService"
    !     name="dcm4chee.archive:service=StoreScp2"
          xmbean-dd="xmdesc/dcm4chee-storescp-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
          <depends optional-attribute-name="AuditLoggerName"
            >dcm4chee.archive:service=AuditLogger</depends>
          <depends optional-attribute-name="DcmServerName"
    !       >dcm4chee.archive:service=DcmServer2</depends>
          <depends optional-attribute-name="FileSystemMgtName"
    !       >dcm4chee.archive:service=FileSystemMgt2</depends>
          <depends optional-attribute-name="MwlScuServiceName"
            >dcm4chee.archive:service=MWLScu</depends>
          <depends optional-attribute-name="SchedulerServiceName"
    ***************
    *** 20,25 ****
          <depends optional-attribute-name="TemplatesServiceName"
            >dcm4chee.archive:service=Templates</depends>
          <attribute name="TimerIDCheckPendingSeriesStored"
    !       >CheckPendingSeriesStored</attribute>
        </mbean>
      </server>
    --- 20,25 ----
          <depends optional-attribute-name="TemplatesServiceName"
            >dcm4chee.archive:service=Templates</depends>
          <attribute name="TimerIDCheckPendingSeriesStored"
    !       >CheckPendingSeriesStored2</attribute>
        </mbean>
      </server>
    
    $ diff -c dcm4chee-stgcmt-service.xml dcm4chee-stgcmt2-service.xml
    *** dcm4chee-stgcmt-service.xml 2007-05-13 18:20:40.619560014 +0200
    --- dcm4chee-stgcmt2-service.xml        2007-05-13 18:26:58.430173910 +0200
    ***************
    *** 3,26 ****
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.jboss.mq.server.jmx.Queue"
    !     name="dcm4chee.archive:service=Queue,name=StgCmtScuScp">
          <depends optional-attribute-name="DestinationManager"
            >jboss.mq:service=DestinationManager</depends>
        </mbean>
        <mbean code="org.dcm4chex.archive.dcm.stgcmt.StgCmtScuScpService"
    !     name="dcm4chee.archive:service=StgCmtScuScp"
          xmbean-dd="xmdesc/dcm4chee-stgcmt-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
          <depends optional-attribute-name="DcmServerName"
    !       >dcm4chee.archive:service=DcmServer</depends>
          <depends optional-attribute-name="FileSystemMgtName"
    !       >dcm4chee.archive:service=FileSystemMgt</depends>
          <depends optional-attribute-name="TLSConfigName"
            >dcm4chee.archive:service=TLSConfig</depends>
          <depends optional-attribute-name="JMSServiceName"
            >dcm4chee.archive:service=JMS</depends>
    !     <depends>dcm4chee.archive:service=Queue,name=StgCmtScuScp</depends>
    !     <attribute name="QueueName">StgCmtScuScp</attribute>
        </mbean>
      </server>
    --- 3,26 ----
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.jboss.mq.server.jmx.Queue"
    !     name="dcm4chee.archive:service=Queue,name=StgCmtScuScp2">
          <depends optional-attribute-name="DestinationManager"
            >jboss.mq:service=DestinationManager</depends>
        </mbean>
        <mbean code="org.dcm4chex.archive.dcm.stgcmt.StgCmtScuScpService"
    !     name="dcm4chee.archive:service=StgCmtScuScp2"
          xmbean-dd="xmdesc/dcm4chee-stgcmt-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
          <depends optional-attribute-name="DcmServerName"
    !       >dcm4chee.archive:service=DcmServer2</depends>
          <depends optional-attribute-name="FileSystemMgtName"
    !       >dcm4chee.archive:service=FileSystemMgt2</depends>
          <depends optional-attribute-name="TLSConfigName"
            >dcm4chee.archive:service=TLSConfig</depends>
          <depends optional-attribute-name="JMSServiceName"
            >dcm4chee.archive:service=JMS</depends>
    !     <depends>dcm4chee.archive:service=Queue,name=StgCmtScuScp2</depends>
    !     <attribute name="QueueName">StgCmtScuScp2</attribute>
        </mbean>
      </server>
    
    $ diff -c dcm4chee-qrscp-service.xml dcm4chee-qrscp2-service.xml
    *** dcm4chee-qrscp-service.xml  2007-05-12 17:05:42.000000000 +0200
    --- dcm4chee-qrscp2-service.xml 2007-05-13 18:28:37.123716146 +0200
    ***************
    *** 3,9 ****
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.dcm4chex.archive.dcm.qrscp.QueryRetrieveScpService"
    !     name="dcm4chee.archive:service=QueryRetrieveScp"
          xmbean-dd="xmdesc/dcm4chee-qrscp-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
    --- 3,9 ----
      <server>
        <classpath codebase="lib" archives="dcm4chee.jar"/>
        <mbean code="org.dcm4chex.archive.dcm.qrscp.QueryRetrieveScpService"
    !     name="dcm4chee.archive:service=QueryRetrieveScp2"
          xmbean-dd="xmdesc/dcm4chee-qrscp-xmbean.xml">
          <depends optional-attribute-name="AEServiceName"
            >dcm4chee.archive:service=AE</depends>
    ***************
    *** 12,22 ****
          <depends optional-attribute-name="TLSConfigName"
            >dcm4chee.archive:service=TLSConfig</depends>
          <depends optional-attribute-name="DcmServerName"
    !       >dcm4chee.archive:service=DcmServer</depends>
          <depends optional-attribute-name="FileSystemMgtName"
    !       >dcm4chee.archive:service=FileSystemMgt</depends>
          <depends optional-attribute-name="StgCmtScuScpName"
    !       >dcm4chee.archive:service=StgCmtScuScp</depends>
          <depends optional-attribute-name="TarRetrieverName"
            >dcm4chee.archive:service=TarRetriever</depends>
          <depends optional-attribute-name="TemplatesServiceName"
    --- 12,22 ----
          <depends optional-attribute-name="TLSConfigName"
            >dcm4chee.archive:service=TLSConfig</depends>
          <depends optional-attribute-name="DcmServerName"
    !       >dcm4chee.archive:service=DcmServer2</depends>
          <depends optional-attribute-name="FileSystemMgtName"
    !       >dcm4chee.archive:service=FileSystemMgt2</depends>
          <depends optional-attribute-name="StgCmtScuScpName"
    !       >dcm4chee.archive:service=StgCmtScuScp2</depends>
          <depends optional-attribute-name="TarRetrieverName"
            >dcm4chee.archive:service=TarRetriever</depends>
          <depends optional-attribute-name="TemplatesServiceName"
    
  3. Start the application. You will get an
    2007-05-13 18:30:21,717 WARN  -> (main) [org.jboss.system.ServiceController] Problem starting service dcm4chee.archive:service=DcmServer2
    java.net.BindException: Address already in use
            at java.net.PlainSocketImpl.socketBind(Native Method)
            at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
            at java.net.ServerSocket.bind(ServerSocket.java:319)
            at java.net.ServerSocket.<init>(ServerSocket.java:185)
            at java.net.ServerSocket.<init>(ServerSocket.java:97)
            at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:156)
            at org.dcm4cheri.server.ServerImpl.start(ServerImpl.java:215)
            at org.dcm4chex.archive.dcm.DcmServerService.startService(DcmServerService.java:223)
    
    exception, because both DICOM servers are configured to listen on the same port. Change the port of one of the deployed DICOM Server to a different number using the JMX console and restart the application.
  4. Change the RetrieveAETitle of the second File System Management Service and also the CalledAETitle of the new deployed DICOM services to a different value (e.g. DCM4CHEE2), using the JMX Console. Also add an Application Entity configuration entry for the new value, using the AE Management Page of the Web interface.
  5. Change the DefaultStorageDirectory of the second File System Management Service to the directory path, where objects received by the Storage SCP attached to the second DICOM server shall be stored.
  6. After receiving objects by both servers, two File System records should have be initalized. E.g.:
    $ bin/twiddle.sh -u admin -p admin invoke dcm4chee.archive:service=FileSystemMgt showAllFileSystems
    FileSystem[pk=0, archive2, aet=DCM4CHEE2, ONLINE, RW+, userinfo=null]
    FileSystem[pk=1, archive, aet=DCM4CHEE, ONLINE, RW+, userinfo=null]