"Fossies" - the Fresh Open Source Software Archive

Member "geoserver-2.18.1/user/community/jms-cluster/activemq/activemqBroker.html" (19 Nov 2020, 16815 Bytes) of package /linux/www/geoserver-2.18.1-htmldoc.zip:

The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    2   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
    4 <head>
    5   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    7   <title>HOWTO configure ActiveMQ broker &mdash; GeoServer 2.18.1 User Manual</title>
    8   <link rel="stylesheet" href="../../../_static/blueprint/screen.css" type="text/css" media="screen, projection" />
    9   <link rel="stylesheet" href="../../../_static/blueprint/print.css" type="text/css" media="print" /> 
   10   <!--[if IE]>
   11   <link rel="stylesheet" href="../../../_static/blueprint/ie.css" type="text/css" media="screen, projection" />
   12   <![endif]-->
   13   <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
   14   <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
   15   <script type="text/javascript">
   17         URL_ROOT:    '../../../',
   18         VERSION:     '2.18.1',
   19         COLLAPSE_MODINDEX: false,
   20         FILE_SUFFIX: '.html'
   21     };
   22   </script>
   23   <script type="text/javascript" src="../../../_static/jquery.js"></script>
   24   <script type="text/javascript" src="../../../_static/doctools.js"></script>
   25   <script type="text/javascript" src="../../../_static/searchtools.js"></script>
   26   <script type="text/javascript" src="../../../searchindex.js"></script>
   27   <link rel="shortcut icon" href="../../../_static/geoserver.ico"/>
   28       <link rel="search" title="Search" href="../../../search.html" />
   29       <link rel="top" title="GeoServer 2.18.1 User Manual" href="../../../index.html" />
   30       <link rel="up" title="JMS based Clustering" href="../index.html" />
   31       <link rel="next" title="JDBC Primary/Replica" href="JDBC.html" />
   32       <link rel="prev" title="Installation of the JMS Cluster modules" href="../installation.html" />
   33 </head>
   34 <body class="community/jms-cluster/activemq/activemqBroker">
   35   <div id="header" class="selfclear">
   36     <div class="wrap selfclear">
   37       <div id="logo"><a href="../../../index.html">GeoServer 2.18.1 User Manual</a></div>
   38       <ul id="top-nav">
   39         <li class="first"><a href="http://geoserver.org/about">About</a></li>
   40         <li><a href="http://blog.geoserver.org/">Blog</a></li>
   41         <li><a href="http://geoserver.org/download">Download</a></li>
   42         <!--<li><a href="../../../index.html">Documentation</a></li>-->
   43       </ul>
   44         <form id="quick-search" action="../../../search.html" method="get">
   45           <fieldset>
   46             <input type="hidden" name="check_keywords" value="yes" />
   47             <input type="hidden" name="area" value="default" />
   48             <input id="quick-search-query" type="text" name="q" accessKey="q" name="searchQuery.queryString" size="25" value="Search Documentation&hellip;" size="20" tabindex="3" onblur="if(this.value=='') this.value='Search Documentation&hellip;';" onfocus="if(this.value=='Search Documentation&hellip;') this.value='';" />
   49             <input id="quick-search-submit" type="image" value="Search" src="../../../_static/chrome/search_icon_green.png" />
   50           </fieldset>
   51         </form>
   52     </div><!-- /.wrap -->
   53   </div><!-- /#header -->
   54   <div id="main">
   55     <div class="wrap selfclear">
   56       <div id="content-left" class="content-border"></div>
   57       <div id="content">
   58 <ul id="breadcrumbs">
   60   <li><a href="../../../index.html">GeoServer 2.18.1 User Manual</a> &raquo;</li>
   61   <li><a href="../../index.html" accesskey="U">Community modules</a> &raquo;</li>
   62   <li><a href="../index.html" accesskey="U">JMS based Clustering</a> &raquo;</li>
   63   <li>HOWTO configure ActiveMQ broker</li>
   64 </ul>
   65 <ul id="relatedlinks" class="selfclear">
   66   <li class="first">
   67     <a href="../../../py-modindex.html" title="Python Module Index"
   68        accesskey="">modules</a></li>
   69   <li>
   70     <a href="JDBC.html" title="JDBC Primary/Replica"
   71        accesskey="N">next</a>|</li>
   72   <li>
   73     <a href="../installation.html" title="Installation of the JMS Cluster modules"
   74        accesskey="P">previous</a>|</li>
   75 </ul>
   77   <div class="section" id="howto-configure-activemq-broker">
   78 <h1>HOWTO configure ActiveMQ broker<a class="headerlink" href="#howto-configure-activemq-broker" title="Permalink to this headline"></a></h1>
   79 <p>Deploy the produced activemqBroker.war in your tomcat instance and check the extracted webapp. You may locate a file called activemq-jmx.properties which will help you to configure your instance with the most important paramenters.
   80 Anyhow it is only an example and we encourage you to also check the ApplicationContext.xml file deployed to activemq/WEB-INF/classes/ApplicationContext.xml which is the complete configuration:</p>
   81 <div class="highlight-xml notranslate"><div class="highlight"><pre><span></span>...
   82 <span class="c">&lt;!-- The transport connectors expose ActiveMQ over a given protocol to</span>
   83 <span class="c">      clients and other brokers.</span>
   84 <span class="c">      For more information, see: http://activemq.apache.org/configuring-transports.html --&gt;</span>
   85 <span class="nt">&lt;transportConnectors&gt;</span>
   86         <span class="nt">&lt;transportConnector</span> <span class="na">name=</span><span class="s">&quot;openwire&quot;</span> <span class="na">uri=</span><span class="s">&quot;tcp://192.168.1.XXX:61616&quot;</span> <span class="nt">/&gt;</span>
   87 <span class="nt">&lt;/transportConnectors&gt;</span>
   88 ...
   89 </pre></div>
   90 </div>
   91 <div class="section" id="persistence-configuration">
   92 <h2>Persistence Configuration<a class="headerlink" href="#persistence-configuration" title="Permalink to this headline"></a></h2>
   93 <p>It is possible to enable persistence for messages that cannot be delivered right away (e.g. all consumers are down). Detailed information can be found here, we are simply going to provide basic information on how to achieve that.
   94 To configure the persistence for the messages to deliver you need to setup the &lt;persistenceAdapter&gt; node in the same file as above and then configure a proper datasource in your DBMS of choice.</p>
   95 <div class="highlight-xml notranslate"><div class="highlight"><pre><span></span>...
   96 <span class="nt">&lt;persistenceAdapter&gt;</span>
   97 <span class="c">&lt;!-- &lt;kahaDB directory=&quot;${activemq.base}/data/kahadb&quot;/&gt; --&gt;</span>
   98   <span class="nt">&lt;jdbcPersistenceAdapter</span> <span class="na">dataDirectory=</span><span class="s">&quot;activemq-data&quot;</span>
   99         <span class="na">dataSource=</span><span class="s">&quot;#postgres-ds&quot;</span> <span class="na">lockKeepAlivePeriod=</span><span class="s">&quot;0&quot;</span><span class="nt">/&gt;</span>
  100 <span class="nt">&lt;/persistenceAdapter&gt;</span>
  101 ...
  102 </pre></div>
  103 </div>
  104 <p>In the above section we defined a jdbcPersistenceAdapter connected to a dataSource called #postgres-ds that forces the broker to use PostgreSQL for persisting its messages when the delivery cannot be guaranteed (e.g. a replica goes down unexpectedly).
  105 You now need to configure your own datasource as specified in the following section which are specific for different DBMS.</p>
  106 <div class="section" id="oracle-datasource">
  107 <h3>Oracle datasource<a class="headerlink" href="#oracle-datasource" title="Permalink to this headline"></a></h3>
  108 <p>To configure the broker to use an oracle database as datasource you need to uncomment and modify the following peace into the ApplicationContext.xml file:</p>
  109 <div class="highlight-xml notranslate"><div class="highlight"><pre><span></span>...
  110 <span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;oracle-ds&quot;</span> <span class="na">class=</span><span class="s">&quot;org.apache.commons.dbcp.BasicDataSource&quot;</span> <span class="na">destroy-method=</span><span class="s">&quot;close&quot;</span><span class="nt">&gt;</span>
  111   <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;driverClassName&quot;</span> <span class="na">value=</span><span class="s">&quot;oracle.jdbc.driver.OracleDriver&quot;</span><span class="nt">/&gt;</span>
  112   <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;url&quot;</span> <span class="na">value=</span><span class="s">&quot;jdbc:oracle:thin:@localhost:1521:AMQDB&quot;</span><span class="nt">/&gt;</span>
  113   <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;username&quot;</span> <span class="na">value=</span><span class="s">&quot;oracle&quot;</span><span class="nt">/&gt;</span>
  114   <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;password&quot;</span> <span class="na">value=</span><span class="s">&quot; oracle &quot;</span><span class="nt">/&gt;</span>
  115   <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;poolPreparedStatements&quot;</span> <span class="na">value=</span><span class="s">&quot;true&quot;</span><span class="nt">/&gt;</span>
  116 <span class="nt">&lt;/bean&gt;</span>
  117 ...
  118 </pre></div>
  119 </div>
  120 <p>In addition, you need to make sure that the jar containing the driver for Oracle is correctly deployed inside the WEB-INF/lib for the activemq war file. At the same time the database referred in provided instructions as well as the user must be already present.</p>
  121 </div>
  122 <div class="section" id="postgres-datasource">
  123 <h3>Postgres datasource<a class="headerlink" href="#postgres-datasource" title="Permalink to this headline"></a></h3>
  124 <p>Configuring PostgreSQL as the datasource to use for the persistence of the messages for the ActiveMQ broker follows the same pattern as above. See below for some examples.</p>
  125 <div class="highlight-xml notranslate"><div class="highlight"><pre><span></span>...
  126 <span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;postgres-ds&quot;</span> <span class="na">class=</span><span class="s">&quot;org.postgresql.ds.PGPoolingDataSource&quot;</span><span class="nt">&gt;</span>
  127         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;serverName&quot;</span> <span class="na">value=</span><span class="s">&quot;192.168.1.XXX&quot;</span><span class="nt">/&gt;</span>
  128         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;databaseName&quot;</span> <span class="na">value=</span><span class="s">&quot;activemq&quot;</span><span class="nt">/&gt;</span>
  129         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;portNumber&quot;</span> <span class="na">value=</span><span class="s">&quot;5432&quot;</span><span class="nt">/&gt;</span>
  130         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;user&quot;</span> <span class="na">value=</span><span class="s">&quot;postgres&quot;</span><span class="nt">/&gt;</span>
  131         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;password&quot;</span> <span class="na">value=</span><span class="s">&quot;postgres&quot;</span><span class="nt">/&gt;</span>
  132         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;dataSourceName&quot;</span> <span class="na">value=</span><span class="s">&quot;postgres&quot;</span><span class="nt">/&gt;</span>
  133         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;initialConnections&quot;</span> <span class="na">value=</span><span class="s">&quot;15&quot;</span><span class="nt">/&gt;</span>
  134         <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;maxConnections&quot;</span> <span class="na">value=</span><span class="s">&quot;30&quot;</span><span class="nt">/&gt;</span>
  135 <span class="nt">&lt;/bean&gt;</span>
  136 ...
  137 </pre></div>
  138 </div>
  139 <div class="admonition note">
  140 <p class="admonition-title">Note</p>
  141 <p>The above ApplicationContext.xml file contains some unused sections which are intentionally commented out to show different types of configurations [Ref. ActiveMQ].</p>
  142 </div>
  143 </div>
  144 <div class="section" id="kaha-datasource-embedded-database">
  145 <h3>Kaha datasource (Embedded database)<a class="headerlink" href="#kaha-datasource-embedded-database" title="Permalink to this headline"></a></h3>
  146 <p>Besides using server DBMS as indicated above we can use embedded database for simpler uses cases of demoing since this usually largely simplify the configuration. At this link all the information needed for achieving this result can be found; basically we need to uncomment the related datasource and then reference it from the persistenceAdapter.</p>
  147 </div>
  148 </div>
  149 <div class="section" id="control-instances-using-jmx">
  150 <h2>Control instances using JMX<a class="headerlink" href="#control-instances-using-jmx" title="Permalink to this headline"></a></h2>
  151 <p>Be sure to edit the activemq-jmx.properties (or via the environment variables) setting different JMX ports for different broker instances.
  152 Deploy as explained the instances into 2 different webapplication container (f.e. Tomcat) and start both application (on different port f.e. 8081 and 8082).
  153 Now run jconsole to connect to the brokers via JMX:</p>
  154 <p>${JAVA_HOME}/bin/jconsole</p>
  155 <p>After you connect to the brokers you may see something like this:</p>
  156 <div class="figure align-center">
  157 <img alt="../../../_images/master_slave_jmx_1.png" src="../../../_images/master_slave_jmx_1.png" />
  158 </div>
  159 <p>You may look at the console, as you can see the 2nd instance of the broker cannot take the look on the file (the example uses KahaDB); this is also visible in the JMX console into the widhow on the right side.</p>
  160 <p>If now you select the ‘operation’ (on the left side window) you will see:</p>
  161 <div class="figure align-center">
  162 <img alt="../../../_images/master_slave_jmx_2.png" src="../../../_images/master_slave_jmx_2.png" />
  163 </div>
  164 <p>Using that console we are able to perform many operation, so to simulate a broker down we try to click on the ‘stop()’ button.</p>
  165 <p>Doing so, the first broker instance will stop and the JMX connection will be closed, and the second instance (on the right side) will keep the control of the DB.</p>
  166 <div class="figure align-center">
  167 <img alt="../../../_images/master_slave_jmx_3.png" src="../../../_images/master_slave_jmx_3.png" />
  168 </div>
  169 <div class="figure align-center">
  170 <img alt="../../../_images/master_slave_jmx_4.png" src="../../../_images/master_slave_jmx_4.png" />
  171 </div>
  172 </div>
  173 </div>
  176       <div class="selfclear pagination-nav">
  177           <div class="leftwise"><strong>Previous</strong>: <a href="../installation.html" title="previous chapter">Installation of the JMS Cluster modules</a></div>
  178           <div class="rightwise"><strong>Next</strong>: <a href="JDBC.html" title="next chapter">JDBC Primary/Replica</a></div>
  179       </div>
  180       </div><!-- /#content> -->
  181       <div id="content-right" class="content-border"></div>
  182   <div id="sidebar" class="contrast">
  183       <div id="toc" class="section">
  184         <h3 class="pngfix">Table Of Contents</h3>
  185         <ul>
  186 <li><a class="reference internal" href="#">HOWTO configure ActiveMQ broker</a><ul>
  187 <li><a class="reference internal" href="#persistence-configuration">Persistence Configuration</a><ul>
  188 <li><a class="reference internal" href="#oracle-datasource">Oracle datasource</a></li>
  189 <li><a class="reference internal" href="#postgres-datasource">Postgres datasource</a></li>
  190 <li><a class="reference internal" href="#kaha-datasource-embedded-database">Kaha datasource (Embedded database)</a></li>
  191 </ul>
  192 </li>
  193 <li><a class="reference internal" href="#control-instances-using-jmx">Control instances using JMX</a></li>
  194 </ul>
  195 </li>
  196 </ul>
  198         <div class="section-footer"></div>
  199       </div>
  200         <div class="section">
  201           <h3>Continue Reading</h3>
  202           <ul>
  203             <li>Previous: <a href="../installation.html" title="previous chapter">Installation of the JMS Cluster modules</a></li>
  204             <li>Next: <a href="JDBC.html" title="next chapter">JDBC Primary/Replica</a></li>
  205           </ul>
  206         </div>
  207         <div class="section">
  208         <h3>This Page</h3>
  209         <ul class="this-page-menu">
  211         <li><a href="https://github.com/geoserver/geoserver/tree/master/doc/en/user/source/community/jms-cluster/activemq/activemqBroker.rst">Edit</a></li>
  212         </ul>
  213         </div>
  214   </div><!-- /#sidebar -->
  215   </div><!-- /.wrap> -->
  216 </div><!-- /#main -->
  217 <div id="footer">
  218   <div class="wrap">
  219     &copy; Copyright 2020, Open Source Geospatial Foundation. License <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution</a>.
  220     Last updated on Nov 19, 2020.
  221     Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
  222   </div><!-- /.wrap> -->
  223 </div><!-- /#footer -->
  224   </body>
  225 </html>