Wildfly Practice 1--Distributed service configuration (service side corner)

Source: Internet
Author: User
Tags jboss wildfly

Practice background: Develop distributed services based on Wildfly, including Web services, DBA (data access) services, and other business services, all in a distributed way for development and deployment.

Practice 1: Distributed Services (server-side role) configuration

  1. This practice uses two machine deployment services, one deployment Web service (client role), one for other services such as DBA (server side role), TCP service, etc.
  2. Both machines use Wildfly9 as a service container.
  3. Web server: 192.168.50.253 (Eclipse development environment on this machine), DBA server 192.168.50.123
  4. Run Add-user.sh/add-user.bat on the 50.123 machine, and the role is Application-realm, here the user is Ejbuser, the password is 123, the purpose of setting this account is when the remote client ( The wildefly that the web is in) needs to provide the connection's account and password when accessing the service, and without the use of distributed services, all services will not be added to a single machine.
  5. Configuration database, this example installs the MySQL service on 50.123 machines, and adds a test database and a data table to the database, the database used in this example:
  6. Configure the Standalone.xml of the 50.123 machine to increase the MySQL database driver and data source:
      1. Under the <datasources> node in <subsystem xmlns= "urn:jboss:domain:datasources:3.0" >, add the following configuration:
        <DataSourceJTA= "true"Jndi-name= "Java:/xbomdtds"Pool-name= "Xbomdtds"enabled= "true"USE-CCM= "true">                    <Connection-url>Jdbc:mysql://192.168.50.123:3306/xbomdt</Connection-url>                    <Driver-class>Com.mysql.jdbc.Driver</Driver-class>                    <Driver>Mysql</Driver>                    <Pool>                        <min-pool-size>5</min-pool-size>                        <initial-pool-size>5</initial-pool-size>                        <max-pool-size>10</max-pool-size>                    </Pool>                    <Security>                        <User-name>Mysql</User-name>                        <Password>Mysql</Password>                    </Security>                    <Validation>                        <Valid-connection-checkerClass-name= "Org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>                        <background-validation>True</background-validation>                        <Exception-sorterClass-name= "Org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>                    </Validation>                </DataSource>

      2. Add the following configuration under the <drivers> node in <subsystem xmlns= "urn:jboss:domain:datasources:3.0" >:
         <  driver  name  Span style= "COLOR: #0000ff" >= "MySQL"   module  = "Jdbc.mysql"                         >  <  xa-datasource-class  >  Com.mysql.jdbc.jdbc2.optional.MysqlXADatasource </ xa-datasource-class                     >  </ driver  >  

         

      3. See if the wildfly on machine 50.123 has a MySQL JDBC module, and the directory address is: Wildfly9\modules\system\layers\base\jdbc\mysql\main
        1. If you have this directory and you have Module.xml and Mysql-connector*.jar in the directory, pass this step.
        2. If there are no related directories and files, create this directory and add Module.xml to this directory with the following content:
          <?XML version= "1.0" encoding= "UTF-8"?><Modulexmlns= "urn:jboss:module:1.3"name= "Jdbc.mysql">    <Resources>        <Resource-rootPath= "Mysql-connector-java-5.1.38.jar"/>    </Resources>    <Dependencies>        <Modulename= "Javax.api"/>        <Modulename= "Javax.transaction.api"/>            </Dependencies></Module>

        3. Note that resource-root path in the above configuration is the Mysql-connector*.jar file name in the main directory, and here I am
          Mysql-connector-java-5.1.38.jar.
  7. Modify the <interfaces> node, configured as follows:
    <interfaces>        <interface name= "Management" >            <inet-address value= "${ jboss.bind.address.management:0.0.0.0} "/>        </interface>        <interface name=" public ">            <inet-address value= "${jboss.bind.address:0.0.0.0}"/>        </interface>        <interface name= " Unsecure ">            <inet-address value=" ${jboss.bind.address.unsecure:0.0.0.0} "/>        </interface>    </interfaces>

    Note: This configuration is intended to use IP addresses to access the service, which can only be accessed using localhost or 127.0.0.1 before configuration.

  8. Run the standalone.bat/standalone.sh in the wildfly/bin/directory to see if there is an error output, there is no exception in this example, and the last four rows output as:
    2016-12-13 14:43:06,894 INFO [Org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) wflyds0013:started FileS Ystemdeploymentservice fordirectory/home/pacs/wildfly/standalone/deployments2016-12-13 14:43:07,133 INFO [org.jboss.as] (ControllerBootThread) Wflysrv0060:http Management interface Listening onhttp://0.0.0.0:9990/Management2016-12-13 14:43:07,134 INFO [org.jboss.as] (ControllerBootThread) Wflysrv0051:admin Console Listening onHttp://0.0.0.0:9990 2016 -12-13 14:43:07,134 INFO [org.jboss.as] (ControllerBootThread) Wflysrv0025:wildfly full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 4207ms-started 209 of 385 Services ( The services are lazy, passive or on-demand)

  9. At this point, the server configuration on the 50.123 machine is complete.

Wildfly Practice 1--Distributed service configuration (service side corner)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.