2015-11-10 62 views
1

我設法運行Wildfly在域模式下的Ubuntu,但我在Windows有麻煩。這裏是我的設置和步驟:蜻蜓 - 如何在Windows上安裝域模式

  1. 我有兩個Windows服務器(比如,S1S2)上Wildfly將運行作爲Windows service
  2. 我有domain.xmlhost-master.xmlhost-slave.xml文件。在Linux上,我更新了/etc/default/wildfly文件,告訴S1服務器它將是master,而S2將是slave。主站和從站配置位於host-master.xmlhost-slave.xml文件中。所以基本上,我告訴S1使用主機主機和S2主機 - 從機。如果我添加S3服務器,我告訴它使用適當配置的主機 - 從機。
  3. 在Linux上,告訴Wildfly要使用哪個xml文件後,我將它們安裝爲Linux服務。這是我想在Windows上做
  4. 我cd到wildfly\bin\service目錄
  5. 這是我用於主代碼:service install /controller S1:9990 /host master /user user /password pass
  6. 這是奴隸:service install /controller S1:9990 /host slave /user user /password pass

但你可以猜測,雖然我可以登錄到管理控制檯,但我看不到奴隸。只有主人在場。此外,當我嘗試在S2上登錄到管理控制檯時,仍然可以看到具有主配置的控制檯。

我很想念某件事,但我不知道它是什麼。你能幫忙嗎?

我的主機master.xml文件:

<?xml version='1.0' encoding='UTF-8'?> 

<host name="S1" xmlns="urn:jboss:domain:3.0"> 

    <extensions> 
     <extension module="org.jboss.as.jmx"/> 
    </extensions> 
    <management> 
     <security-realms> 
      <security-realm name="ManagementRealm"> 
       <authentication> 
        <local default-user="$local" skip-group-loading="true"/> 
        <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/> 
       </authentication> 
       <authorization map-groups-to-roles="false"> 
        <properties path="mgmt-groups.properties" relative-to="jboss.domain.config.dir"/> 
       </authorization> 
      </security-realm> 
      <security-realm name="ApplicationRealm"> 
       <authentication> 
        <local default-user="$local" allowed-users="*" skip-group-loading="true"/> 
        <properties path="application-users.properties" relative-to="jboss.domain.config.dir"/> 
       </authentication> 
       <authorization> 
        <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/> 
       </authorization> 
      </security-realm> 
     </security-realms> 
     <audit-log> 
      <formatters> 
       <json-formatter name="json-formatter"/> 
      </formatters> 
      <handlers> 
       <file-handler name="host-file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.domain.data.dir"/> 
       <file-handler name="server-file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/> 
      </handlers> 
      <logger log-boot="true" log-read-only="false" enabled="false"> 
       <handlers> 
        <handler name="host-file"/> 
       </handlers> 
      </logger> 
      <server-logger log-boot="true" log-read-only="false" enabled="false"> 
       <handlers> 
        <handler name="server-file"/> 
       </handlers> 
      </server-logger> 
     </audit-log> 
     <management-interfaces> 
      <native-interface security-realm="ManagementRealm"> 
       <socket interface="management" port="${jboss.management.native.port:9999}"/> 
      </native-interface> 
      <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true"> 
       <socket interface="management" port="${jboss.management.http.port:9990}"/> 
      </http-interface> 
     </management-interfaces> 
    </management> 

    <domain-controller> 
     <local/> 
    </domain-controller> 

    <interfaces> 
     <interface name="management"> 
      <any-address/> 
     </interface> 
    </interfaces> 

    <jvms> 
     <jvm name="default"> 
      <heap size="64m" max-size="256m"/> 
      <permgen size="256m" max-size="256m"/> 
      <jvm-options> 
       <option value="-server"/> 
      </jvm-options> 
     </jvm> 
    </jvms> 

    <servers> 
     <server name="solr-server" group="solr_server" auto-start="false"> 
      <socket-bindings socket-binding-group="full-sockets" port-offset="983"/> 
     </server> 
     <server name="80-8200" group="edys-web-servers" auto-start="false"> 
      <socket-bindings socket-binding-group="full-sockets" port-offset="199"/> 
     </server> 
</servers> 
    <profile> 
     <subsystem xmlns="urn:jboss:domain:jmx:1.3"> 
      <expose-resolved-model/> 
      <expose-expression-model/> 
      <remoting-connector/> 
     </subsystem> 
    </profile> 
</host> 

我的主機slave.xml文件:

<?xml version='1.0' encoding='UTF-8'?> 

<host name="S2" xmlns="urn:jboss:domain:3.0"> 

    <extensions> 
     <extension module="org.jboss.as.jmx"/> 
    </extensions> 
    <management> 
     <security-realms> 
      <security-realm name="ManagementRealm"> 
       <server-identities> 
        <secret value="UGFzc3cwcmQ="/> 
       </server-identities> 
       <authentication> 
        <local default-user="$local" skip-group-loading="true"/> 
        <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/> 
       </authentication> 
       <authorization map-groups-to-roles="false"> 
        <properties path="mgmt-groups.properties" relative-to="jboss.domain.config.dir"/> 
       </authorization> 
      </security-realm> 
      <security-realm name="ApplicationRealm"> 
       <authentication> 
        <local default-user="$local" allowed-users="*" skip-group-loading="true"/> 
        <properties path="application-users.properties" relative-to="jboss.domain.config.dir"/> 
       </authentication> 
       <authorization> 
        <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/> 
       </authorization> 
      </security-realm> 
     </security-realms> 
     <audit-log> 
      <formatters> 
       <json-formatter name="json-formatter"/> 
      </formatters> 
      <handlers> 
       <file-handler name="host-file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.domain.data.dir"/> 
       <file-handler name="server-file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/> 
      </handlers> 
      <logger log-boot="true" log-read-only="false" enabled="false"> 
       <handlers> 
        <handler name="host-file"/> 
       </handlers> 
      </logger> 
      <server-logger log-boot="true" log-read-only="false" enabled="false"> 
       <handlers> 
        <handler name="server-file"/> 
       </handlers> 
      </server-logger> 
     </audit-log> 
     <management-interfaces> 
      <native-interface security-realm="ManagementRealm"> 
       <socket interface="management" port="${jboss.management.native.port:9999}"/> 
      </native-interface> 
     </management-interfaces> 
    </management> 

    <domain-controller> 
     <remote security-realm="ManagementRealm" username="ebys"> 
      <discovery-options> 
       <static-discovery name="primary" protocol="${jboss.domain.master.protocol:remote}" host="${jboss.domain.master.address:S1}" 
       port="${jboss.domain.master.port:9999}"/> 
      </discovery-options> 
     </remote> 
    </domain-controller> 

    <interfaces> 
     <interface name="management"> 
      <inet-address value="${jboss.bind.address.management:S2}"/> 
     </interface> 
     <interface name="public"> 
      <inet-address value="${jboss.bind.address:S2}"/> 
     </interface> 
     <interface name="unsecure"> 
      <inet-address value="${jboss.bind.address.unsecure:S2}"/> 
     </interface> 
    </interfaces> 

    <jvms> 
     <jvm name="default"> 
      <heap size="64m" max-size="256m"/> 
      <permgen size="256m" max-size="256m"/> 
      <jvm-options> 
       <option value="-server"/> 
      </jvm-options> 
     </jvm> 
    </jvms> 

    <profile> 
     <subsystem xmlns="urn:jboss:domain:jmx:1.3"> 
      <expose-resolved-model/> 
      <expose-expression-model/> 
      <remoting-connector/> 
     </subsystem> 
    </profile> 
</host> 

PS:有是在Windows上的錯誤,我不能停止Wildfly服務。我必須重新啓動服務器(服務處於手動模式),然後卸載該服務。因此,我不能只卸載並安裝該服務,而無需先重新啓動服務器。有關於這個報告的錯誤,但不幸的是,這些建議不適合我。

回答

1
  1. 運行WildFly作爲服務

strating WildFly作爲服務之前,應定義環境變量:

JAVA_OPTS=-Djboss.bind.address=<local bind address> -Djboss.bind.address.management=<management bind address> -Djboss.domain.master.address=<address of the domain controller> 

注意!!!對於WildFly 10只需要添加額外的變量:jboss.bind.address.private =集羣>

Powershell的服務器的地址<:

[Environment]::SetEnvironmentVariable("JAVA_OPTS", "-Djboss.bind.address=<local bind address> -Djboss.bind.address.management=<management bind address> -Djboss.domain.master.address=<address of the domain controller>", "Machine") 

最後一個參數「jboss.domain.master.address 「 - 只需要從節點。

Windows服務可以通過腳本里面安裝 < wildfly_home_dir> /斌/服務:

主節點

service.bat install /host master 

從節點

service.bat install /controller <domain_conroller_address>:9990 /host <slave_host_name> /user <admin_user_to_domain_controller> /password <admin_password_to_domain_controller> 

對於從節點需要更改系統註冊表項(激活從屬模式配置):

註冊表編輯器

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Wildfly\Parameters\Start 
Params:REG_MULTI_SZ 
/c "set NOPAUSE=Y && domain.bat --host-config=host-slave.xml" 
  • 定義安全憑證管理
  • 在域控制器節點添加爲從節點的新用戶(可以是用於一個用戶所有節點)。交互式命令行腳本 - add_user [.bat]。

    完成後 - 它將在控制檯上打印帶有密碼的XML標籤(<祕密值...)。這應該被複制並插入從節點上的host-slave.xml文件中(用戶名應作爲屬性「用戶名」添加到標記主機/域控制器/遠程機器上:

    host-slave.xml

    <host xmlns="urn:jboss:domain:3.0" name="slave"> 
        <management> 
         <security-realms> 
          <security-realm name="ManagementRealm"> 
           <server-identities> 
            <secret value="MQ=="/> 
           </server-identities> 
          </security-realm> 
         </security-realms> 
        </management> 
        <domain-controller> 
         <remote security-realm="ManagementRealm" username="slave"> 
          <discovery-options> 
           <static-discovery name="primary" protocol="${jboss.domain.master.protocol:remote}" host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}"/> 
          </discovery-options> 
         </remote> 
        </domain-controller> 
    </host> 
    
  • 開始主節點
  • 配置HornetMQ/ActiveMQ的集羣密碼
  • 的JBoss-CLI

    /profile=full-ha/subsystem=messaging/hornetq-server=default:write-attribute(name=cluster-password,value="${jboss.messaging.cluster.password:CHANGE ME!!}") 
    

    另一種方法是爲全部配置中的所有WildFly節點定義一個系統環境變量:jboss.messaging.cluster.password(可以在啓動域控制器後在管理UI界面中完成)。

    5.啓動的從節​​點

    +0

    服務在主服務器上成功安裝,但在重新啓動時停止停止停止 – Haider