Drools6.4动态加加载规则之(三)kie-wb与kie-server的集群应用

1.说明

本例讲解的是使用6.4.0.Final版本kie-wb(drools workbench)与 kie-server(KIE Execution Server)的集群搭建,;使用wildfly服务器

2.下载

drools workbench : https://download.jboss.org/drools/release/6.4.0.Final/kie-drools-wb-distribution-wars-6.4.0.Final-wildfly8.war
KIE Execution Server: https://download.jboss.org/drools/release/6.4.0.Final/kie-server-distribution-6.4.0.Final.zip

3.集群架构图



4.机器列表

192.168.1.91(kie-web集群) 
192.168.1.92(kie-web集群)  
192.168.1.93(kie-server集群)  
192.168.1.94(kie-server集群)  
192.168.1.95 (zk+helix)

5.kie-wb集群配置

helix客户端安装(两台均需安装)

http://mirrors.tuna.tsinghua.edu.cn/apache/helix/0.6.5/binaries/helix-core-0.6.5-pkg.tar
安装
略  
配置
两台机器分别新增helix节点:  
 ./helix-admin.sh --zkSvr 192.168.1.95:2181 --addNode kie-cluster nodeOne:12345  
 ./helix-admin.sh --zkSvr 192.168.1.95:2181 --addNode kie-cluster nodeTwo:12346


wildfly配置  
/usr/local/wildfly/domain/configuration/domain.xml(仅需domain所在机器需要配置)   
full环境增加认证安全认证  

<security-domain name="kie-ide" cache-type="default">  
    <authentication>
         <login-module code="Remoting" flag="optional">
             <module-option name="password-stacking" value="useFirstPass"/>
         </login-module>
         <login-module code="RealmDirect" flag="required">
             <module-option name="password-stacking" value="useFirstPass"/>
         </login-module>
    </authentication>
</security-domain> 


/usr/local/wildfly/domain/configuration/host.xml(两台均需要配置)  
  
<jvms>
      	<jvm name="default">
      		<!-- jdk属性 -->
      		<heap size="1024m" max-size="1536m"/>
      		<permgen size="256m" max-size="356m"/>
      		<jvm-options>
      		<option value="-server"/>
      	</jvm-options>
     </jvm>
    </jvms>
    <servers>
        <server name="server-one" group="main-server-group">
        <!--配置属性 -->
        	<system-properties>
          		<property name="jboss.node.name" value="nodeOne" boot-time="true"/>
          		<property name="org.uberfire.nio.git.dir" value="/tmp/kie/nodeone" boot-time="true"/>
          		<property name="org.uberfire.metadata.index.dir" value="/tmp/kie/nodeone" boot-time="true"/>
          		<property name="org.uberfire.cluster.id" value="kieCluster" boot-time="true"/>
          		<property name="org.uberfire.cluster.zk" value="192.168.1.95:2181" boot-time="true"/>
          		<property name="org.uberfire.cluster.local.id" value="nodeOne_12345" boot-time="true"/>
          		<property name="org.uberfire.cluster.vfs.lock" value="vfs-repo" boot-time="true"/>
         		<property name="org.kie.demo" value="false" boot-time="true" />
         		<property name="org.kie.example" value="false" boot-time="true"/>
         		<property name="org.uberfire.nio.git.daemon.enabled" value="true" boot-time="true"/>
         		<property name="org.uberfire.nio.git.daemon.host" value="192.168.1.91" boot-time="true" />
        		<property name="org.uberfire.nio.git.daemon.port" value="9418" boot-time="true"/>
       			<property name="org.kie.server.user" value="kieserver" boot-time="true" />
       			<property name="org.kie.server.pwd" value="kieserver1!" boot-time="true" />
       			<property name="org.guvnor.m2repo.dir" value="/root/.m2/repository" boot-time="true" />
      		</system-properties>
      </server>
    </servers>

 

6.kie-server集群

maven扫描配置:/root/.m2/下新增settings.xml文件 (两台均线配置)
 <settings>
     <localRepository>/root/.m2/repository</localRepository>
    <proxies>
    </proxies>
    <servers>
    <server>
      <id>kie-workbench</id>
      <username>admin</username>
      <password>admin</password>
      <configuration>
        <wagonProvider>httpclient</wagonProvider>
        <httpConfiguration>
          <all>
            <usePreemptive>true</usePreemptive>
          </all>
        </httpConfiguration>
      </configuration>
    </server>
    </servers>
    <mirrors>
    </mirrors>
    <profiles>
    <profile>
      <id>kie</id>
      <properties>
      </properties>
      <repositories>
        <repository>
          <id>kie-workbench</id>
          <name>JBoss BRMS Guvnor M2 Repository</name>
          <url>http://192.168.1.91:8080/kie-wb/maven2/</url>
          <activation>
     	     <activeByDefault>true</activeByDefault>
    	  </activation>
	  <layout>default</layout>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>kie-workbench</id>
          <name>JBoss BRMS Guvnor M2 Repository</name>
          <url>http://192.168.1.91:8080/kie-wb/maven2/</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    </profiles>
    <activeProfiles>
    <activeProfile>kie</activeProfile>
    </activeProfiles>
    </settings>

wildfly配置  
/usr/local/wildfly/domain/configuration/host.xml(两台均需要配置) 
 <jvms>
      	<jvm name="default">
          <heap size="1024m" max-size="1536m"/>
          <permgen size="256m" max-size="356m"/>
            <jvm-options>
                <option value="-server"/>
            </jvm-options>
       </jvm>
 	</jvms>
    <servers>
        <server name="server-one" group="main-server-group">
			<system-properties>
			<!--配置本机地址-->
      			<property name="org.kie.server.location" value="http://192.168.1.93:8080/kie-server/services/rest/server" boot-time="false"/>
      			<property name="org.kie.server.id" value="kie-server1" boot-time="false"/>
      			<property name="org.kie.server.controller.user" value="kieserver" boot-time="false"/>
      			<property name="org.kie.server.controller.pwd" value="kieserver1!" boot-time="false"/>
      			<!--配置kie-web地址 failover策略-->
      			<property name="org.kie.server.controller" value="http://192.168.1.91:8080/kie-wb/rest/controller,http://192.168.1.92:8080/kie-wb/rest/controller" boot-time="false"/>
      			<property name="org.kie.server.persistence.dialect" value="org.hibernate.dialect.H2Dialect" boot-time="false"/>
	     		<property name="org.kie.server.persistence.ds" value="java:jboss/datasources/ExampleDS" boot-time="false"/>
                <property name="org.kie.server.persistence.tm" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" boot-time="false"/>
    			<property name="kie.maven.settings.custom" value="/root/.m2/settings.xml" boot-time="false" />
			</system-properties>
    	</server>
    </servers>

7.zk以及helix配置

zk

下载  

http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz  
安装  

配置
将zoo_sample.cfg重名为zoo.cof  
其他为默认配置
启动
./zkServer.sh start

helix

下载  
http://mirrors.tuna.tsinghua.edu.cn/apache/helix/0.6.5/binaries/helix-core-0.6.5-pkg.tar
安装
略  
配置
ps: 以下操作需要先启动zk

 cd $HELIX_HOME/bin
 #新增cluster   
 ./helix-admin.sh --zkSvr localhost:2181 --addCluster kie-cluster
 #新增共享资源库
 ./helix-admin.sh --zkSvr localhost:2181 --addCluster kie-cluster
 #新增两个节点 ps:注意此步骤在kie-wb集群的每台机器上操作
 ./helix-admin.sh --zkSvr 192.168.1.95:2181 --addNode kie-cluster nodeOne:12345
 ./helix-admin.sh --zkSvr 192.168.1.95:2181 --addNode kie-cluster nodeTwo:12346
 #初始化集群
 ./helix-admin.sh --zkSvr localhost:2181 --rebalance kie-cluster vfs-repo 2 

8.集群启动  

1.启动zk  
./zkServer.sh start    
2.启动helix controller 
./run-helix-controller.sh --zkSvr localhost:2181 --cluster kie-cluster 2>&1 > /tmp/controller.log &
3.启动kie-web集群  
ps:重新服务器过后,container自动重启,但是自动扫描会失效需要重新配置  
4.启动kie-server集群

9.测试与应用



其他文章
Drools6.4动态加载规则之(一)模板的简单应用 :http://www.voidcn.com/article/p-mntlhgxm-bkx.html
Drools6.4动态加载规则之(二)动态创建kjar:http://www.voidcn.com/article/p-omtgdaey-bkx.html

更多精彩内容请继续关注我的博客http://blog.csdn.NET/caicongyang

记录与分享,你我共成长 -from  caicongyang
相关文章
相关标签/搜索